Imprimer

Terminal Script pour jOpenSim

Categories Linden Script Language | Scripts Tags Lsl | Scripts
Compat OpenSim Aurora-Sim Diva Disto Second Life Langage Lsl
  • Titre
    Terminal Script pour jOpenSim
  • Internalisation
    Français
  • Permissions
    Copy | Modify | Transfert
  • Gratuit
    Oui
  • Page vues
    15803 fois
  • Favoris
    Ajouter aux favoris
  • J'aime
  • Voter
    (2 votes)

Ce script permet de créer un Terminal pour jOpenSim. Un terminal permet à vos utilisateurs de synconiser leur compte OpenSim avec leur compte Joomla.

Afin d'éviter tous disfonctionnements, veuillez suivre la procédure d'installation suivante :

  • Tout d'abord créer un Prim aller sur l'onglet 'Contenu" et cliquer sur "Créer un nouveau Script"
  • Copier/Coller le script ci-dessous dedans :
Terminal Script pour jOpenSim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
//********************************
//* TerminalScript for jOpenSim *
//* *
//* created 2011-01-20 by FoTo50 *
//* http://www.foto50.com *
//********************************
 
// this is the target script, handling the requests
string targetUrl = "http://path-to-your-joomla/components/com_opensim/interface.php";
 
// Channel for the Tracker to listen to
integer listenchannel = 555;
 
// This will appear as a brief description at the "Terminal Link List" of jOpenSim
string terminalDescription = "jOpenSim Terminal";
 
// nothing interesting to change below this point!!!
key requestId;
key registerId;
key response_key;
string resident;
string myurl;
string querystring;
key owner;
integer dialogchannel;
 
default
{
 state_entry()
 {
 if(targetUrl == "http://path-to-your-joomla/components/com_opensim/interface.php")
 {
 llOwnerSay("Please enter the correct path for 'targetUrl' first");
 }
 
 else
 {
 dialogchannel = (integer)(llFrand(99999.0) * -1);
 owner = llGetOwner();
 llRequestURL();
 llOwnerSay("Terminal running");
 string registerUrl = targetUrl+"?action=register&terminalDescription="
 +llEscapeURL(terminalDescription)+"&myurl="+myurl;
 registerId = llHTTPRequest(registerUrl,[HTTP_METHOD,"GET"],"");
 llListen(listenchannel, "", NULL_KEY, "");
 llListen(dialogchannel,"", NULL_KEY,"");
 }
 }
 
 listen (integer channel, string name, key id, string message)
 {
 if (channel != listenchannel && channel != dialogchannel)
 {
 return;
 }
 
 if (channel == dialogchannel)
 {
 if (id == owner)
 {
 if (message == "Yes")
 {
 string registerUrl = targetUrl+"?action=setState&state=1";
 registerId = llHTTPRequest(registerUrl,[HTTP_METHOD,"GET"],"");
 }
 
 if(message == "No")
 {
 string registerUrl = targetUrl+"?action=setState&state=0";
 registerId = llHTTPRequest(registerUrl,[HTTP_METHOD,"GET"],"");
 }
 }
 
 else
 {
 if(message == "Yes")
 {
 llGiveInventory(id,llGetInventoryName(INVENTORY_NOTECARD, 0));
 }
 }
 }
 
 else
 {
 string action = llGetSubString(message,0,7);
 string identString = llGetSubString(message,9,-1);
 
 if( action == "identify" )
 {
 response_key = id;
 string requestUrl = targetUrl+"?action=identify&identString="
 +llEscapeURL(identString)+"&identKey="+(string)id;
 requestId = llHTTPRequest(requestUrl,[HTTP_METHOD,"GET"],"");
 }
 }
 }
 
 http_request(key id, string method, string body)
 { 
 if (method == URL_REQUEST_GRANTED)
 {
 myurl=body;
 string registerUrl = targetUrl+"?action=register&terminalDescription="
 +llEscapeURL(terminalDescription)+"&myurl="+myurl;
 registerId = llHTTPRequest(registerUrl,[HTTP_METHOD,"GET"],"");
 }
 
 else if (method=="GET" || method=="POST")
 {
 querystring = llGetHTTPHeader(id,"x-query-string");
 
 if (querystring == "ping=jOpenSim")
 {
 llHTTPResponse(id,200,"ok, I am here");
 }
 }
 }
 
 touch_start(integer count)
 {
 if (llDetectedKey(0) == owner)
 {
 llDialog(llDetectedKey(0), "\nShow this terminal in jOpenSim?",
 ["Yes", "No"], dialogchannel);
 }
 
 else
 {
 llDialog(llDetectedKey(0), "\nI am an jOpenSim terminal!
 \nWant to get a notecard to see what I can do for you?",
 ["Yes", "No"], dialogchannel);
 }
 }
 
 http_response(key request_id, integer status, list metadata, string body)
 {
 if (request_id == requestId)
 {
 integer i = llSubStringIndex(body,resident);
 string messagestring = llGetSubString(body,i,i+llStringLength(resident)+36);
 string seentrigger = llGetSubString(messagestring,0,4);
 
 if(response_key != NULL_KEY) llInstantMessage(response_key,body);
 }
 
 if (request_id == registerId)
 {
 integer i = 0;
 integer end = llGetListLength(metadata);
 
 for (i=0; i<end; i++)
 {
 llOwnerSay("string=" + llList2String(metadata,i));
 }
 
 llOwnerSay(body);
 }
 }
}