forked from rdc/HyperGate
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmonitor
More file actions
127 lines (90 loc) · 3.62 KB
/
monitor
File metadata and controls
127 lines (90 loc) · 3.62 KB
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
//
// Copyright 2009-2013 Zvi ben Yaakov (a.k.a rdc) <hypergate.src@infosoc.net> http://TheHyperGates.com
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// HyperGate Version 0.7.3
//// Explanation
//
// Placing this script in any Object will register the Object on the HyperGate Network
//
// Once an Object has been successfully registered, it will be listed in the Menus of other HyperGates
// and will be listed on the web site
//
// There are two prerequisites for successful registration of the Object
//
// - The Owner of the Object should be registered on the Network.
// If the Owner has used a registered HyperGate on a grid other than the Home grid of the Owner,
// then the Owner will automatically be registered.
//
// - The Object should be rezzed on the Home grid of the Owner
//
////
string SOFTWARE_REV = "v0.7.3";
// http<->db related vars
string protocol = "http";
string topLevel = "com";
string URL ;
string secondLevel = "rollin";
string thirdLevel = "basekix";
key initNodeid; // http request id
initializeStrings(){
URL = protocol + "://" + thirdLevel + "." + secondLevel + "." + topLevel + "/"; // getHGData url
}
init(){
// Grab Parcel Info
list lstParcelDetails = llGetParcelDetails(llGetPos(), [PARCEL_DETAILS_NAME, PARCEL_DETAILS_DESC, PARCEL_DETAILS_OWNER, PARCEL_DETAILS_GROUP, PARCEL_DETAILS_AREA]);
// Set Parcel Variables
string ParcelName = llList2String(lstParcelDetails, 0); // Parcel's Name (63 Characters Max)
string ParcelDesc = llList2String(lstParcelDetails, 1); // Parcels Description (127 Characters Max)
key ParcelOwner = llList2Key(lstParcelDetails, 2); // Parcel Owners Key (AV Or Group Key If Group Owned)
key ParcelGroup = llList2Key(lstParcelDetails, 3); // Parcel's Group Key (NULL_KEY Unless Group Set Or Owned By Group)
integer ParcelArea = llList2Integer(lstParcelDetails, 4); // Parcel's Size (In Meters Squared. ie: 512, 1024...)
//initialize HG network node
initNodeid = llHTTPRequest( URL + "initNode/" + llGetSimulatorHostname()
+ "&pos=" + (string)llGetPos()
+ "&v=" + SOFTWARE_REV
+ "&pn=" + ParcelName
+ "&pd=" + ParcelDesc
+ "&po=" + (string)ParcelOwner
+ "&pg=" + (string)ParcelGroup
+ "&pa=" + (string)ParcelArea
// + "&=" +
// + "&=" +
// + "&=" +
, [], "" );
}
check_in(){
//initialize HG network node
// fix: the &pos= param should only be checked and sent when there has been a change in location ("changed" event?)
initNodeid = llHTTPRequest( URL + "checkIn/ping" + "&pos=" + (string)llGetPos() , [], "" );
}
default
{
state_entry()
{
initializeStrings();
llSetTimerEvent(120.0);
init();
}
touch_start(integer _det) {
}
timer(){
check_in();
}
on_rez(integer start_param) {
// every time we're rezzed, reset the script
// this ensures that if we're transferred to a new owner, we're listening to them and not still to the previous one
llResetScript();
}
}