Advertisement
Guest User

Untitled

a guest
Oct 17th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.96 KB | None | 0 0
  1. GameSense API for Lua
  2. cvar.set_string
  3. cvar.get_string
  4. cvar.set_float
  5. cvar.set_raw_float
  6. cvar.get_float
  7. cvar.set_int
  8. cvar.set_raw_int
  9. cvar.get_int
  10. cvar.invoke_callback
  11. globals.realtime
  12. globals.curtime
  13. globals.frametime
  14. globals.absoluteframetime
  15. globals.maxplayers
  16. globals.tickcount
  17. globals.tickinterval
  18. globals.framecount
  19. globals.mapname
  20. globals.lastoutgoingcommand
  21. entity.get_local_player
  22. entity.get_all
  23. entity.get_players
  24. entity.get_game_rules
  25. entity.get_player_resource
  26. entity.get_classname
  27. entity.set_prop
  28. entity.get_prop
  29. entity.is_enemy
  30. entity.is_alive
  31. entity.is_dormant
  32. entity.get_player_name
  33. entity.get_player_weapon
  34. entity.hitbox_position
  35. entity.get_steam64
  36. entity.get_bounding_box
  37. client.set_event_callback
  38. client.log
  39. client.color_log
  40. client.exec
  41. client.userid_to_entindex
  42. client.draw_debug_text
  43. client.draw_hitboxes
  44. client.random_int
  45. client.random_float
  46. client.screen_size
  47. client.visible
  48. client.trace_line
  49. client.trace_bullet
  50. client.scale_damage
  51. client.delay_call
  52. client.latency
  53. client.camera_angles
  54. client.camera_angles
  55. client.timestamp
  56. client.eye_position
  57. client.set_clan_tag
  58. client.system_time
  59. client.reload_active_scripts
  60. ui.new_checkbox
  61. ui.new_slider
  62. ui.new_combobox
  63. ui.new_multiselect
  64. ui.new_hotkey
  65. ui.new_button
  66. ui.new_color_picker
  67. ui.new_textbox
  68. ui.reference
  69. ui.set
  70. ui.get
  71. ui.set_callback
  72. ui.set_visible
  73. ui.is_menu_open
  74. ui.mouse_position
  75. renderer.text
  76. renderer.measure_text
  77. renderer.rectangle
  78. renderer.line
  79. renderer.gradient
  80. renderer.circle
  81. renderer.circle_outline
  82. renderer.triangle
  83. renderer.world_to_screen
  84. renderer.indicator
  85. renderer.texture
  86. renderer.load_svg
  87. cvar.set_string
  88. syntax: cvar.set_string(value)
  89.  
  90. value - String value
  91.  
  92. Back to TOC
  93.  
  94.  
  95. cvar.get_string
  96. syntax: cvar.get_string()
  97.  
  98. Returns nil on failure.
  99.  
  100. Back to TOC
  101.  
  102.  
  103. cvar.set_float
  104. syntax: cvar.set_float(value)
  105.  
  106. value - Float value
  107.  
  108. cvar.cl_interp_ratio:set_float(1)
  109.  
  110. Back to TOC
  111.  
  112.  
  113. cvar.set_raw_float
  114. syntax: cvar.set_raw_float(value)
  115.  
  116. value - Float value
  117.  
  118. This sets the float value without changing the integer and string values.
  119.  
  120. Back to TOC
  121.  
  122.  
  123. cvar.get_float
  124. syntax: cvar.get_float()
  125.  
  126. Returns nil if called on a ConCommand.
  127.  
  128. Back to TOC
  129.  
  130.  
  131. cvar.set_int
  132. syntax: cvar.set_int(value)
  133.  
  134. value - Integer value
  135.  
  136. Back to TOC
  137.  
  138.  
  139. cvar.set_raw_int
  140. syntax: cvar.set_raw_int(value)
  141.  
  142. value - Integer value
  143.  
  144. This sets the integer value without changing the float and string values.
  145.  
  146. Back to TOC
  147.  
  148.  
  149. cvar.get_int
  150. syntax: cvar.get_int()
  151.  
  152. Returns nil if called on a ConCommand.
  153.  
  154. Back to TOC
  155.  
  156.  
  157. cvar.invoke_callback
  158. syntax: cvar.invoke_callback()
  159.  
  160. For ConCommands, optionally pass extra arguments and they will be forwarded to the callback. For ConVars, optionally pass an extra integer argument specifying the index of the change callback to invoke, otherwise all change callbacks will be invoked.
  161.  
  162. cvar.snd_setmixer:invoke_callback("Ambient", "vol", "0") -- equivalent to typing "snd_setmixer Ambient vol 0" in console
  163.  
  164. Back to TOC
  165.  
  166.  
  167. globals.realtime
  168. syntax: globals.realtime()
  169.  
  170. Returns the local time in seconds.
  171.  
  172. Back to TOC
  173.  
  174.  
  175. globals.curtime
  176. syntax: globals.curtime()
  177.  
  178. Returns the game time in seconds. This number is synchronized with the server.
  179.  
  180. Back to TOC
  181.  
  182.  
  183. globals.frametime
  184. syntax: globals.frametime()
  185.  
  186. Returns the number of seconds elapsed during the last game frame.
  187.  
  188. Back to TOC
  189.  
  190.  
  191. globals.absoluteframetime
  192. syntax: globals.absoluteframetime()
  193.  
  194. Returns the number of seconds elapsed during the last game frame.
  195.  
  196. Back to TOC
  197.  
  198.  
  199. globals.maxplayers
  200. syntax: globals.maxplayers()
  201.  
  202. Returns the maximum number of players in the server.
  203.  
  204. Back to TOC
  205.  
  206.  
  207. globals.tickcount
  208. syntax: globals.tickcount()
  209.  
  210. Returns the number of ticks elapsed in the server.
  211.  
  212. Back to TOC
  213.  
  214.  
  215. globals.tickinterval
  216. syntax: globals.tickinterval()
  217.  
  218. Returns the time elapsed in one game tick in seconds.
  219.  
  220. Back to TOC
  221.  
  222.  
  223. globals.framecount
  224. syntax: globals.framecount()
  225.  
  226. Returns the number of frames since the game started
  227.  
  228. Back to TOC
  229.  
  230.  
  231. globals.mapname
  232. syntax: globals.mapname()
  233.  
  234. Returns the name of the loaded map, or nil if you are not in game.
  235.  
  236. Back to TOC
  237.  
  238.  
  239. globals.lastoutgoingcommand
  240. syntax: globals.lastoutgoingcommand()
  241.  
  242. Returns the command number of the last outgoing command.
  243.  
  244. Back to TOC
  245.  
  246.  
  247. entity.get_local_player
  248. syntax: entity.get_local_player()
  249.  
  250. Returns the entity index for the local player, or nil on failure.
  251.  
  252. Back to TOC
  253.  
  254.  
  255. entity.get_all
  256. syntax: entity.get_all(classname)
  257.  
  258. classname - Optional string that specifies the class name of entities that will be added to the list, for example "CCSPlayer".
  259.  
  260. Returns an array of entity indices. Pass no arguments for all entities.
  261.  
  262. Back to TOC
  263.  
  264.  
  265. entity.get_players
  266. syntax: entity.get_players(enemies_only)
  267.  
  268. enemies_only - Optional. If true then you and the players on your team will not be added to the list.
  269.  
  270. Returns an array of player entity indices. Dormant and dead players will not be added to the list.
  271.  
  272. Back to TOC
  273.  
  274.  
  275. entity.get_game_rules
  276. syntax: entity.get_game_rules()
  277.  
  278. Returns entity index of CCSGameRulesProxy instance, or nil if none exists.
  279.  
  280. Back to TOC
  281.  
  282.  
  283. entity.get_player_resource
  284. syntax: entity.get_player_resource()
  285.  
  286. Returns entity index of CCSPlayerResource instance, or nil if none exists.
  287.  
  288. Back to TOC
  289.  
  290.  
  291. entity.get_classname
  292. syntax: entity.get_classname(ent)
  293.  
  294. ent - Entity index.
  295.  
  296. Returns the name of the entity's class, or nil on failure.
  297.  
  298. Back to TOC
  299.  
  300.  
  301. entity.set_prop
  302. syntax: entity.set_prop(ent, propname, value, array_index)
  303.  
  304. ent - Entity index.
  305.  
  306. propname - Name of the networked property.
  307.  
  308. value - The property will be set to this value. For vectors or angles, separate the components by commas.
  309.  
  310. array_index - Optional. If propname is an array, the value at this array index will be set.
  311.  
  312. Back to TOC
  313.  
  314.  
  315. entity.get_prop
  316. syntax: entity.get_prop(ent, propname, array_index)
  317.  
  318. ent - Entity index.
  319.  
  320. propname - Name of the networked property.
  321.  
  322. array_index - Optional. If propname is an array, the value at this array index will be returned.
  323.  
  324. Returns the value of the property, or nil on failure. For vectors or angles, this returns three values.
  325.  
  326. Back to TOC
  327.  
  328.  
  329. entity.is_enemy
  330. syntax: entity.is_enemy(ent)
  331.  
  332. ent - Entity index.
  333.  
  334. Returns true if the entity is on the other team.
  335.  
  336. Back to TOC
  337.  
  338.  
  339. entity.is_alive
  340. syntax: entity.is_alive(ent)
  341.  
  342. ent - Entity index.
  343.  
  344. Returns true if the player is not dead.
  345.  
  346. Back to TOC
  347.  
  348.  
  349. entity.is_dormant
  350. syntax: entity.is_dormant(ent)
  351.  
  352. ent - Entity index.
  353.  
  354. Returns true if the player is not dormant.
  355.  
  356. Back to TOC
  357.  
  358.  
  359. entity.get_player_name
  360. syntax: entity.get_player_name(ent)
  361.  
  362. ent - Player entity index.
  363.  
  364. Returns the player's name, or the string "unknown" on failure.
  365.  
  366. Back to TOC
  367.  
  368.  
  369. entity.get_player_weapon
  370. syntax: entity.get_player_weapon(ent)
  371.  
  372. ent - Player entity index.
  373.  
  374. Returns the entity index of the player's active weapon, or nil if the player is not alive, dormant, etc.
  375.  
  376. Back to TOC
  377.  
  378.  
  379. entity.hitbox_position
  380. syntax: entity.hitbox_position(player, hitbox)
  381.  
  382. player - Entity index of the player.
  383.  
  384. hitbox - Either a string of the hitbox name, or an integer index of the hitbox.
  385.  
  386. Returns world coordinates x, y, z, or nil on failure.
  387.  
  388. Back to TOC
  389.  
  390.  
  391. entity.get_steam64
  392. syntax: entity.get_steam64(player)
  393.  
  394. player - Entity index of the player.
  395.  
  396. Returns steamID3, or nil on failure.
  397.  
  398. Back to TOC
  399.  
  400.  
  401. entity.get_bounding_box
  402. syntax: entity.get_bounding_box(player)
  403.  
  404. player - Entity index of the player.
  405.  
  406. Returns x1, y1, x2, y2, alpha_multiplier. The contents of x1, y1, x2, y2 must be ignored when alpha_multiplier is zero, which indicates that the bounding box is invalid and should not be drawn.
  407.  
  408. Back to TOC
  409.  
  410.  
  411. client.set_event_callback
  412. syntax: client.set_event_callback(event_name, callback)
  413.  
  414. event_name - Name of the event.
  415.  
  416. callback - Lua function to call when this event occurs.
  417.  
  418. Raises an error and prints a message in console upon failure.
  419.  
  420. Back to TOC
  421.  
  422.  
  423. client.log
  424. syntax: client.log(msg, ...)
  425.  
  426. msg - The message
  427.  
  428. ... - Optional comma-separated arguments to concatenate with msg.
  429.  
  430. Back to TOC
  431.  
  432.  
  433. client.color_log
  434. syntax: client.color_log(r, g, b, msg, ...)
  435.  
  436. r - Red (0-255)
  437.  
  438. g - Red (0-255)
  439.  
  440. b - Red (0-255)
  441.  
  442. msg - The message
  443.  
  444. ... - Optional comma-separated arguments to concatenate with msg.
  445.  
  446. Back to TOC
  447.  
  448.  
  449. client.exec
  450. syntax: client.exec(cmd, ...)
  451.  
  452. cmd - The console command(s) to execute.
  453.  
  454. ... - Optional comma-separated arguments to concatenate with cmd.
  455.  
  456. Back to TOC
  457.  
  458.  
  459. client.userid_to_entindex
  460. syntax: client.userid_to_entindex(userid)
  461.  
  462. userid - This is given by some game events.
  463.  
  464. Returns the entity index, or 0 on failure.
  465.  
  466. Back to TOC
  467.  
  468.  
  469. client.draw_debug_text
  470. syntax: client.draw_debug_text(x, y, z, line_offset, duration, r, g, b, a, ...)
  471.  
  472. x - Position in world space
  473.  
  474. y - Position in world space
  475.  
  476. z - Position in world space
  477.  
  478. line_offset - Used for vertical alignment, use 0 for the first line.
  479.  
  480. duration - Time in seconds that the text will remain on the screen.
  481.  
  482. r - Red (1-255)
  483.  
  484. g - Green (1-255)
  485.  
  486. b - Blue (1-255)
  487.  
  488. a - Alpha (1-255)
  489.  
  490. ... - The text that will be drawn
  491.  
  492. Avoid calling this during the paint event.
  493.  
  494. Back to TOC
  495.  
  496.  
  497. client.draw_hitboxes
  498. syntax: client.draw_hitboxes(entindex, duration, hitboxes, r, g, b, a, tick)
  499.  
  500. entindex - Entity index
  501.  
  502. duration - Time in seconds
  503.  
  504. hitboxes - Either the hitbox index, an array of hitbox indices, or 19 for all hitboxes
  505.  
  506. r - Red (1-255)
  507.  
  508. g - Green (1-255)
  509.  
  510. b - Blue (1-255)
  511.  
  512. a - Alpha (1-255)
  513.  
  514. tick - Optional integer
  515.  
  516. Draws hitbox overlays. Avoid calling this during the paint event.
  517.  
  518. Back to TOC
  519.  
  520.  
  521. client.random_int
  522. syntax: client.random_int(minimum, maximum)
  523.  
  524. minimum - Lowest possible result
  525.  
  526. maximum - Highest possible result
  527.  
  528. Returns a random integer between minimum and maximum.
  529.  
  530. Back to TOC
  531.  
  532.  
  533. client.random_float
  534. syntax: client.random_float(minimum, maximum)
  535.  
  536. minimum - Lowest possible result
  537.  
  538. maximum - Highest possible result
  539.  
  540. Returns a random float between minimum and maximum.
  541.  
  542. Back to TOC
  543.  
  544.  
  545. client.screen_size
  546. syntax: client.screen_size()
  547.  
  548. Returns (width, height).
  549.  
  550. Back to TOC
  551.  
  552.  
  553. client.visible
  554. syntax: client.visible(x, y, z)
  555.  
  556. x - Position in world space
  557.  
  558. y - Position in world space
  559.  
  560. z - Position in world space
  561.  
  562. Returns true if the position is visible. For example, you could use a player's origin to see if they are visible.
  563.  
  564. Back to TOC
  565.  
  566.  
  567. client.trace_line
  568. syntax: client.trace_line(skip_entindex, from_x, from_y, from_z, to_x, to_y, to_z)
  569.  
  570. skip_entindex - Ignore this entity while tracing
  571.  
  572. from_x - Position in world space
  573.  
  574. from_y - Position in world space
  575.  
  576. from_z - Position in world space
  577.  
  578. to_x - Position in world space
  579.  
  580. to_y - Position in world space
  581.  
  582. to_z - Position in world space
  583.  
  584. Returns fraction, entindex. fraction is a percentage in the range [0.0, 1.0] that tells you how far the trace went before hitting something, so 1.0 means nothing was hit. entindex is the entity index that hit, or -1 if no entity was hit.
  585.  
  586. Back to TOC
  587.  
  588.  
  589. client.trace_bullet
  590. syntax: client.trace_bullet(from_player, from_x, from_y, from_z, to_x, to_y, to_z)
  591.  
  592. from_player - Entity index of the player whose weapon will be used for this trace
  593.  
  594. from_x - Position in world space
  595.  
  596. from_y - Position in world space
  597.  
  598. from_z - Position in world space
  599.  
  600. to_x - Position in world space
  601.  
  602. to_y - Position in world space
  603.  
  604. to_z - Position in world space
  605.  
  606. Returns entindex, damage. Entindex is nil when no player is hit.
  607.  
  608. Back to TOC
  609.  
  610.  
  611. client.scale_damage
  612. syntax: client.scale_damage(entindex, hitgroup, damage)
  613.  
  614. entindex - Player entity index
  615.  
  616. hitgroup - Hit group index
  617.  
  618. damage - Damage
  619.  
  620. Returns adjusted damage for the specified hitgroup
  621.  
  622. Back to TOC
  623.  
  624.  
  625. client.delay_call
  626. syntax: client.delay_call(delay, callback, ...)
  627.  
  628. delay - Time in seconds to wait before calling callback.
  629.  
  630. callback - The lua function that will be called after delay seconds.
  631.  
  632. ... - Optional arguments that will be passed to the callback.
  633.  
  634. Back to TOC
  635.  
  636.  
  637. client.latency
  638. syntax: client.latency()
  639.  
  640. Returns your latency in seconds.
  641.  
  642. Back to TOC
  643.  
  644.  
  645. client.camera_angles
  646. syntax: client.camera_angles()
  647.  
  648. Returns pitch, yaw, roll of where you are looking.
  649.  
  650. Back to TOC
  651.  
  652.  
  653. client.camera_angles
  654. syntax: client.camera_angles(pitch, yaw)
  655.  
  656. pitch - Pitch
  657.  
  658. yaw - Yaw
  659.  
  660. Set camera angles
  661.  
  662. Back to TOC
  663.  
  664.  
  665. client.timestamp
  666. syntax: client.timestamp()
  667.  
  668. Returns high precision timestamp in milliseconds.
  669.  
  670. Back to TOC
  671.  
  672.  
  673. client.eye_position
  674. syntax: client.eye_position()
  675.  
  676. Returns x, y, z world coordinates of the local player's eye position, or nil on failure.
  677.  
  678. Back to TOC
  679.  
  680.  
  681. client.set_clan_tag
  682. syntax: client.set_clan_tag(...)
  683.  
  684. ... - The text that will be drawn
  685.  
  686. The clan tag is removed if no argument is passed or if it is an empty string. Additional arguments will be concatenated similar to client.log.
  687.  
  688. Back to TOC
  689.  
  690.  
  691. client.system_time
  692. syntax: client.system_time()
  693.  
  694. Returns hour, minute, seconds, milliseconds.
  695.  
  696. local h, m, s, ms = client.system_time()
  697.  
  698. Back to TOC
  699.  
  700.  
  701. client.reload_active_scripts
  702. syntax: client.reload_active_scripts()
  703.  
  704. Reloads all scripts the following frame.
  705.  
  706. Back to TOC
  707.  
  708.  
  709. ui.new_checkbox
  710. syntax: ui.new_checkbox(tab, container, name)
  711.  
  712. tab - The name of the tab: AA, RAGE, LEGIT, MISC, PLAYERS, SKINS, or VISUALS.
  713.  
  714. container - The name of the existing container to which this control will be added.
  715.  
  716. name - The name of the checkbox.
  717.  
  718. Returns a special value that can be passed to ui.get and ui.set, or throws an error on failure.
  719.  
  720. Back to TOC
  721.  
  722.  
  723. ui.new_slider
  724. syntax: ui.new_slider(tab, container, name, min, max, init_value, show_tooltip, unit, scale, tooltips)
  725.  
  726. tab - The name of the tab: AA, RAGE, LEGIT, MISC, PLAYERS, SKINS, or VISUALS.
  727.  
  728. container - The name of the existing container to which this control will be added.
  729.  
  730. name - The name of the slider.
  731.  
  732. min - The minimum value that can be set using the slider.
  733.  
  734. max - The maximum value that can be set using the slider.
  735.  
  736. init_value - Optional integer. The initial value. If not provided, the initial value will be min.
  737.  
  738. show_tooltip - Optional boolean. true if the slider should display its current value.
  739.  
  740. unit - Optional string that is two characters or less. This will be appended to the display value. For example, "px" for pixels or "%" for a percentage.
  741.  
  742. scale - Optional The display value will be multiplied by this scale. For example, 0.1 will make a slider with the range [0-1800] show as 0.0-180.0 with one decimal place.
  743.  
  744. tooltips - Optional table used to override the tooltip for the specified values. The key must be within min-max. The value is a string that will be shown instead of the numeric value whenever that value is selected.
  745.  
  746. Returns a special value that can be passed to ui.get and ui.set, or throws an error on failure.
  747.  
  748. Back to TOC
  749.  
  750.  
  751. ui.new_combobox
  752. syntax: ui.new_combobox(tab, container, name, ...)
  753.  
  754. tab - The name of the tab: AA, RAGE, LEGIT, MISC, PLAYERS, SKINS, or VISUALS.
  755.  
  756. container - The name of the existing container to which this control will be added.
  757.  
  758. name - The name of the combobox.
  759.  
  760. ... - One or more comma separated string values that will be added to the combobox. Alternatively, a table of strings that will be added.
  761.  
  762. Returns a special value that can be passed to ui.get and ui.set, or throws an error on failure.
  763.  
  764. Back to TOC
  765.  
  766.  
  767. ui.new_multiselect
  768. syntax: ui.new_multiselect(tab, container, name, ...)
  769.  
  770. tab - The name of the tab: AA, RAGE, LEGIT, MISC, PLAYERS, SKINS, or VISUALS.
  771.  
  772. container - The name of the existing container to which this control will be added.
  773.  
  774. name - The name of the multiselect.
  775.  
  776. ... - One or more comma separated string values that will be added to the combobox. Alternatively, a table of strings that will be added.
  777.  
  778. Returns a special value that can be passed to ui.get and ui.set, or throws an error on failure.
  779.  
  780. Back to TOC
  781.  
  782.  
  783. ui.new_hotkey
  784. syntax: ui.new_hotkey(tab, container, name, inline)
  785.  
  786. tab - The name of the tab: AA, RAGE, LEGIT, MISC, PLAYERS, SKINS, or VISUALS.
  787.  
  788. container - The name of the existing container to which this control will be added.
  789.  
  790. name - The name of the hotkey.
  791.  
  792. inline - Optional boolean. If set to true, the hotkey will be placed to the right of the preceding menu item.
  793.  
  794. Returns a special value that can be passed to ui.get to see if the hotkey is pressed, or throws an error on failure.
  795.  
  796. Back to TOC
  797.  
  798.  
  799. ui.new_button
  800. syntax: ui.new_button(tab, container, name, callback)
  801.  
  802. tab - The name of the tab: AA, RAGE, LEGIT, MISC, PLAYERS, SKINS, or VISUALS.
  803.  
  804. container - The name of the existing container to which this checkbox will be added.
  805.  
  806. name - The name of the button.
  807.  
  808. callback - The lua function that will be called when the button is pressed.
  809.  
  810. Throws an error on failure. The return value should not be used with ui.set or ui.get.
  811.  
  812. Back to TOC
  813.  
  814.  
  815. ui.new_color_picker
  816. syntax: ui.new_color_picker(tab, container, name, r, g, b, a)
  817.  
  818. tab - The name of the tab: AA, RAGE, LEGIT, MISC, PLAYERS, SKINS, or VISUALS.
  819.  
  820. container - The name of the existing container to which this checkbox will be added.
  821.  
  822. name - The name of the color picker. This will not be shown, it is only used to identify this item in saved configs.
  823.  
  824. r - Optional initial red value (0-255)
  825.  
  826. g - Optional initial green value (0-255)
  827.  
  828. b - Optional initial blue value (0-255)
  829.  
  830. a - Optional initial alpha value (0-255)
  831.  
  832. Throws an error on failure. The color picker is placed to the right of the previous menu item.
  833.  
  834. Back to TOC
  835.  
  836.  
  837. ui.new_textbox
  838. syntax: ui.new_textbox(tab, container)
  839.  
  840. tab - The name of the tab: AA, RAGE, LEGIT, MISC, PLAYERS, SKINS, or VISUALS.
  841.  
  842. container - The name of the existing container to which this textbox will be added.
  843.  
  844. Throws an error on failure. Returns a special value that can be used with ui.get
  845.  
  846. Back to TOC
  847.  
  848.  
  849. ui.reference
  850. syntax: ui.reference(tab, container, name)
  851.  
  852. tab - The name of the tab: AA, RAGE, LEGIT, MISC, PLAYERS, SKINS, or VISUALS.
  853.  
  854. container - The name of the existing container to which this checkbox will be added.
  855.  
  856. name - The name of the menu item.
  857.  
  858. Avoid calling this from inside a function. Returns a reference that can be passed to ui.get and ui.set, or throws an error on failure. This allows you to access a built-in pre-existing menu items. This function returns multiple values when the specified menu item is followed by unnamed menu items, for example a color picker or a hotkey.
  859.  
  860. Back to TOC
  861.  
  862.  
  863. ui.set
  864. syntax: ui.set(item, value, ...)
  865.  
  866. item - The result of either ui.new_checkbox, ui.new_slider, or ui.reference.
  867.  
  868. value - The value to which the menu item will be set.
  869.  
  870. ... - Optional. For multiselect comboboxes, you may want to set more than one option.
  871.  
  872. For checkboxes, pass true or false. For a slider, pass a number that is within the slider's minimum/maximum values. For a combobox, pass a string value. For a multiselect combobox, pass zero or more strings. For referenced buttons, param is ignored and the button's callback is invoked. For color pickers, pass the arguments r, g, b, a.
  873.  
  874. Back to TOC
  875.  
  876.  
  877. ui.get
  878. syntax: ui.get(item)
  879.  
  880. item - The special value returned by ui.new_checkbox, ui.new_slider, ui.new_combobox, ui.new_hotkey, or ui.reference.
  881.  
  882. For a checkbox, returns true or false. For a slider, returns an integer. For a combobox, returns a string. For a multiselect combobox, returns an array of strings. For a hotkey, returns true if the hotkey is active. For a color picker, returns r, g, b, a. Throws an error on failure.
  883.  
  884. Back to TOC
  885.  
  886.  
  887. ui.set_callback
  888. syntax: ui.set_callback(item, callback)
  889.  
  890. item - The special value returned by ui.new_*. Do not try passing a reference to an existing menu item.
  891.  
  892. callback - Lua function that will be called when the menu item changes values. For example, this will be called when the user checks or unchecks a checkbox.
  893.  
  894. Back to TOC
  895.  
  896.  
  897. ui.set_visible
  898. syntax: ui.set_visible(item, visible)
  899.  
  900. item - A menu item reference.
  901.  
  902. visible - Boolean. Pass false to hide the control from the menu.
  903.  
  904. Back to TOC
  905.  
  906.  
  907. ui.is_menu_open
  908. syntax: ui.is_menu_open()
  909.  
  910. Returns true if the menu is currently open.
  911.  
  912. Back to TOC
  913.  
  914.  
  915. ui.mouse_position
  916. syntax: ui.mouse_position()
  917.  
  918. Returns current mouse coordinates x, y
  919.  
  920. Back to TOC
  921.  
  922.  
  923. renderer.text
  924. syntax: renderer.text(x, y, r, g, b, a, flags, max_width, ...)
  925.  
  926. x - Screen coordinate
  927.  
  928. y - Screen coordinate
  929.  
  930. r - Red (1-255)
  931.  
  932. g - Green (1-255)
  933.  
  934. b - Blue (1-255)
  935.  
  936. a - Alpha (1-255)
  937.  
  938. flags - "+" for large text, "-" for small text, "c" for centered text, "r" for right-aligned text, "b" for bold text. "c" can be combined with other flags. nil can be specified for normal sized uncentered text.
  939.  
  940. max_width - Text will be clipped if it exceeds this width in pixels. Use 0 for no limit.
  941.  
  942. ... - Text that will be drawn
  943.  
  944. This can only be called from the paint callback.
  945.  
  946. Back to TOC
  947.  
  948.  
  949. renderer.measure_text
  950. syntax: renderer.measure_text(flags, ...)
  951.  
  952. flags - "+" for large text, "-" for small text, or nil for normal sized text.
  953.  
  954. ... - Text that will be measured
  955.  
  956. Returns width, height. This can only be called from the paint callback.
  957.  
  958. Back to TOC
  959.  
  960.  
  961. renderer.rectangle
  962. syntax: renderer.rectangle(x, y, w, h, r, g, b, a)
  963.  
  964. x - Screen coordinate
  965.  
  966. y - Screen coordinate
  967.  
  968. w - Width in pixels
  969.  
  970. h - Height in pixels
  971.  
  972. r - Red (1-255)
  973.  
  974. g - Green (1-255)
  975.  
  976. b - Blue (1-255)
  977.  
  978. a - Alpha (1-255)
  979.  
  980. This can only be called from the paint callback.
  981.  
  982. Back to TOC
  983.  
  984.  
  985. renderer.line
  986. syntax: renderer.line(xa, ya, xb, yb, r, g, b, a)
  987.  
  988. xa - Screen coordinate of point A
  989.  
  990. ya - Screen coordinate of point A
  991.  
  992. xb - Screen coordinate of point B
  993.  
  994. yb - Screen coordinate of point B
  995.  
  996. r - Red (1-255)
  997.  
  998. g - Green (1-255)
  999.  
  1000. b - Blue (1-255)
  1001.  
  1002. a - Alpha (1-255)
  1003.  
  1004. This can only be called from the paint callback.
  1005.  
  1006. Back to TOC
  1007.  
  1008.  
  1009. renderer.gradient
  1010. syntax: renderer.gradient(x, y, w, h, r1, g1, b1, a1, r2, g2, b2, a2, ltr)
  1011.  
  1012. x - Screen coordinate
  1013.  
  1014. y - Screen coordinate
  1015.  
  1016. w - Width in pixels
  1017.  
  1018. h - Height in pixels
  1019.  
  1020. r1 - Red (1-255)
  1021.  
  1022. g1 - Green (1-255)
  1023.  
  1024. b1 - Blue (1-255)
  1025.  
  1026. a1 - Alpha (1-255)
  1027.  
  1028. r2 - Red (1-255)
  1029.  
  1030. g2 - Green (1-255)
  1031.  
  1032. b2 - Blue (1-255)
  1033.  
  1034. a2 - Alpha (1-255)
  1035.  
  1036. ltr - Left to right. Pass true for horizontal gradient, or false for vertical.
  1037.  
  1038. This can only be called from the paint callback.
  1039.  
  1040. Back to TOC
  1041.  
  1042.  
  1043. renderer.circle
  1044. syntax: renderer.circle(x, y, r, g, b, a, radius, start_degrees, percentage)
  1045.  
  1046. x - Screen coordinate
  1047.  
  1048. y - Screen coordinate
  1049.  
  1050. r - Red (1-255)
  1051.  
  1052. g - Green (1-255)
  1053.  
  1054. b - Blue (1-255)
  1055.  
  1056. a - Alpha (1-255)
  1057.  
  1058. radius - Radius of the circle in pixels.
  1059.  
  1060. start_degrees - 0 is the right side, 90 is the bottom, 180 is the left, 270 is the top.
  1061.  
  1062. percentage - Must be within [0.0-1.0]. 1.0 is a full circle, 0.5 is a half circle, etc.
  1063.  
  1064. This can only be called from the paint callback.
  1065.  
  1066. Back to TOC
  1067.  
  1068.  
  1069. renderer.circle_outline
  1070. syntax: renderer.circle_outline(x, y, r, g, b, a, radius, start_degrees, percentage, thickness)
  1071.  
  1072. x - Screen coordinate
  1073.  
  1074. y - Screen coordinate
  1075.  
  1076. r - Red (1-255)
  1077.  
  1078. g - Green (1-255)
  1079.  
  1080. b - Blue (1-255)
  1081.  
  1082. a - Alpha (1-255)
  1083.  
  1084. radius - Radius of the circle in pixels.
  1085.  
  1086. start_degrees - 0 is the right side, 90 is the bottom, 180 is the left, 270 is the top.
  1087.  
  1088. percentage - Must be within [0.0-1.0]. 1.0 is a full circle, 0.5 is a half circle, etc.
  1089.  
  1090. thickness - Thickness of the outline in pixels.
  1091.  
  1092. This can only be called from the paint callback.
  1093.  
  1094. Back to TOC
  1095.  
  1096.  
  1097. renderer.triangle
  1098. syntax: renderer.triangle(x0, y0, x1, y1, x2, y2, r, g, b, a)
  1099.  
  1100. x0 - Screen coordinate X for point A
  1101.  
  1102. y0 - Screen coordinate Y for point A
  1103.  
  1104. x1 - Screen coordinate X for point B
  1105.  
  1106. y1 - Screen coordinate Y for point B
  1107.  
  1108. x2 - Screen coordinate X for point C
  1109.  
  1110. y2 - Screen coordinate Y for point C
  1111.  
  1112. r - Red (1-255)
  1113.  
  1114. g - Green (1-255)
  1115.  
  1116. b - Blue (1-255)
  1117.  
  1118. a - Alpha (1-255)
  1119.  
  1120. This can only be called from the paint callback.
  1121.  
  1122. Back to TOC
  1123.  
  1124.  
  1125. renderer.world_to_screen
  1126. syntax: renderer.world_to_screen(x, y, z)
  1127.  
  1128. x - Position in world space
  1129.  
  1130. y - Position in world space
  1131.  
  1132. z - Position in world space
  1133.  
  1134. Returns two screen coordinates (x, y), or nil if the world position is not visible on your screen. This can only be called from the paint callback.
  1135.  
  1136. Back to TOC
  1137.  
  1138.  
  1139. renderer.indicator
  1140. syntax: renderer.indicator(r, g, b, a, ...)
  1141.  
  1142. r - Red (1-255)
  1143.  
  1144. g - Green (1-255)
  1145.  
  1146. b - Blue (1-255)
  1147.  
  1148. a - Alpha (1-255)
  1149.  
  1150. ... - The text that will be drawn
  1151.  
  1152. Returns the Y screen coordinate (vertical offset) of the drawn text, or nil on failure. This can only be called from the paint callback.
  1153.  
  1154. Back to TOC
  1155.  
  1156.  
  1157. renderer.texture
  1158. syntax: renderer.texture(id, x, y, w, h, r, g, b, a)
  1159.  
  1160. id - Texture ID
  1161.  
  1162. x - X screen coordinate
  1163.  
  1164. y - Y screen coordinate
  1165.  
  1166. w - Width
  1167.  
  1168. h - Height
  1169.  
  1170. r - Red (0-255)
  1171.  
  1172. g - Green (0-255)
  1173.  
  1174. b - Blue (0-255)
  1175.  
  1176. a - Alpha (0-255)
  1177.  
  1178. Back to TOC
  1179.  
  1180.  
  1181. renderer.load_svg
  1182. syntax: renderer.load_svg(contents, width, height)
  1183.  
  1184. contents - SVG file contents
  1185.  
  1186. width - Width
  1187.  
  1188. height - Height
  1189.  
  1190. Returns a texture ID that can be used with renderer.texture, or nil on failure
  1191.  
  1192. Back to TOC
  1193.  
  1194.  
  1195. GameSense 2019
  1196.  
  1197. Terms and Conditions / Privacy policy
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement