diff options
Diffstat (limited to 'LuaSL/src')
-rw-r--r-- | LuaSL/src/LSL.lua | 685 | ||||
-rw-r--r-- | LuaSL/src/LuaSL_compile.c | 4 | ||||
-rw-r--r-- | LuaSL/src/constants.lsl | 269 |
3 files changed, 368 insertions, 590 deletions
diff --git a/LuaSL/src/LSL.lua b/LuaSL/src/LSL.lua index d618e65..2f337a5 100644 --- a/LuaSL/src/LSL.lua +++ b/LuaSL/src/LSL.lua | |||
@@ -1,19 +1,4 @@ | |||
1 | -- A module of LSL stuffs. | 1 | -- A module of LSL stuffs. |
2 | -- TODO - currently there is a constants.lsl file. Move it into here. | ||
3 | -- It contains LSL constants and ll*() functions stubs. | ||
4 | -- The compiler compiles that into a LSL_Scripts structure at startup, | ||
5 | -- then uses that for function and variable lookups, as well as looking up in the current script. | ||
6 | -- I can run this at compiler startup time, then iterate through the LSL table from C to generate that LSL_Script structure. | ||
7 | --[[ | ||
8 | Have an array of functions and argument types. | ||
9 | Compiler startup writes a short script that loads this module as normal, then calls the special "gimme the LSL" function. | ||
10 | The function runs through the array, calling back to C, passing each function definition. | ||
11 | It also runs through the constants, calling back to C, passing each constant type, name, and value. | ||
12 | In both cases, it could just combine them all (variables and functions together) into one big string blob to pass to the lexer+parser. | ||
13 | Hook up the metatable _call method to check if the function is in the array, then pass it to OpenSim. | ||
14 | The array includes any return type, so _call knows if it has to wait for the reply. | ||
15 | So the function array should have some structure, to be able to tell the function name, and the various types. | ||
16 | ]] | ||
17 | 2 | ||
18 | -- Using a module means it gets compiled each time? Maybe not if I can use bytecode files. Perhaps LuaJIT caches these? | 3 | -- Using a module means it gets compiled each time? Maybe not if I can use bytecode files. Perhaps LuaJIT caches these? |
19 | -- Does not seem to be slowing it down noticably, but that might change once the stubs are filled out. | 4 | -- Does not seem to be slowing it down noticably, but that might change once the stubs are filled out. |
@@ -41,7 +26,6 @@ upvalue--either way is a bit more efficient and less error prone. | |||
41 | local LSL = {}; | 26 | local LSL = {}; |
42 | local SID = ""; | 27 | local SID = ""; |
43 | 28 | ||
44 | |||
45 | -- Debugging aids | 29 | -- Debugging aids |
46 | 30 | ||
47 | -- Functions to print tables. | 31 | -- Functions to print tables. |
@@ -70,6 +54,7 @@ function msg(...) | |||
70 | print(SID, ...) -- The comma adds a tab, fancy that. B-) | 54 | print(SID, ...) -- The comma adds a tab, fancy that. B-) |
71 | end | 55 | end |
72 | 56 | ||
57 | |||
73 | -- LSL function and constant creation stuff. | 58 | -- LSL function and constant creation stuff. |
74 | 59 | ||
75 | local function newConst(Type, name, value) | 60 | local function newConst(Type, name, value) |
@@ -77,261 +62,302 @@ local function newConst(Type, name, value) | |||
77 | return { Type = Type, name = name } | 62 | return { Type = Type, name = name } |
78 | end | 63 | end |
79 | 64 | ||
80 | local function newFunc(Type, name, ... ) | 65 | local function newFunc(Type, ... ) |
81 | return { Type = Type, name = name, args = ... } | 66 | return { Type = Type, args = {...} } |
82 | end | 67 | end |
83 | 68 | ||
84 | local functions = | 69 | |
85 | { | 70 | -- LSL constants. |
86 | newFunc("key", "llAvatarOnSitTarget"), | ||
87 | newFunc("list", "llGetAnimationList", "key"), | ||
88 | } | ||
89 | 71 | ||
90 | local constants = | 72 | local constants = |
91 | { | 73 | { |
92 | newConst("float", "PI", 3.14159265358979323846264338327950), | 74 | newConst("float", "PI", 3.14159265358979323846264338327950), |
75 | newConst("float", "PI_BY_TWO", LSL.PI / 2), -- 1.57079632679489661923132169163975 | ||
76 | newConst("float", "TWO_PI", LSL.PI * 2), -- 6.28318530717958647692528676655900 | ||
77 | newConst("float", "DEG_TO_RAD", LSL.PI / 180.0), -- 0.01745329252 | ||
78 | newConst("float", "RAD_TO_DEG", 180.0 / LSL.PI), -- 57.2957795131 | ||
79 | newConst("float", "SQRT2", 1.4142135623730950488016887242097), | ||
80 | |||
81 | newConst("integer", "CHANGED_INVENTORY", 0x001), | ||
82 | newConst("integer", "CHANGED_COLOR", 0x002), | ||
83 | newConst("integer", "CHANGED_SHAPE", 0x004), | ||
84 | newConst("integer", "CHANGED_SCALE", 0x008), | ||
85 | newConst("integer", "CHANGED_TEXTURE", 0x010), | ||
86 | newConst("integer", "CHANGED_LINK", 0x020), | ||
87 | newConst("integer", "CHANGED_ALLOWED_DROP", 0x040), | ||
88 | newConst("integer", "CHANGED_OWNER", 0x080), | ||
89 | newConst("integer", "CHANGED_REGION", 0x100), | ||
90 | newConst("integer", "CHANGED_TELEPORT", 0x200), | ||
91 | newConst("integer", "CHANGED_REGION_START", 0x400), | ||
92 | newConst("integer", "CHANGED_MEDIA", 0x800), | ||
93 | |||
94 | newConst("integer", "DEBUG_CHANNEL", 2147483647), | ||
95 | newConst("integer", "PUBLIC_CHANNEL", 0), | ||
96 | |||
97 | newConst("integer", "INVENTORY_ALL", -1), | ||
98 | newConst("integer", "INVENTORY_NONE", -1), | ||
99 | newConst("integer", "INVENTORY_TEXTURE", 0), | ||
100 | newConst("integer", "INVENTORY_SOUND", 1), | ||
101 | newConst("integer", "INVENTORY_LANDMARK", 3), | ||
102 | newConst("integer", "INVENTORY_CLOTHING", 5), | ||
103 | newConst("integer", "INVENTORY_OBJECT", 6), | ||
104 | newConst("integer", "INVENTORY_NOTECARD", 7), | ||
105 | newConst("integer", "INVENTORY_SCRIPT", 10), | ||
106 | newConst("integer", "INVENTORY_BODYPART", 13), | ||
107 | newConst("integer", "INVENTORY_ANIMATION", 20), | ||
108 | newConst("integer", "INVENTORY_GESTURE", 21), | ||
109 | |||
110 | newConst("integer", "ALL_SIDES", -1), | ||
111 | newConst("integer", "LINK_SET", -1), | ||
112 | newConst("integer", "LINK_ROOT", 1), | ||
113 | newConst("integer", "LINK_ALL_OTHERS", -2), | ||
114 | newConst("integer", "LINK_ALL_CHILDREN", -3), | ||
115 | newConst("integer", "LINK_THIS", -4), | ||
116 | |||
117 | newConst("integer", "PERM_ALL", 0x7FFFFFFF), | ||
118 | newConst("integer", "PERM_COPY", 0x00008000), | ||
119 | newConst("integer", "PERM_MODIFY", 0x00004000), | ||
120 | newConst("integer", "PERM_MOVE", 0x00080000), | ||
121 | newConst("integer", "PERM_TRANSFER", 0x00002000), | ||
122 | newConst("integer", "MASK_BASE", 0), | ||
123 | newConst("integer", "MASK_OWNER", 1), | ||
124 | newConst("integer", "MASK_GROUP", 2), | ||
125 | newConst("integer", "MASK_EVERYONE", 3), | ||
126 | newConst("integer", "MASK_NEXT", 4), | ||
127 | newConst("integer", "PERMISSION_DEBIT", 0x0002), | ||
128 | newConst("integer", "PERMISSION_TAKE_CONTROLS", 0x0004), | ||
129 | newConst("integer", "PERMISSION_TRIGGER_ANIMATION", 0x0010), | ||
130 | newConst("integer", "PERMISSION_ATTACH", 0x0020), | ||
131 | newConst("integer", "PERMISSION_CHANGE_LINKS", 0x0080), | ||
132 | newConst("integer", "PERMISSION_TRACK_CAMERA", 0x0400), | ||
133 | newConst("integer", "PERMISSION_CONTRAL_CAMERA", 0x0800), | ||
134 | |||
135 | newConst("integer", "AGENT", 0x01), | ||
136 | newConst("integer", "ACTIVE", 0x02), | ||
137 | newConst("integer", "PASSIVE", 0x04), | ||
138 | newConst("integer", "SCRIPTED", 0x08), | ||
139 | |||
140 | newConst("integer", "OBJECT_UNKNOWN_DETAIL", -1), | ||
141 | |||
142 | newConst("integer", "PRIM_BUMP_SHINY", 19), | ||
143 | newConst("integer", "PRIM_COLOR", 18), | ||
144 | newConst("integer", "PRIM_FLEXIBLE", 21), | ||
145 | newConst("integer", "PRIM_FULLBRIGHT", 20), | ||
146 | newConst("integer", "PRIM_GLOW", 25), | ||
147 | newConst("integer", "PRIM_MATERIAL", 2), | ||
148 | newConst("integer", "PRIM_PHANTOM", 5), | ||
149 | newConst("integer", "PRIM_PHYSICS", 3), | ||
150 | newConst("integer", "PRIM_POINT_LIGHT", 23), | ||
151 | newConst("integer", "PRIM_POSITION", 6), | ||
152 | newConst("integer", "PRIM_ROTATION", 8), | ||
153 | newConst("integer", "PRIM_SIZE", 7), | ||
154 | newConst("integer", "PRIM_TEMP_ON_REZ", 4), | ||
155 | newConst("integer", "PRIM_TYPE", 9), | ||
156 | newConst("integer", "PRIM_TYPE_OLD", 1), | ||
157 | newConst("integer", "PRIM_TEXGEN", 22), | ||
158 | newConst("integer", "PRIM_TEXTURE", 17), | ||
159 | newConst("integer", "PRIM_TEXT", 26), | ||
160 | |||
161 | newConst("integer", "PRIM_BUMP_NONE", 0), | ||
162 | newConst("integer", "PRIM_BUMP_BRIGHT", 1), | ||
163 | newConst("integer", "PRIM_BUMP_DARK", 2), | ||
164 | newConst("integer", "PRIM_BUMP_WOOD", 3), | ||
165 | newConst("integer", "PRIM_BUMP_BARK", 4), | ||
166 | newConst("integer", "PRIM_BUMP_BRICKS", 5), | ||
167 | newConst("integer", "PRIM_BUMP_CHECKER", 6), | ||
168 | newConst("integer", "PRIM_BUMP_CONCRETE", 7), | ||
169 | newConst("integer", "PRIM_BUMP_TILE", 8), | ||
170 | newConst("integer", "PRIM_BUMP_STONE", 9), | ||
171 | newConst("integer", "PRIM_BUMP_DISKS", 10), | ||
172 | newConst("integer", "PRIM_BUMP_GRAVEL", 11), | ||
173 | newConst("integer", "PRIM_BUMP_BLOBS", 12), | ||
174 | newConst("integer", "PRIM_BUMP_SIDING", 13), | ||
175 | newConst("integer", "PRIM_BUMP_LARGETILE", 14), | ||
176 | newConst("integer", "PRIM_BUMP_STUCCO", 15), | ||
177 | newConst("integer", "PRIM_BUMP_SUCTION", 16), | ||
178 | newConst("integer", "PRIM_BUMP_WEAVE", 17), | ||
179 | |||
180 | newConst("integer", "PRIM_HOLE_DEFAULT", 0), | ||
181 | newConst("integer", "PRIM_HOLE_CIRCLE", 16), | ||
182 | newConst("integer", "PRIM_HOLE_SQUARE", 32), | ||
183 | newConst("integer", "PRIM_HOLE_TRIANGLE", 48), | ||
184 | |||
185 | newConst("integer", "PRIM_MATERIAL_STONE", 0), | ||
186 | newConst("integer", "PRIM_MATERIAL_METAL", 1), | ||
187 | newConst("integer", "PRIM_MATERIAL_GLASS", 2), | ||
188 | newConst("integer", "PRIM_MATERIAL_WOOD", 3), | ||
189 | newConst("integer", "PRIM_MATERIAL_FLESH", 4), | ||
190 | newConst("integer", "PRIM_MATERIAL_PLASTIC", 5), | ||
191 | newConst("integer", "PRIM_MATERIAL_RUBBER", 6), | ||
192 | newConst("integer", "PRIM_MATERIAL_LIGHT", 7), | ||
193 | |||
194 | newConst("integer", "PRIM_SCULPT_TYPE_SPHERE", 1), | ||
195 | newConst("integer", "PRIM_SCULPT_TYPE_TORUS", 2), | ||
196 | newConst("integer", "PRIM_SCULPT_TYPE_PLANE", 3), | ||
197 | newConst("integer", "PRIM_SCULPT_TYPE_CYLINDER", 4), | ||
198 | newConst("integer", "PRIM_SCULPT_TYPE_MESH", 5), | ||
199 | newConst("integer", "PRIM_SCULPT_TYPE_MIMESH", 6), | ||
200 | |||
201 | newConst("integer", "PRIM_SHINY_NONE", 0), | ||
202 | newConst("integer", "PRIM_SHINY_LOW", 1), | ||
203 | newConst("integer", "PRIM_SHINY_MEDIUM", 2), | ||
204 | newConst("integer", "PRIM_SHINY_HIGH", 3), | ||
205 | |||
206 | newConst("integer", "PRIM_TYPE_BOX", 0), | ||
207 | newConst("integer", "PRIM_TYPE_CYLINDER", 1), | ||
208 | newConst("integer", "PRIM_TYPE_PRISM", 2), | ||
209 | newConst("integer", "PRIM_TYPE_SPHERE", 3), | ||
210 | newConst("integer", "PRIM_TYPE_TORUS", 4), | ||
211 | newConst("integer", "PRIM_TYPE_TUBE", 5), | ||
212 | newConst("integer", "PRIM_TYPE_RING", 6), | ||
213 | newConst("integer", "PRIM_TYPE_SCULPT", 7), | ||
214 | |||
215 | newConst("integer", "STRING_TRIM", 3), | ||
216 | newConst("integer", "STRING_TRIM_HEAD", 1), | ||
217 | newConst("integer", "STRING_TRIM_TAIL", 2), | ||
218 | |||
219 | newConst("integer", "TRUE", 1), | ||
220 | newConst("integer", "FALSE", 0), | ||
221 | |||
222 | newConst("integer", "TYPE_INTEGER", 1), | ||
223 | newConst("integer", "TYPE_FLOAT", 2), | ||
224 | newConst("integer", "TYPE_STRING", 3), | ||
225 | newConst("integer", "TYPE_KEY", 4), | ||
226 | newConst("integer", "TYPE_VECTOR", 5), | ||
227 | newConst("integer", "TYPE_ROTATION", 6), | ||
228 | newConst("integer", "TYPE_INVALID", 0), | ||
229 | |||
230 | newConst("string", "NULL_KEY", "00000000-0000-0000-0000-000000000000"), | ||
231 | newConst("string", "EOF", "\\n\\n\\n"), -- Corner case, dealt with later. | ||
232 | |||
233 | newConst("rotation", "ZERO_ROTATION", {x=0.0, y=0.0, z=0.0, s=1.0}), | ||
234 | newConst("vector", "ZERO_VECTOR", {x=0.0, y=0.0, z=0.0}), | ||
235 | |||
236 | -- TODO - Temporary dummy variables to get vector and rotation thingies to work for now. | ||
237 | |||
238 | newConst("float", "s", 1.0), | ||
239 | newConst("float", "x", 0.0), | ||
240 | newConst("float", "y", 0.0), | ||
241 | newConst("float", "z", 0.0), | ||
93 | } | 242 | } |
94 | 243 | ||
244 | -- ll*() function definitions | ||
95 | 245 | ||
96 | -- LSL constants. | 246 | local functions = |
247 | { | ||
248 | -- LSL avatar functions | ||
249 | llAvatarOnSitTarget = newFunc("key"), | ||
250 | llGetAnimationList = newFunc("list", "key id"), | ||
251 | llGetPermissions = newFunc("integer"), | ||
252 | llGetPermissionsKey = newFunc("key"), | ||
253 | llKey2Name = newFunc("string", "key avatar"), | ||
254 | llRequestPermissions = newFunc("", "key avatar", "integer perms"), | ||
255 | llSameGroup = newFunc("integer", "key avatar"), | ||
256 | llStartAnimation = newFunc("", "string anim"), | ||
257 | llStopAnimation = newFunc("", "string anim"), | ||
258 | llUnSit = newFunc("", "key avatar"), | ||
97 | 259 | ||
98 | LSL.PI = 3.14159265358979323846264338327950; | 260 | -- LSL collision / detect / sensor functions |
99 | LSL.PI_BY_TWO = LSL.PI / 2; -- 1.57079632679489661923132169163975 | 261 | llDetectedGroup = newFunc("key", "integer index"), |
100 | LSL.TWO_PI = LSL.PI * 2; -- 6.28318530717958647692528676655900 | 262 | llDetectedKey = newFunc("key", "integer index"), |
101 | LSL.DEG_TO_RAD = LSL.PI / 180.0; -- 0.01745329252 | ||
102 | LSL.RAD_TO_DEG = 180.0 / LSL.PI; -- 57.2957795131 | ||
103 | LSL.SQRT2 = 1.4142135623730950488016887242097; | ||
104 | |||
105 | LSL.CHANGED_INVENTORY = 0x001; | ||
106 | LSL.CHANGED_COLOR = 0x002; | ||
107 | LSL.CHANGED_SHAPE = 0x004; | ||
108 | LSL.CHANGED_SCALE = 0x008; | ||
109 | LSL.CHANGED_TEXTURE = 0x010; | ||
110 | LSL.CHANGED_LINK = 0x020; | ||
111 | LSL.CHANGED_ALLOWED_DROP = 0x040; | ||
112 | LSL.CHANGED_OWNER = 0x080; | ||
113 | LSL.CHANGED_REGION = 0x100; | ||
114 | LSL.CHANGED_TELEPORT = 0x200; | ||
115 | LSL.CHANGED_REGION_START = 0x400; | ||
116 | LSL.CHANGED_MEDIA = 0x800; | ||
117 | |||
118 | LSL.DEBUG_CHANNEL = 2147483647; | ||
119 | LSL.PUBLIC_CHANNEL = 0; | ||
120 | |||
121 | LSL.INVENTORY_ALL = -1; | ||
122 | LSL.INVENTORY_NONE = -1; | ||
123 | LSL.INVENTORY_TEXTURE = 0; | ||
124 | LSL.INVENTORY_SOUND = 1; | ||
125 | LSL.INVENTORY_LANDMARK = 3; | ||
126 | LSL.INVENTORY_CLOTHING = 5; | ||
127 | LSL.INVENTORY_OBJECT = 6; | ||
128 | LSL.INVENTORY_NOTECARD = 7; | ||
129 | LSL.INVENTORY_SCRIPT = 10; | ||
130 | LSL.INVENTORY_BODYPART = 13; | ||
131 | LSL.INVENTORY_ANIMATION = 20; | ||
132 | LSL.INVENTORY_GESTURE = 21; | ||
133 | |||
134 | LSL.ALL_SIDES = -1; | ||
135 | LSL.LINK_SET = -1; | ||
136 | LSL.LINK_ROOT = 1; | ||
137 | LSL.LINK_ALL_OTHERS = -2; | ||
138 | LSL.LINK_ALL_CHILDREN = -3; | ||
139 | LSL.LINK_THIS = -4; | ||
140 | |||
141 | LSL.PERM_ALL = 0x7FFFFFFF; | ||
142 | LSL.PERM_COPY = 0x00008000; | ||
143 | LSL.PERM_MODIFY = 0x00004000; | ||
144 | LSL.PERM_MOVE = 0x00080000; | ||
145 | LSL.PERM_TRANSFER = 0x00002000; | ||
146 | LSL.MASK_BASE = 0; | ||
147 | LSL.MASK_OWNER = 1; | ||
148 | LSL.MASK_GROUP = 2; | ||
149 | LSL.MASK_EVERYONE = 3; | ||
150 | LSL.MASK_NEXT = 4; | ||
151 | LSL.PERMISSION_DEBIT = 0x0002; | ||
152 | LSL.PERMISSION_TAKE_CONTROLS = 0x0004; | ||
153 | LSL.PERMISSION_TRIGGER_ANIMATION = 0x0010; | ||
154 | LSL.PERMISSION_ATTACH = 0x0020; | ||
155 | LSL.PERMISSION_CHANGE_LINKS = 0x0080; | ||
156 | LSL.PERMISSION_TRACK_CAMERA = 0x0400; | ||
157 | LSL.PERMISSION_CONTRAL_CAMERA = 0x0800; | ||
158 | |||
159 | LSL.AGENT = 0x01; | ||
160 | LSL.ACTIVE = 0x02; | ||
161 | LSL.PASSIVE = 0x04; | ||
162 | LSL.SCRIPTED = 0x08; | ||
163 | |||
164 | LSL.OBJECT_UNKNOWN_DETAIL = -1; | ||
165 | |||
166 | LSL.PRIM_BUMP_SHINY = 19; | ||
167 | LSL.PRIM_COLOR = 18; | ||
168 | LSL.PRIM_FLEXIBLE = 21; | ||
169 | LSL.PRIM_FULLBRIGHT = 20; | ||
170 | LSL.PRIM_GLOW = 25; | ||
171 | LSL.PRIM_MATERIAL = 2; | ||
172 | LSL.PRIM_PHANTOM = 5; | ||
173 | LSL.PRIM_PHYSICS = 3; | ||
174 | LSL.PRIM_POINT_LIGHT = 23; | ||
175 | LSL.PRIM_POSITION = 6; | ||
176 | LSL.PRIM_ROTATION = 8; | ||
177 | LSL.PRIM_SIZE = 7; | ||
178 | LSL.PRIM_TEMP_ON_REZ = 4; | ||
179 | LSL.PRIM_TYPE = 9; | ||
180 | LSL.PRIM_TYPE_OLD = 1; | ||
181 | LSL.PRIM_TEXGEN = 22; | ||
182 | LSL.PRIM_TEXTURE = 17; | ||
183 | LSL.PRIM_TEXT = 26; | ||
184 | |||
185 | LSL.PRIM_BUMP_NONE = 0; | ||
186 | LSL.PRIM_BUMP_BRIGHT = 1; | ||
187 | LSL.PRIM_BUMP_DARK = 2; | ||
188 | LSL.PRIM_BUMP_WOOD = 3; | ||
189 | LSL.PRIM_BUMP_BARK = 4; | ||
190 | LSL.PRIM_BUMP_BRICKS = 5; | ||
191 | LSL.PRIM_BUMP_CHECKER = 6; | ||
192 | LSL.PRIM_BUMP_CONCRETE = 7; | ||
193 | LSL.PRIM_BUMP_TILE = 8; | ||
194 | LSL.PRIM_BUMP_STONE = 9; | ||
195 | LSL.PRIM_BUMP_DISKS = 10; | ||
196 | LSL.PRIM_BUMP_GRAVEL = 11; | ||
197 | LSL.PRIM_BUMP_BLOBS = 12; | ||
198 | LSL.PRIM_BUMP_SIDING = 13; | ||
199 | LSL.PRIM_BUMP_LARGETILE = 14; | ||
200 | LSL.PRIM_BUMP_STUCCO = 15; | ||
201 | LSL.PRIM_BUMP_SUCTION = 16; | ||
202 | LSL.PRIM_BUMP_WEAVE = 17; | ||
203 | |||
204 | LSL.PRIM_HOLE_DEFAULT = 0; | ||
205 | LSL.PRIM_HOLE_CIRCLE = 16; | ||
206 | LSL.PRIM_HOLE_SQUARE = 32; | ||
207 | LSL.PRIM_HOLE_TRIANGLE = 48; | ||
208 | |||
209 | LSL.PRIM_MATERIAL_STONE = 0; | ||
210 | LSL.PRIM_MATERIAL_METAL = 1; | ||
211 | LSL.PRIM_MATERIAL_GLASS = 2; | ||
212 | LSL.PRIM_MATERIAL_WOOD = 3; | ||
213 | LSL.PRIM_MATERIAL_FLESH = 4; | ||
214 | LSL.PRIM_MATERIAL_PLASTIC = 5; | ||
215 | LSL.PRIM_MATERIAL_RUBBER = 6; | ||
216 | LSL.PRIM_MATERIAL_LIGHT = 7; | ||
217 | |||
218 | LSL.PRIM_SCULPT_TYPE_SPHERE = 1; | ||
219 | LSL.PRIM_SCULPT_TYPE_TORUS = 2; | ||
220 | LSL.PRIM_SCULPT_TYPE_PLANE = 3; | ||
221 | LSL.PRIM_SCULPT_TYPE_CYLINDER = 4; | ||
222 | LSL.PRIM_SCULPT_TYPE_MESH = 5; | ||
223 | LSL.PRIM_SCULPT_TYPE_MIMESH = 6; | ||
224 | |||
225 | LSL.PRIM_SHINY_NONE = 0; | ||
226 | LSL.PRIM_SHINY_LOW = 1; | ||
227 | LSL.PRIM_SHINY_MEDIUM = 2; | ||
228 | LSL.PRIM_SHINY_HIGH = 3; | ||
229 | |||
230 | LSL.PRIM_TYPE_BOX = 0; | ||
231 | LSL.PRIM_TYPE_CYLINDER = 1; | ||
232 | LSL.PRIM_TYPE_PRISM = 2; | ||
233 | LSL.PRIM_TYPE_SPHERE = 3; | ||
234 | LSL.PRIM_TYPE_TORUS = 4; | ||
235 | LSL.PRIM_TYPE_TUBE = 5; | ||
236 | LSL.PRIM_TYPE_RING = 6; | ||
237 | LSL.PRIM_TYPE_SCULPT = 7; | ||
238 | |||
239 | LSL_RC_GET_NORMAL = 1; | ||
240 | LSL_RC_GET_ROOT_KEY = 2; | ||
241 | LSL_RC_GET_LINK_NUM = 4; | ||
242 | LSL_RC_REJECT_AGENTS = 1; | ||
243 | LSL_RC_REJECT_PHYSICAL = 2; | ||
244 | LSL_RC_REJECT_NONPHYSICAL = 4; | ||
245 | LSL_RC_REJECT_LAND = 8; | ||
246 | LSL.RC_REJECT_TYPES = 0; | ||
247 | LSL.RC_DETECT_PHANTOM = 1; | ||
248 | LSL.RC_DATA_FLAGS = 2; | ||
249 | LSL.RC_MAX_HITS = 3; | ||
250 | LSL.RCERR_UNKNOWN = -1; | ||
251 | LSL.RCERR_SIM_PERF_LOW = -2; | ||
252 | LSL.RCERR_CAST_TIME_EXCEEDED = -3; | ||
253 | |||
254 | LSL.STATUS_OK = 0; | ||
255 | LSL.STATUS_MALFORMED_PARAMS = 1000; | ||
256 | LSL.STATUS_TYPE_MISMATCH = 1001; | ||
257 | LSL.STATUS_BOUNDS_ERROR = 1002; | ||
258 | LSL.STATUS_NOT_FOUND = 1003; | ||
259 | LSL.STATUS_NOT_SUPPORTED = 1004; | ||
260 | LSL.STATUS_INTERNAL_ERROR = 1999; | ||
261 | LSL.STATUS_WHITELIST_FAILED = 2001; | ||
262 | |||
263 | LSL.STRING_TRIM = 3; | ||
264 | LSL.STRING_TRIM_HEAD = 1; | ||
265 | LSL.STRING_TRIM_TAIL = 2; | ||
266 | |||
267 | LSL.TRUE = 1; | ||
268 | LSL.FALSE = 0; | ||
269 | |||
270 | LSL.TYPE_INTEGER = 1; | ||
271 | LSL.TYPE_FLOAT = 2; | ||
272 | LSL.TYPE_STRING = 3; | ||
273 | LSL.TYPE_KEY = 4; | ||
274 | LSL.TYPE_VECTOR = 5; | ||
275 | LSL.TYPE_ROTATION = 6; | ||
276 | LSL.TYPE_INVALID = 0; | ||
277 | |||
278 | LSL.NULL_KEY = "00000000-0000-0000-0000-000000000000"; | ||
279 | LSL.EOF = "\n\n\n"; | ||
280 | |||
281 | LSL.ZERO_ROTATION = {x=0.0, y=0.0, z=0.0, s=1.0}; | ||
282 | LSL.ZERO_VECTOR = {x=0.0, y=0.0, z=0.0}; | ||
283 | |||
284 | -- TODO - Temporary dummy variables to got vector and rotation thingies to work for now. | ||
285 | |||
286 | LSL.s = 1.0; | ||
287 | LSL.x = 0.0; | ||
288 | LSL.y = 0.0; | ||
289 | LSL.z = 0.0; | ||
290 | |||
291 | -- ll*() function stubs. | ||
292 | 263 | ||
264 | -- LSL communications functions | ||
265 | llDialog = newFunc("", "key avatar", "string caption", "list arseBackwardsMenu", "integer channel"), | ||
266 | llListen = newFunc("integer", "integer channel", "string name", "key id", "string msg"), | ||
267 | llListenRemove = newFunc("", "integer handle"), | ||
268 | llOwnerSay = newFunc("", "string text"), | ||
269 | llSay = newFunc("", "integer channel", "string text"), | ||
270 | llShout = newFunc("", "integer channel", "string text"), | ||
271 | llWhisper = newFunc("", "integer channel", "string text"), | ||
272 | llMessageLinked = newFunc("", "integer link", "integer num", "string text", "key aKey"), | ||
293 | 273 | ||
294 | -- LSL avatar functions | 274 | -- LSL inventory functions. |
275 | llGetInventoryName = newFunc("string", "integer Type", "integer index"), | ||
276 | llGetInventoryNumber = newFunc("integer", "integer Type"), | ||
277 | llGetInventoryType = newFunc("integer", "string name"), | ||
278 | llGetNotecardLine = newFunc("key", "string name", "integer index"), | ||
279 | llRezAtRoot = newFunc("", "string name", "vector position", "vector velocity", "rotation rot", "integer channel"), | ||
280 | llRezObject = newFunc("", "string name", "vector position", "vector velocity", "rotation rot", "integer channel"), | ||
295 | 281 | ||
296 | function --[[key]] LSL.llAvatarOnSitTarget() return LSL.NULL_KEY end; | 282 | -- LSL list functions. |
297 | function --[[list]] LSL.llGetAnimationList(--[[key]] id) return {} end; | 283 | llCSV2List = newFunc("list", "string text"), |
298 | function --[[integer]] LSL.llGetPermissions() return 0 end; | 284 | llDeleteSubList = newFunc("list", "list l", "integer start", "integer End"), |
299 | function --[[key]] LSL.llGetPermissionsKey() return LSL.NULL_KEY end; | 285 | llDumpList2String = newFunc("string", "list l", "string separator"), |
300 | function --[[string]] LSL.llKey2Name(--[[key]] avatar) return "" end; | 286 | llGetListLength = newFunc("integer", "list l"), |
301 | function LSL.llRequestPermissions(--[[key]] avatar,--[[integer]] perms) end; | 287 | llList2CSV = newFunc("string", "list l"), |
302 | function --[[integer]] LSL.llSameGroup(--[[key]] avatar) return 0 end; | 288 | llList2Float = newFunc("float", "list l", "integer index"), |
303 | function LSL.llStartAnimation(--[[string]] anim) end; | 289 | llList2Integer = newFunc("integer", "list l", "integer index"), |
304 | function LSL.llStopAnimation(--[[string]] anim) end; | 290 | llList2Key = newFunc("key", "list l", "integer index"), |
305 | function LSL.llUnSit(--[[key]] avatar) end; | 291 | llList2List = newFunc("list", "list l", "integer start", "integer End"), |
292 | llList2String = newFunc("string", "list l", "integer index"), | ||
293 | llList2Rotation = newFunc("rotation", "list l", "integer index"), | ||
294 | llList2Vector = newFunc("vector", "list l", "integer index"), | ||
295 | llListFindList = newFunc("integer", "list l", "list l1"), | ||
296 | llListInsertList = newFunc("list", "list l", "list l1", "integer index"), | ||
297 | llListReplaceList = newFunc("list", "list l", "list part", "integer start", "integer End"), | ||
298 | llListSort = newFunc("list", "list l", "integer stride", "integer ascending"), | ||
299 | llParseString2List = newFunc("list", "string In", "list l", "list l1"), | ||
300 | llParseStringKeepNulls = newFunc("list", "string In", "list l", "list l1"), | ||
306 | 301 | ||
302 | -- LSL math functions | ||
303 | llEuler2Rot = newFunc("rotation", "vector vec"), | ||
304 | llFrand = newFunc("float", "float max"), | ||
305 | llPow = newFunc("float", "float number", "float places"), | ||
306 | llRot2Euler = newFunc("vector", "rotation rot"), | ||
307 | llRound = newFunc("integer", "float number"), | ||
307 | 308 | ||
308 | -- LSL collision / detect / sensor functions | 309 | -- LSL media functions |
310 | llPlaySound = newFunc("", "string name", "float volume"), | ||
309 | 311 | ||
310 | function --[[key]] LSL.llDetectedGroup(--[[integer]] index) return LSL.NULL_KEY end; | 312 | -- LSL object / prim functions |
311 | function --[[key]] LSL.llDetectedKey(--[[integer]] index) return LSL.NULL_KEY end; | 313 | llDie = newFunc(""), |
314 | llGetKey = newFunc("key"), | ||
315 | llGetLinkNumber = newFunc("integer"), | ||
316 | llGetObjectDesc = newFunc("string"), | ||
317 | llGetObjectName = newFunc("string"), | ||
318 | llGetOwner = newFunc("key"), | ||
319 | llSetObjectDesc = newFunc("", "string text"), | ||
320 | llSetObjectName = newFunc("", "string text"), | ||
321 | llSetPrimitiveParams = newFunc("", "list params"), | ||
322 | llSetSitText = newFunc("", "string text"), | ||
323 | llSetText = newFunc("", "string text", "vector colour", "float alpha"), | ||
324 | llSitTarget = newFunc("", "vector pos", "rotation rot"), | ||
312 | 325 | ||
326 | -- LSL rotation / scaling / translation functions | ||
327 | llGetPos = newFunc("vector", ""), | ||
328 | llGetRot = newFunc("rotation", ""), | ||
329 | llSetPos = newFunc("", "vector pos"), | ||
330 | llSetRot = newFunc("", "rotation rot"), | ||
331 | llSetScale = newFunc("", "vector scale"), | ||
313 | 332 | ||
314 | -- LSL communications functions | 333 | -- LSL script functions |
334 | llGetFreeMemory = newFunc("integer", ""), | ||
335 | llGetScriptName = newFunc("string", ""), | ||
336 | llResetOtherScript = newFunc("", "string name"), | ||
337 | llResetScript = newFunc("", ""), | ||
338 | llSetScriptState = newFunc("", "string name", "integer running"), | ||
315 | 339 | ||
316 | function LSL.llDialog(--[[key]] avatar, --[[string]] caption, --[[list]] arseBackwardsMenu,--[[integer]] channel) end; | 340 | -- LSL string functions |
317 | function --[[integer]] LSL.llListen(--[[integer]] channel, --[[string]] name, --[[key]] id, --[[string]] msg) return 0 end; | 341 | llGetSubString = newFunc("string", "string text", "integer start", "integer End"), |
318 | function LSL.llListenRemove(--[[integer]] handle) end; | 342 | llStringLength = newFunc("integer", "string text"), |
319 | function LSL.llOwnerSay(--[[string]] text) msg("Owner say: " .. text); end; | 343 | llStringTrim = newFunc("string", "string text", "integer type"), |
320 | function LSL.llSay(--[[integer]] channel, --[[string]] text) msg("Channel " .. channel .. " say: " .. text); end; | 344 | llSubStringIndex = newFunc("integer", "string text", "string sub"), |
321 | function LSL.llShout(--[[integer]] channel, --[[string]] text) msg("Channel " .. channel .. " shout: " .. text); end; | ||
322 | function LSL.llWhisper(--[[integer]] channel, --[[string]] text) msg("Channel " .. channel .. " whisper: " .. text); end; | ||
323 | 345 | ||
324 | function LSL.llMessageLinked(--[[integer]] link,--[[integer]] num, --[[string]] text, --[[key]] aKey) end; | 346 | -- LSL texture functions |
347 | llGetAlpha = newFunc("float", "integer side"), | ||
348 | llSetAlpha = newFunc("", "float alpha", "integer side"), | ||
349 | llSetColor = newFunc("", "vector colour", "integer side"), | ||
325 | 350 | ||
351 | -- LSL time functions | ||
352 | llGetTime = newFunc("float", ""), | ||
353 | llResetTime = newFunc("", ""), | ||
354 | llSetTimerEvent = newFunc("", "float seconds"), | ||
355 | llSleep = newFunc("", "float seconds"), | ||
356 | } | ||
326 | 357 | ||
327 | -- LSL inventory functions. | ||
328 | 358 | ||
329 | function --[[string]] LSL.llGetInventoryName(--[[integer]] tyPe,--[[integer]] index) return "" end; | 359 | -- TODO - fake this for now. |
330 | function --[[integer]] LSL.llGetInventoryNumber(--[[integer]] tyPe) return 0 end; | ||
331 | function --[[integer]] LSL.llGetInventoryType(--[[string]] name) return LSL.INVENTORY_SCRIPT end; | 360 | function --[[integer]] LSL.llGetInventoryType(--[[string]] name) return LSL.INVENTORY_SCRIPT end; |
332 | function --[[key]] LSL.llGetNotecardLine(--[[string]] name,--[[integer]] index) return LSL.NULL_KEY end; | ||
333 | function LSL.llRezAtRoot(--[[string]] name, --[[vector]] position, --[[vector]] velocity, --[[rotation]] rot,--[[integer]] channel) end; | ||
334 | function LSL.llRezObject(--[[string]] name, --[[vector]] position, --[[vector]] velocity, --[[rotation]] rot,--[[integer]] channel) end; | ||
335 | 361 | ||
336 | 362 | ||
337 | -- LSL list functions. | 363 | -- LSL list functions. |
@@ -483,78 +509,6 @@ function --[[list]] LSL.llParseString2List(--[[string]] In, --[[list]] l, --[[li | |||
483 | function --[[list]] LSL.llParseStringKeepNulls(--[[string]] In, --[[list]] l, --[[list]] l1) return {} end; | 509 | function --[[list]] LSL.llParseStringKeepNulls(--[[string]] In, --[[list]] l, --[[list]] l1) return {} end; |
484 | 510 | ||
485 | 511 | ||
486 | -- LSL math functions | ||
487 | |||
488 | function --[[rotation]] LSL.llEuler2Rot(--[[vector]] vec) return LSL.ZERO_ROTATION end; | ||
489 | function --[[float]] LSL.llFrand(--[[float]] max) return 0.0 end; | ||
490 | function --[[float]] LSL.llPow(--[[float]] number,--[[float]] places) return 0.0 end; | ||
491 | function --[[vector]] LSL.llRot2Euler(--[[rotation]] rot) return LSL.ZERO_VECTOR end; | ||
492 | function --[[integer]] LSL.llRound(--[[float]] number) return 0 end; | ||
493 | |||
494 | |||
495 | -- LSL media functions | ||
496 | |||
497 | function LSL.llPlaySound(--[[string]] name,--[[float]] volume) end; | ||
498 | |||
499 | |||
500 | -- LSL object / prim functions | ||
501 | |||
502 | function LSL.llDie() end; | ||
503 | function --[[key]] LSL.llGetKey() return LSL.NULL_KEY end; | ||
504 | function --[[integer]] LSL.llGetLinkNumber() return 0 end; | ||
505 | function --[[string]] LSL.llGetObjectDesc() return "" end; | ||
506 | function --[[string]] LSL.llGetObjectName() return "" end; | ||
507 | function --[[key]] LSL.llGetOwner() return LSL.NULL_KEY end; | ||
508 | function LSL.llSetObjectDesc(--[[string]] text) end; | ||
509 | function LSL.llSetObjectName(--[[string]] text) end; | ||
510 | function LSL.llSetPrimitiveParams(--[[list]] params) end; | ||
511 | function LSL.llSetSitText(--[[string]] text) end; | ||
512 | function LSL.llSetText(--[[string]] text, --[[vector]] colour,--[[float]] alpha) end; | ||
513 | function LSL.llSitTarget(--[[vector]] pos, --[[rotation]] rot) end; | ||
514 | |||
515 | |||
516 | -- LSL rotation / scaling / translation functions | ||
517 | |||
518 | function --[[vector]] LSL.llGetPos() return LSL.ZERO_VECTOR end; | ||
519 | function --[[rotation]] LSL.llGetRot() return LSL.ZERO_ROTATION end; | ||
520 | function LSL.llSetPos(--[[vector]] pos) end; | ||
521 | function LSL.llSetRot(--[[rotation]] rot) end; | ||
522 | function LSL.llSetScale(--[[vector]] scale) end; | ||
523 | |||
524 | |||
525 | -- LSL script functions | ||
526 | |||
527 | function --[[integer]] LSL.llGetFreeMemory() return 0 end; | ||
528 | function --[[string]] LSL.llGetScriptName() return "" end; | ||
529 | function LSL.llResetOtherScript(--[[string]] name) msg("llResetOtherScript(" .. name .. ")") end; | ||
530 | function LSL.llResetScript() end; | ||
531 | function LSL.llSetScriptState(--[[string]] name,--[[integer]] running) msg("llSetScriptState(" .. name .. "," .. running .. ")") end; | ||
532 | |||
533 | |||
534 | -- LSL string functions | ||
535 | |||
536 | function --[[string]] LSL.llGetSubString(--[[string]] text,--[[integer]] start,--[[integer]] eNd) return "" end; | ||
537 | function --[[integer]] LSL.llStringLength(--[[string]] text) return 0 end; | ||
538 | function --[[string]] LSL.llStringTrim(--[[string]] text,--[[integer]] tyPe) return "" end; | ||
539 | function --[[integer]] LSL.llSubStringIndex(--[[string]] text, --[[string]] sub) return 0 end; | ||
540 | |||
541 | |||
542 | -- LSL texture functions | ||
543 | |||
544 | function --[[float]] LSL.llGetAlpha(--[[integer]] side) return 0.0 end; | ||
545 | function LSL.llSetAlpha(--[[float]] alpha,--[[integer]] side) end; | ||
546 | function LSL.llSetColor(--[[vector]] colour,--[[integer]] side) end; | ||
547 | |||
548 | |||
549 | -- LSL time functions | ||
550 | |||
551 | function --[[float]] LSL.llGetTime() return 0.0 end; | ||
552 | function LSL.llResetTime() end; | ||
553 | function LSL.llSetTimerEvent(--[[float]] seconds) end; | ||
554 | function LSL.llSleep(--[[float]] seconds) msg("llSleep(" .. seconds .. ")") end; | ||
555 | |||
556 | |||
557 | |||
558 | -- Crements stuff. | 512 | -- Crements stuff. |
559 | 513 | ||
560 | function LSL.preDecrement(name) _G[name] = _G[name] - 1; return _G[name]; end; | 514 | function LSL.preDecrement(name) _G[name] = _G[name] - 1; return _G[name]; end; |
@@ -682,4 +636,95 @@ function LSL.vectorTypecast(x) | |||
682 | end | 636 | end |
683 | 637 | ||
684 | 638 | ||
639 | -- glue stuff | ||
640 | |||
641 | local args2string -- Pre declare this. | ||
642 | local mt = {} | ||
643 | |||
644 | local function value2string(value, Type) | ||
645 | local temp = "" | ||
646 | |||
647 | if "float" == Type then temp = temp .. value | ||
648 | elseif "integer" == Type then temp = temp .. value | ||
649 | elseif "key" == Type then temp = "\"" .. value .. "\"" | ||
650 | elseif "list" == Type then temp = "[" .. args2string(true, unpack(value)) .. "]" | ||
651 | elseif "table" == Type then temp = "[" .. args2string(true, unpack(value)) .. "]" | ||
652 | elseif "string" == Type then temp = "\"" .. value .. "\"" | ||
653 | elseif "rotation" == Type then temp = "<" .. value.x .. ", " .. value.y .. ", " .. value.z .. ", " .. value.s .. ">" | ||
654 | elseif "vector" == Type then temp = "<" .. value.x .. ", " .. value.y .. ", " .. value.z .. ">" | ||
655 | else | ||
656 | temp = temp .. value | ||
657 | end | ||
658 | return temp | ||
659 | end | ||
660 | |||
661 | function args2string(doType, ...) | ||
662 | local temp = "" | ||
663 | local first = true | ||
664 | |||
665 | for j,w in ipairs( {...} ) do | ||
666 | if first then first = false else temp = temp .. ", " end | ||
667 | if doType then | ||
668 | temp = temp .. value2string(w, type(w)) | ||
669 | else | ||
670 | temp = temp .. w | ||
671 | end | ||
672 | end | ||
673 | return temp | ||
674 | end | ||
675 | |||
676 | function LSL.gimmeLSL() | ||
677 | for i,v in ipairs(constants) do | ||
678 | local value = LSL[v.name] | ||
679 | |||
680 | print(v.Type .. " " .. v.name .. " = " .. value2string(value, v.Type) .. ";") | ||
681 | end | ||
682 | |||
683 | for k in pairs(functions) do | ||
684 | local v = functions[k] | ||
685 | if nil == v.args then | ||
686 | print(v.Type .. " " .. k .. "(){}") | ||
687 | else | ||
688 | print(v.Type .. " " .. k .. "(" .. args2string(false, unpack(v.args)) .. "){}") | ||
689 | end | ||
690 | end | ||
691 | LSL.EOF = "\n\n\n" -- Fix this up now. | ||
692 | end | ||
693 | |||
694 | function mt.callAndReturn( ... ) | ||
695 | print("mt.callAndReturn(" .. mt.name .. "(" .. args2string(true, ...) .. "))") | ||
696 | end | ||
697 | |||
698 | function mt.callAndWait( ... ) | ||
699 | local func = functions[mt.name] | ||
700 | |||
701 | print("mt.callAndWait(" .. mt.name .. "(" .. args2string(true, ...) .. "))") | ||
702 | |||
703 | if "float" == func.Type then return 0.0 | ||
704 | elseif "integer" == func.Type then return 0 | ||
705 | elseif "key" == func.Type then return LSL.NULL_KEY | ||
706 | elseif "list" == func.Type then return {} | ||
707 | elseif "string" == func.Type then return "" | ||
708 | elseif "rotation" == func.Type then return LSL.ZERO_ROTATION | ||
709 | elseif "vector" == func.Type then return LSL.ZERO_VECTOR | ||
710 | end | ||
711 | return nil | ||
712 | end | ||
713 | |||
714 | function mt.__index(Table, key) | ||
715 | local func = functions[key] | ||
716 | |||
717 | -- This is hacky, but we should only be running one at a time. | ||
718 | mt.name = key | ||
719 | |||
720 | if "" == func.Type then | ||
721 | return mt.callAndReturn | ||
722 | else | ||
723 | return mt.callAndWait | ||
724 | end | ||
725 | end | ||
726 | |||
727 | setmetatable(LSL, mt) | ||
728 | |||
729 | |||
685 | return LSL; | 730 | return LSL; |
diff --git a/LuaSL/src/LuaSL_compile.c b/LuaSL/src/LuaSL_compile.c index a4d54db..873e6c4 100644 --- a/LuaSL/src/LuaSL_compile.c +++ b/LuaSL/src/LuaSL_compile.c | |||
@@ -2119,7 +2119,9 @@ boolean compilerSetup(gameGlobals *game) | |||
2119 | } | 2119 | } |
2120 | 2120 | ||
2121 | // Compile the constants. | 2121 | // Compile the constants. |
2122 | snprintf(buf, sizeof(buf), "%s/src/constants.lsl", PACKAGE_DATA_DIR); | 2122 | snprintf(buf, sizeof(buf), "lua -e 'require(\"LSL\").gimmeLSL()' > %s/constants.lsl", PACKAGE_DATA_DIR); |
2123 | system(buf); | ||
2124 | snprintf(buf, sizeof(buf), "%s/constants.lsl", PACKAGE_DATA_DIR); | ||
2123 | compileLSL(game, NULL, "FAKE_SID", buf, TRUE); | 2125 | compileLSL(game, NULL, "FAKE_SID", buf, TRUE); |
2124 | 2126 | ||
2125 | return TRUE; | 2127 | return TRUE; |
diff --git a/LuaSL/src/constants.lsl b/LuaSL/src/constants.lsl deleted file mode 100644 index e462a95..0000000 --- a/LuaSL/src/constants.lsl +++ /dev/null | |||
@@ -1,269 +0,0 @@ | |||
1 | float PI = 3.14159265358979323846264338327950; | ||
2 | float PI_BY_TWO = PI / 2; // 1.57079632679489661923132169163975 | ||
3 | float TWO_PI = PI * 2; // 6.28318530717958647692528676655900 | ||
4 | float DEG_TO_RAD = PI / 180.0; // 0.01745329252 | ||
5 | float RAD_TO_DEG = 180.0 / PI; // 57.2957795131 | ||
6 | float SQRT2 = 1.4142135623730950488016887242097; | ||
7 | |||
8 | integer CHANGED_INVENTORY = 0x001; | ||
9 | integer CHANGED_COLOR = 0x002; | ||
10 | integer CHANGED_SHAPE = 0x004; | ||
11 | integer CHANGED_SCALE = 0x008; | ||
12 | integer CHANGED_TEXTURE = 0x010; | ||
13 | integer CHANGED_LINK = 0x020; | ||
14 | integer CHANGED_ALLOWED_DROP = 0x040; | ||
15 | integer CHANGED_OWNER = 0x080; | ||
16 | integer CHANGED_REGION = 0x100; | ||
17 | integer CHANGED_TELEPORT = 0x200; | ||
18 | integer CHANGED_REGION_START = 0x400; | ||
19 | integer CHANGED_MEDIA = 0x800; | ||
20 | |||
21 | integer DEBUG_CHANNEL = 2147483647; | ||
22 | integer PUBLIC_CHANNEL = 0; | ||
23 | |||
24 | integer INVENTORY_ALL = -1; | ||
25 | integer INVENTORY_NONE = -1; | ||
26 | integer INVENTORY_TEXTURE = 0; | ||
27 | integer INVENTORY_SOUND = 1; | ||
28 | integer INVENTORY_LANDMARK = 3; | ||
29 | integer INVENTORY_CLOTHING = 5; | ||
30 | integer INVENTORY_OBJECT = 6; | ||
31 | integer INVENTORY_NOTECARD = 7; | ||
32 | integer INVENTORY_SCRIPT = 10; | ||
33 | integer INVENTORY_BODYPART = 13; | ||
34 | integer INVENTORY_ANIMATION = 20; | ||
35 | integer INVENTORY_GESTURE = 21; | ||
36 | |||
37 | integer ALL_SIDES = -1; | ||
38 | integer LINK_SET = -1; | ||
39 | integer LINK_ROOT = 1; | ||
40 | integer LINK_ALL_OTHERS = -2; | ||
41 | integer LINK_ALL_CHILDREN = -3; | ||
42 | integer LINK_THIS = -4; | ||
43 | |||
44 | integer PERM_ALL = 0x7FFFFFFF; | ||
45 | integer PERM_COPY = 0x00008000; | ||
46 | integer PERM_MODIFY = 0x00004000; | ||
47 | integer PERM_MOVE = 0x00080000; | ||
48 | integer PERM_TRANSFER = 0x00002000; | ||
49 | integer MASK_BASE = 0; | ||
50 | integer MASK_OWNER = 1; | ||
51 | integer MASK_GROUP = 2; | ||
52 | integer MASK_EVERYONE = 3; | ||
53 | integer MASK_NEXT = 4; | ||
54 | integer PERMISSION_DEBIT = 0x0002; | ||
55 | integer PERMISSION_TAKE_CONTROLS = 0x0004; | ||
56 | integer PERMISSION_TRIGGER_ANIMATION = 0x0010; | ||
57 | integer PERMISSION_ATTACH = 0x0020; | ||
58 | integer PERMISSION_CHANGE_LINKS = 0x0080; | ||
59 | integer PERMISSION_TRACK_CAMERA = 0x0400; | ||
60 | integer PERMISSION_CONTRAL_CAMERA = 0x0800; | ||
61 | |||
62 | integer AGENT = 0x01; | ||
63 | integer ACTIVE = 0x02; | ||
64 | integer PASSIVE = 0x04; | ||
65 | integer SCRIPTED = 0x08; | ||
66 | |||
67 | integer OBJECT_UNKNOWN_DETAIL = -1; | ||
68 | |||
69 | integer PRIM_BUMP_SHINY = 19; | ||
70 | integer PRIM_COLOR = 18; | ||
71 | integer PRIM_FLEXIBLE = 21; | ||
72 | integer PRIM_FULLBRIGHT = 20; | ||
73 | integer PRIM_GLOW = 25; | ||
74 | integer PRIM_MATERIAL = 2; | ||
75 | integer PRIM_PHANTOM = 5; | ||
76 | integer PRIM_PHYSICS = 3; | ||
77 | integer PRIM_POINT_LIGHT = 23; | ||
78 | integer PRIM_POSITION = 6; | ||
79 | integer PRIM_ROTATION = 8; | ||
80 | integer PRIM_SIZE = 7; | ||
81 | integer PRIM_TEMP_ON_REZ = 4; | ||
82 | integer PRIM_TYPE = 9; | ||
83 | integer PRIM_TYPE_OLD = 1; | ||
84 | integer PRIM_TEXGEN = 22; | ||
85 | integer PRIM_TEXTURE = 17; | ||
86 | integer PRIM_TEXT = 26; | ||
87 | |||
88 | integer PRIM_BUMP_NONE = 0; | ||
89 | integer PRIM_BUMP_BRIGHT = 1; | ||
90 | integer PRIM_BUMP_DARK = 2; | ||
91 | integer PRIM_BUMP_WOOD = 3; | ||
92 | integer PRIM_BUMP_BARK = 4; | ||
93 | integer PRIM_BUMP_BRICKS = 5; | ||
94 | integer PRIM_BUMP_CHECKER = 6; | ||
95 | integer PRIM_BUMP_CONCRETE = 7; | ||
96 | integer PRIM_BUMP_TILE = 8; | ||
97 | integer PRIM_BUMP_STONE = 9; | ||
98 | integer PRIM_BUMP_DISKS = 10; | ||
99 | integer PRIM_BUMP_GRAVEL = 11; | ||
100 | integer PRIM_BUMP_BLOBS = 12; | ||
101 | integer PRIM_BUMP_SIDING = 13; | ||
102 | integer PRIM_BUMP_LARGETILE = 14; | ||
103 | integer PRIM_BUMP_STUCCO = 15; | ||
104 | integer PRIM_BUMP_SUCTION = 16; | ||
105 | integer PRIM_BUMP_WEAVE = 17; | ||
106 | |||
107 | integer PRIM_HOLE_DEFAULT = 0; | ||
108 | integer PRIM_HOLE_CIRCLE = 16; | ||
109 | integer PRIM_HOLE_SQUARE = 32; | ||
110 | integer PRIM_HOLE_TRIANGLE = 48; | ||
111 | |||
112 | integer PRIM_MATERIAL_STONE = 0; | ||
113 | integer PRIM_MATERIAL_METAL = 1; | ||
114 | integer PRIM_MATERIAL_GLASS = 2; | ||
115 | integer PRIM_MATERIAL_WOOD = 3; | ||
116 | integer PRIM_MATERIAL_FLESH = 4; | ||
117 | integer PRIM_MATERIAL_PLASTIC = 5; | ||
118 | integer PRIM_MATERIAL_RUBBER = 6; | ||
119 | integer PRIM_MATERIAL_LIGHT = 7; | ||
120 | |||
121 | integer PRIM_SCULPT_TYPE_SPHERE = 1; | ||
122 | integer PRIM_SCULPT_TYPE_TORUS = 2; | ||
123 | integer PRIM_SCULPT_TYPE_PLANE = 3; | ||
124 | integer PRIM_SCULPT_TYPE_CYLINDER = 4; | ||
125 | integer PRIM_SCULPT_TYPE_MESH = 5; | ||
126 | integer PRIM_SCULPT_TYPE_MIMESH = 6; | ||
127 | |||
128 | integer PRIM_SHINY_NONE = 0; | ||
129 | integer PRIM_SHINY_LOW = 1; | ||
130 | integer PRIM_SHINY_MEDIUM = 2; | ||
131 | integer PRIM_SHINY_HIGH = 3; | ||
132 | |||
133 | integer PRIM_TYPE_BOX = 0; | ||
134 | integer PRIM_TYPE_CYLINDER = 1; | ||
135 | integer PRIM_TYPE_PRISM = 2; | ||
136 | integer PRIM_TYPE_SPHERE = 3; | ||
137 | integer PRIM_TYPE_TORUS = 4; | ||
138 | integer PRIM_TYPE_TUBE = 5; | ||
139 | integer PRIM_TYPE_RING = 6; | ||
140 | integer PRIM_TYPE_SCULPT = 7; | ||
141 | |||
142 | integer STRING_TRIM = 3; | ||
143 | integer STRING_TRIM_HEAD = 1; | ||
144 | integer STRING_TRIM_TAIL = 2; | ||
145 | |||
146 | integer TRUE = 1; | ||
147 | integer FALSE = 0; | ||
148 | |||
149 | integer TYPE_INTEGER = 1; | ||
150 | integer TYPE_FLOAT = 2; | ||
151 | integer TYPE_STRING = 3; | ||
152 | integer TYPE_KEY = 4; | ||
153 | integer TYPE_VECTOR = 5; | ||
154 | integer TYPE_ROTATION = 6; | ||
155 | integer TYPE_INVALID = 0; | ||
156 | |||
157 | string NULL_KEY = "00000000-0000-0000-0000-000000000000"; | ||
158 | string EOF = "\n\n\n"; | ||
159 | |||
160 | rotation ZERO_ROTATION = <0.0, 0.0, 0.0, 1.0>; | ||
161 | vector ZERO_VECTOR = <0.0, 0.0, 0.0>; | ||
162 | |||
163 | // Temporary dummy variables to got vector and rotation thingies to work for now. | ||
164 | |||
165 | float s = 1.0; | ||
166 | float x = 0.0; | ||
167 | float y = 0.0; | ||
168 | float z = 0.0; | ||
169 | |||
170 | // Functions. | ||
171 | |||
172 | float llPow(float number, float places){} | ||
173 | float llFrand(float max){} | ||
174 | integer llRound(float number){} | ||
175 | |||
176 | key llDetectedKey(integer index){} | ||
177 | key llDetectedGroup(integer index){} | ||
178 | integer llSameGroup(key avatar){} | ||
179 | |||
180 | float llGetAlpha(integer side){} | ||
181 | llSetAlpha(float alpha, integer side){} | ||
182 | llSetColor(vector colour, integer side){} | ||
183 | llSetPrimitiveParams(list params){} | ||
184 | llSetScale(vector scale){} | ||
185 | llSetSitText(string text){} | ||
186 | llSetText(string text, vector colour, float alpha){} | ||
187 | llSitTarget(vector pos, rotation rot){} | ||
188 | |||
189 | integer llGetLinkNumber(){} | ||
190 | string llGetObjectDesc(){} | ||
191 | llSetObjectDesc(string text){} | ||
192 | string llGetObjectName(){} | ||
193 | llSetObjectName(string text){} | ||
194 | |||
195 | string llGetInventoryName(integer type, integer index){} | ||
196 | integer llGetInventoryNumber(integer type){} | ||
197 | integer llGetInventoryType(string name){} | ||
198 | key llGetNotecardLine(string name, integer index){} | ||
199 | |||
200 | llDie(){} | ||
201 | integer llGetFreeMemory(){} | ||
202 | string llGetScriptName(){} | ||
203 | float llGetTime(){} | ||
204 | llResetOtherScript(string name){} | ||
205 | llResetScript(){} | ||
206 | llResetTime(){} | ||
207 | llSetScriptState(string name, integer running){} | ||
208 | llSetTimerEvent(float seconds){} | ||
209 | llSleep(float seconds){} | ||
210 | |||
211 | llPlaySound(string name, float volume){} | ||
212 | llRezObject(string name, vector position, vector velocity, rotation rot, integer channel){} | ||
213 | llRezAtRoot(string name, vector position, vector velocity, rotation rot, integer channel){} | ||
214 | |||
215 | vector llGetPos(){} | ||
216 | llSetPos(vector pos){} | ||
217 | rotation llGetRot(){} | ||
218 | llSetRot(rotation rot){} | ||
219 | |||
220 | rotation llEuler2Rot(vector vec){} | ||
221 | vector llRot2Euler(rotation rot){} | ||
222 | |||
223 | string llGetSubString(string text, integer start, integer end){} | ||
224 | integer llStringLength(string text){} | ||
225 | string llStringTrim(string text, integer type){} | ||
226 | integer llSubStringIndex(string text, string sub){} | ||
227 | list llParseString2List(string in, list l, list l1){} | ||
228 | list llParseStringKeepNulls(string in, list l, list l1){} | ||
229 | |||
230 | list llCSV2List(string text){} | ||
231 | list llDeleteSubList(list l, integer start, integer end){} | ||
232 | string llDumpList2String(list l, string separator){} | ||
233 | string llList2CSV(list l){} | ||
234 | float llList2Float(list l, integer index){} | ||
235 | integer llList2Integer(list l, integer index){} | ||
236 | key llList2Key(list l, integer index){} | ||
237 | list llList2List(list l, integer start, integer end){} | ||
238 | string llList2String(list l, integer index){} | ||
239 | rotation llList2Rotation(list l, integer index){} | ||
240 | vector llList2Vector(list l, integer index){} | ||
241 | integer llListFindList(list l, list l1){} | ||
242 | list llListInsertList(list l, list l1, integer index){} | ||
243 | integer llGetListLength(list l){} | ||
244 | list llListReplaceList(list l, list part, integer start, integer end){} | ||
245 | list llListSort(list l, integer stride, integer ascending){} | ||
246 | |||
247 | key llAvatarOnSitTarget(){} | ||
248 | list llGetAnimationList(key id){} | ||
249 | key llGetKey(){} | ||
250 | key llGetOwner(){} | ||
251 | integer llGetPermissions(){} | ||
252 | key llGetPermissionsKey(){} | ||
253 | string llKey2Name(key avatar){} | ||
254 | llRequestPermissions(key avatar, integer perms){} | ||
255 | llStartAnimation(string anim){} | ||
256 | llStopAnimation(string anim){} | ||
257 | llUnSit(key avatar){} | ||
258 | |||
259 | |||
260 | llDialog(key avatar, string caption, list arseBackwardsMenu, integer channel){} | ||
261 | integer llListen(integer channel, string name, key id, string msg){} | ||
262 | llListenRemove(integer handle){} | ||
263 | llOwnerSay(string text){} | ||
264 | llSay(integer channel, string text){} | ||
265 | llShout(integer channel, string text){} | ||
266 | llWhisper(integer channel, string text){} | ||
267 | |||
268 | llMessageLinked(integer link, integer num, string text, key aKey){} | ||
269 | |||