· 6 years ago · Mar 10, 2020, 02:44 AM
1GOS API
2MenuElement - Class
3 MenuElement({}) -- initial call; returns instance
4 possible properties of the input table:
5 - id = "string", can be omitted but then it will not save
6 - name = "string"
7 - type = MENU|PARAM|SPACE, for PARAM type can be omitted
8 - leftIcon = "string" [URL!], -> icon displayed on the left, 100% menu height
9 - rightIcon = "string" [URL!] -> automatically converts param to boolean, 50% menu height
10 - icon = "string" [URL!] -> icon displayed on the right, e.g. sub menu, 100% menu height
11 - value =
12 -> true|false, creates boolean param
13 -> number, creates slider param
14 -> + min = "number" + max = "number" [+ step = "number"] [+ identifier = "string"]
15 or
16 -> drop = {"string"[, "string", ...]}
17 -> table {"number", "number"}, creates min/max slider param
18 -> + min = "number" + max = "number" [+ step = "number"]
19 - color = "color", creates color param
20 -> Draw.Color(integer)
21 or
22 -> Draw.Color(hex)
23 or
24 -> Draw.Color(alpha, red, green, blue)
25 or
26 -> Draw.Color(hue, saturation, lightness)
27 - key = "number", creates key param
28 - toggle = "boolean", defaults to false, used to make a toggle key param
29 - callback = "function"
30 -> gets called on param change with changed value as input
31 - onKeyChange = "function"
32 -> gets called on key change with changed key as input
33 - onhover = "function"
34 -> gets called on param hover with the param as input
35 - onclick = "function"
36 -> gets called on param click with the param as input
37 - tooltip = "string"
38 -> gets displayed on hover
39 instance:MenuElement({})
40 creates submenu
41 instance:Value([newVal])
42 -> if called without newVal it returns the current value
43 -> if called with newVal it'll set the current value to newVal and return it
44 instance:Sprite(which[, url])
45 -> which = "string"; "leftIcon"|"rightIcon"|"icon"
46 -> if called without url it returns the current sprite
47 -> if called with url it'll set the current sprite to that url
48 instance:Hide([bool])
49 -> if called without bool it'll toggle the hide property between true|false and return it
50 -> if called with bool it'll set the hide property to that value and return it
51 instance:Remove()
52 -> this will permanently remove the MenuElement
53
54 Example:
55 local menu = MenuElement({id = "myMenu", name = "This is my Menu", type = MENU})
56 menu:MenuElement({id = "bool", name = "My boolean Value", value = true})
57 menu:MenuElement({id = "slide", name = "My slider", value = 0.7, min = 0, max = 1, step = 0.1})
58 menu:MenuElement({id = "space", name = "This will get hidden on mouse click", type = SPACE, onclick = function() menu.space:Hide() end})
59 Callback.Add("Tick", function()
60 PrintChat("My bool: "..tostring(menu.bool:Value()).."; My slider: "..menu.slide:Value()..";")
61 end)
62
63
64
65Vector - Class
66 Vector(...) -- initial call; returns instance
67 overloads:
68 () => 'nullvector' => (0, 0, 0)
69 ({x = 100, y = 100}) => (xy-table) => (100, 100)
70 ({x = 100, y = 0, z = 100}) => (xyz-table) => (100, 0, 100)
71 (100, 0, 100) => (number, number, number) => (100, 0, 100)
72 ({x = 0, y = 50, z = 75}, {x = 100, y = 100, z = 100}) => (startVec, endVec) => (100, 50, 25)
73 properties:
74 .x -- the x value
75 .y -- the y value
76 .z -- the z value
77 .onScreen -- for 2D vectors
78 functions:
79 :To2D() -- returns screenpos from Vector3 (alias ToScreen)
80 :ToMM() -- returns minimap position from Vector3
81 :Clone() -- returns a new vector
82 :Unpack() -- returns x, y, z
83 :DistanceTo(Vector) -- returns distance to another vector or, if ommited, myHero
84 :Len() -- returns length
85 :Len2() -- returns squared length
86 :Normalize() -- normalizes a vector
87 :Normalized() -- creates a new vector, normalizes it and returns it
88 :Center(Vector) -- center between 2 vectors
89 :CrossProduct(Vector) -- cross product of 2 vectors (alias: CrossP)
90 :DotProduct(Vector) -- dot product of 2 vectors (alias: DotP)
91 :ProjectOn(Vector) -- projects a vector on a vector
92 :MirrorOn(Vector) -- mirrors a vector on a vector
93 :Sin(Vector) -- calculates sin of 2 vector
94 :Cos(Vector) -- calculates cos of 2 vector
95 :Angle(Vector) -- calculates angle between 2 vectors
96 :AffineArea(Vector) -- calculates area between 2 vectors
97 :TriangleArea(Vector) -- calculates triangular area between 2 vectors
98 :RotateX(phi) -- rotates vector by phi around x axis
99 :RotateY(phi) -- rotates vector by phi around y axis
100 :RotateZ(phi) -- rotates vector by phi around z axis
101 :Rotate(phiX, phiY, phiZ) -- rotates vector
102 :Rotated(phiX, phiY, phiZ) -- creates a new vector, rotates it and returns it
103 :Polar() -- returns polar value
104 :AngleBetween(Vector, Vector) -- returns the angle formed from a vector to both input vectors
105 :Compare(Vector) -- compares both vectors, returns difference
106 :Perpendicular() -- creates a new vector that is rotated 90° right
107 :Perpendicular2() -- creates a new vector that is rotated 90° left
108 :Extend(Vector, distance) -- extends a vector towards a vector
109 :Extended(Vector, distance) -- creates a new vector, extends it and returns it
110 :Shorten(Vector, distance) -- shortens a vector towards a vector
111 :Shortened(Vector, distance) -- creates a new vector, shortens it and returns it
112 :Lerp(Vector, delta) -- creates a new vector, lerps it towards vector by delta
113
114
115
116Sprite - Class
117 Sprite(path)
118 overloads:
119 Sprite(path, scale)
120 Sprite(path, scaleX, scaleY)
121 properties (READ-ONLY):
122 .x -- the x value
123 .y -- the y value
124 .pos -- Vector2
125 .path -- file path
126 .width -- the width
127 .height -- the height
128 .scale -- the scale
129 .color -- the color
130 functions:
131 :Draw() -- draws the sprite at .pos
132 :Draw(Vector2) -- draws the sprite at Vector2
133 :Draw(x, y) -- draws the sprite at x y
134 :Draw({x, y, w, h}, Vector2) -- draws a rectangle of the sprite at Vector2
135 :Draw({x, y, w, h}, x, y) -- draws a rectangle of the sprite at x y
136 :SetScale(scale) -- sets a sprite's scale
137 :SetScale(scaleX, scaleY) -- sets a sprite's scale
138 :SetPos(Vector2) -- sets a sprite's pos
139 :SetPos(x, y) -- sets a sprite's pos
140 :SetColor(Color) -- sets a sprite's color
141
142GameObject
143 -- not callable by user
144 properties:
145 .networkID
146 .handle -- use for missile owner/target check
147 .chnd --use for camp handle
148 .buffCount
149 .isMe
150 .isAlly
151 .isEnemy
152 .team
153 .owner
154 .targetID --Turret Target
155 .type
156 .name
157 .charName
158 .health
159 .maxHealth
160 .mana
161 .maxMana
162 .hudAmmo
163 .hudMaxAmmo --used for Jhin/Graves bullets or Annie stun or even Kled mount health; use with caution on other champs because it's not always 0 by default
164 .shieldAD
165 .shieldAP
166 .cdr
167 .armorPen
168 .armorPenPercent
169 .bonusArmorPenPercent
170 .magicPen
171 .magicPenPercent
172 .baseDamage
173 .bonusDamage
174 .totalDamage
175 .ap
176 .lifeSteal
177 .spellVamp
178 .attackSpeed
179 .critChance
180 .armor
181 .bonusArmor
182 .magicResist
183 .bonusMagicResist
184 .hpRegen
185 .mpRegen
186 .ms
187 .range
188 .boundingRadius
189 .gold
190 .totalGold
191 .dead
192 .visible
193 .isImmortal --works for zhonya and kayle ulti ++
194 .isTargetable
195 .isTargetableToTeam --works for turrets
196 .distance
197 .pos
198 .x
199 .y
200 .z
201 .posTo
202 .x
203 .y
204 .z
205 .hpBar
206 .x
207 .y
208 .onScreen
209 .pos2D
210 .x
211 .y
212 .onScreen
213 .toScreen
214 .x
215 .y
216 .onScreen
217 .posMM
218 .x
219 .y
220 .dir
221 .x
222 .y
223 .z
224 .isCampUp -- for jungle camps only
225 .valid -- for units only
226 .attackData -- for units only
227 .state -- STATE_UNKNOWN, STATE_ATTACK, STATE_WINDUP, STATE_WINDDOWN
228 .windUpTime
229 .windDownTime
230 .animationTime
231 .endTime
232 .castFrame
233 .projectileSpeed
234 .target -- GameObject handle
235 .attackDelayOffsetPercent -- used for calculating animationTime
236 .attackDelayCastOffsetPercent -- used for calculating windUpTime
237 .levelData -- for heroes only
238 .exp
239 .lvl
240 .lvlPts
241 .activeSpell
242 .valid --always use this to check if it's casting
243 .level
244 .name
245 .startPos -- Vector
246 .placementPos -- Vector
247 .target -- GameObject handle
248 .windup
249 .animation
250 .range
251 .mana
252 .width
253 .speed
254 .coneAngle
255 .coneDistance
256 .acceleration
257 .castFrame
258 .maxSpeed
259 .minSpeed
260 .spellWasCast
261 .isAutoAttack
262 .isCharging
263 .isChanneling
264 .startTime
265 .castEndTime
266 .endTime
267 .isStopped
268 .activeSpellSlot --use this to determine which spell slot was activated for ".activeSpell"
269 .isChanneling --use this to determine if ".activeSpell" is actually a spell, otherwise it's autoattack
270 .missileData -- for missiles only
271 .name -- string
272 .owner -- GameObject handle
273 .target -- GameObject handle
274 .startPos -- Vector
275 .endPos -- Vector
276 .placementPos -- Vector
277 .range
278 .delay
279 .speed
280 .width
281 .manaCost
282 .bonusDamagePercent -- for minions only
283 .flatDamageReduction -- for minions only
284 .pathing --returns waypoints for unit
285 .hasMovePath
286 .pathIndex
287 .startPos
288 .x
289 .y
290 .z
291 .endPos
292 .x
293 .y
294 .z
295 .pathCount
296 functions: -- for units only
297 :GetSpellData(iSlot)
298 .name
299 .level
300 .castTime -- time the spell was casted last
301 .cd
302 .currentCd
303 .ammo
304 .ammoTime
305 .ammoCd
306 .ammoCurrentCd
307 .toggleState
308 .range
309 .mana
310 .width
311 .speed
312 .targetingType
313 .coneAngle
314 .coneDistance
315 .acceleration
316 .castFrame
317 .maxSpeed
318 .minSpeed
319 :GetItemData(index)
320 .itemID
321 .stacks
322 .ammo
323 :GetBuff(index)
324 .type
325 .name
326 .startTime
327 .expireTime
328 .duration
329 .stacks
330 .count
331 .sourcenID
332 .sourceName
333 :GetPrediction(speed,delay) --Vector
334 .x
335 .y
336 .z
337 :GetCollision(width,speed,delay)
338 number --Collision Count
339 :IsValidTarget(range,team check,source or pos) -- returns a boolean
340 :GetPath(index) --returns a vector
341 .x
342 .y
343 .z
344
345
346
347
348Draw API: {
349 Circle = Draws a 3D Circle; Input: (x, y, z)
350 Circle = Draws a 3D Circle; Input: (x, y, z, Color)
351 Circle = Draws a 3D Circle; Input: (x, y, z, radius)
352 Circle = Draws a 3D Circle; Input: (x, y, z, radius, Color)
353 Circle = Draws a 3D Circle; Input: (x, y, z, radius, width)
354 Circle = Draws a 3D Circle; Input: (x, y, z, radius, width, Color)
355 Circle = Draws a 3D Circle; Input: (Vector3)
356 Circle = Draws a 3D Circle; Input: (Vector3, Color)
357 Circle = Draws a 3D Circle; Input: (Vector3, radius)
358 Circle = Draws a 3D Circle; Input: (Vector3, radius, Color)
359 Circle = Draws a 3D Circle; Input: (Vector3, radius, width)
360 Circle = Draws a 3D Circle; Input: (Vector3, radius, width, Color)
361 CircleMinimap = Draws a 2D Circle; Input: (x, y, z)
362 CircleMinimap = Draws a 2D Circle; Input: (x, y, z, Color)
363 CircleMinimap = Draws a 2D Circle; Input: (x, y, z, radius)
364 CircleMinimap = Draws a 2D Circle; Input: (x, y, z, radius, Color)
365 CircleMinimap = Draws a 2D Circle; Input: (x, y, z, radius, width)
366 CircleMinimap = Draws a 2D Circle; Input: (x, y, z, radius, width, Color)
367 CircleMinimap = Draws a 2D Circle; Input: (Vector3)
368 CircleMinimap = Draws a 2D Circle; Input: (Vector3, Color)
369 CircleMinimap = Draws a 2D Circle; Input: (Vector3, radius)
370 CircleMinimap = Draws a 2D Circle; Input: (Vector3, radius, Color)
371 CircleMinimap = Draws a 2D Circle; Input: (Vector3, radius, width)
372 CircleMinimap = Draws a 2D Circle; Input: (Vector3, radius, width, Color)
373 Rect = Draws a 2D Rectangle; Input: (x, y, width, height)
374 Rect = Draws a 2D Rectangle; Input: (x, y, width, height, Color)
375 Rect = Draws a 2D Rectangle; Input: (Vector2, width, height)
376 Rect = Draws a 2D Rectangle; Input: (Vector2, width, height, Color)
377 Line = Draws a 2D Line; Input: (x1, y1, x2, y2)
378 Line = Draws a 2D Line; Input: (x1, y1, x2, y2, Color)
379 Line = Draws a 2D Line; Input: (x1, y1, x2, y2, width)
380 Line = Draws a 2D Line; Input: (x1, y1, x2, y2, width, Color)
381 Line = Draws a 2D Line; Input: (Vector2, x2, y2)
382 Line = Draws a 2D Line; Input: (Vector2, x2, y2, Color)
383 Line = Draws a 2D Line; Input: (Vector2, x2, y2, width)
384 Line = Draws a 2D Line; Input: (Vector2, x2, y2, width, Color)
385 Line = Draws a 2D Line; Input: (x1, y1, Vector2)
386 Line = Draws a 2D Line; Input: (x1, y1, Vector2, Color)
387 Line = Draws a 2D Line; Input: (x1, y1, Vector2, width)
388 Line = Draws a 2D Line; Input: (x1, y1, Vector2, width, Color)
389 Line = Draws a 2D Line; Input: (Vector2, Vector2)
390 Line = Draws a 2D Line; Input: (Vector2, Vector2, Color)
391 Line = Draws a 2D Line; Input: (Vector2, Vector2, width)
392 Line = Draws a 2D Line; Input: (Vector2, Vector2, width, Color)
393 Color = Creates a drawable Color; Input: (a, r, g, b); Returns Color
394 Color = Creates a drawable Color; Input: (hex); Returns Color
395 Color = Creates a drawable Color; Input: (unsigned); Returns Color
396 Color = Creates a drawable Color; Input: (h, s, l); Returns Color
397 Color = Creates a drawable Color; Input: (); Returns Color
398 Default Color is White.
399 Text = Draws a 2D Text; Input: (text, x, y)
400 Text = Draws a 2D Text; Input: (text, size, x, y)
401 Text = Draws a 2D Text; Input: (text, size, x, y, Color)
402 Text = Draws a 2D Text; Input: (text, size, x, y, Color, Font)
403 Text = Draws a 2D Text; Input: (text, Vector2)
404 Text = Draws a 2D Text; Input: (text, size, Vector2)
405 Text = Draws a 2D Text; Input: (text, size, Vector2, Color)
406 Text = Draws a 2D Text; Input: (text, size, Vector2, Color, Font)
407 Font = Creates a drawable Font; Input: (path, fontName)
408 FontRect = Gets a Font Rectangle; Input: (text, fontSize); Return {width, height}
409 FontRect = Gets a Font Rectangle; Input: (text, fontSize, Font); Return {width, height}
410}
411
412
413
414Control API: {
415 LeftClick = Executes a left mouse click; Input: (XYTable | x, y)
416 RightClick = Executes a right mouse click; Input: (XYTable | x, y)
417 CastSpell = Executes a keystroke; Input: (char | byte)
418 CastSpell = Executes a keystroke; Input: (char | byte, GameObject)
419 CastSpell = Executes a keystroke and moves mouse; Input: (char | byte, x, y) --screen position
420 CastSpell = Executes a keystroke and moves mouse; Input: (char | byte, x, y, z)
421 CastSpell = Executes a keystroke and moves mouse; Input: (char | byte, Vector3)
422 Move = Sends a move command towards mousePos; Input: none
423 Move = Sends a move command; Input: (x, y) --screen position
424 Move = Sends a move command; Input: (x, y, z)
425 Move = Sends a move command; Input: (Vector3)
426 Attack = Sends an attack command; Input: (GameObject)
427 IsKeyDown = Check for a key being held down; Input: none; Return bool
428 SetCursorPos = Sets the cursor position; Input: (Object | Vector3 | Vector2 | x, y) Return: bool
429 KeyDown = Holds down a keystroke; Input: (char | byte) Return: bool
430 KeyUp = Releases up a keystroke; Input: (char | byte) Return: bool
431 mouse_event = Sends a mouse click (down or up, depending on flag); Input: (byte) Return: bool
432}
433
434
435
436Game API: {
437 MyHero = Input none; Returns myHero
438 Resolution = Input none; Returns Resolution as Vector
439 FPS = Input none; Returns the total FPS
440 IsOnTop = Input none; Return true/false if Game is on top
441 IsChatOpen = Input none; Return true/false if chat is open
442 Timer = Input none; Return the Game Timer
443 mapID = The current map ID
444 HeroCount = Input none; Return the total Hero Count
445 Hero = Input (index); Return the Hero at index
446 ObjectCount = Input none; Return the total Object Count
447 Object = Input (index); Return the Object at index
448 HeroCount = Input none; Return the total Hero Count
449 Hero = Input (index); Return the Hero at index
450 CampCount = Input none; Return the total Camp Count
451 Camp = Input (index); Return the Camp at index
452 TurretCount = Input none; Return the total Turret Count
453 Turret = Input (index); Return the Turret at index
454 MissileCount = Input none; Return the total Object Count
455 Missile = Input (index); Return the Object at index
456 ParticleCount = Input none; Return the total Object Count
457 Particle = Input (index); Return the Object at index
458 MinionCount = Input none; Return the total Minion Count
459 Minion = Input (index); Return the Minion at index
460 WardCount = Input none; Return the total Wards Count
461 Ward = Input (index); Return the Wards at index
462 ObjectCount = Input none; Return the total Object Count
463 Object = Input (index); Return the Object at index
464 GetObjectByNetID = Input (networkID); returns the object with the networkID requested
465 Latency = Input none; Returns the game latency (ping)
466 CanUseSpell = Input (spell index); Returns the state of a specific spell
467 mousePos = alias to the global mouse pos; Return Vector3
468 cursorPos = alias to the global cursor pos; Return Vector2
469}
470
471
472
473Callback API: {
474 Add = Adds a new Callback; Input: (iType, function); Return: callbackID
475 Del = Deletes a callback, Input: (iType, callbackID)
476}
477
478iTypes: {
479 "Load",
480 "UnLoad",
481 "GameEnd",
482 "Tick",
483 "Draw",
484 "WndMsg", -- (msg, wParam)
485 "ProcessRecall" -- (unit, proc)
486}
487
488
489
490Global Constants:
491 SCRIPT_PATH
492 COMMON_PATH
493 SPRITE_PATH
494 SOUNDS_PATH
495 FONTS_PATH
496
497 READY
498 NOTAVAILABLE
499 READYNOCAST
500 NOTLEARNED
501 ONCOOLDOWN
502 NOMANA
503 NOMANAONCOOLDOWN
504
505 WM_MOUSEHWHEEL
506 WM_MBUTTONUP
507 WM_MBUTTONDOWN
508 WM_RBUTTONUP
509 WM_RBUTTONDOWN
510 WM_LBUTTONUP
511 WM_LBUTTONDOWN
512 KEY_UP
513 KEY_DOWN
514
515 CRYSTAL_SCAR
516 TWISTED_TREELINE
517 SUMMONERS_RIFT
518 HOWLING_ABYSS
519
520 STATE_UNKNOWN
521 STATE_ATTACK
522 STATE_WINDUP
523 STATE_WINDDOWN
524
525 _Q
526 _W
527 _E
528 _R
529 ITEM_1
530 ITEM_2
531 ITEM_3
532 ITEM_4
533 ITEM_5
534 ITEM_6
535 ITEM_7 --(trinket)
536 SUMMONER_1
537 SUMMONER_2
538
539 HK_Q
540 HK_W
541 HK_E
542 HK_R
543 HK_ITEM_1
544 HK_ITEM_2
545 HK_ITEM_3
546 HK_ITEM_4
547 HK_ITEM_5
548 HK_ITEM_6
549 HK_ITEM_7 --(trinket)
550 HK_SUMMONER_1
551 HK_SUMMONER_2
552 HK_TCO -- Target Champions Only
553 HK_LUS -- Level Up Spell Hotkey
554 HK_MENU -- Hotkey for the LUA Menu
555
556 MOUSEEVENTF_LEFTDOWN --used by mouse_event
557 MOUSEEVENTF_LEFTUP
558 MOUSEEVENTF_RIGHTDOWN
559 MOUSEEVENTF_RIGHTUP
560
561 Obj_AI_SpawnPoint
562 Obj_AI_Camp
563 Obj_AI_Barracks
564 Obj_AI_Hero
565 Obj_AI_Minion
566 Obj_AI_Turret
567 Obj_AI_LineMissle
568 Obj_AI_Shop
569 Obj_AI_Nexus
570
571 cursorPos (Vector2)
572 mousePos (Vector3)
573
574 myHero (GameObject)
575
576
577Global Functions:
578 GetTickCount()
579 GetImageInfoFromFile(path)
580 PrintChat(message) -- prints one string
581 print(...) -- prints everything
582 DumpDocumentation("api.lua") -- writes