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