Advertisement
Guest User

Untitled

a guest
Dec 8th, 2019
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.00 KB | None | 0 0
  1. GameSense API for Lua
  2. GameSense API for Lua
  3. cvar.set_string
  4. cvar.get_string
  5. cvar.set_float
  6. cvar.set_raw_float
  7. cvar.get_float
  8. cvar.set_int
  9. cvar.set_raw_int
  10. cvar.get_int
  11. cvar.invoke_callback
  12. globals.realtime
  13. globals.curtime
  14. globals.frametime
  15. globals.absoluteframetime
  16. globals.maxplayers
  17. globals.tickcount
  18. globals.tickinterval
  19. globals.framecount
  20. globals.mapname
  21. globals.lastoutgoingcommand
  22. entity.get_local_player
  23. entity.get_all
  24. entity.get_players
  25. entity.get_game_rules
  26. entity.get_player_resource
  27. entity.get_classname
  28. entity.set_prop
  29. entity.get_prop
  30. entity.is_enemy
  31. entity.is_alive
  32. entity.is_dormant
  33. entity.get_player_name
  34. entity.get_player_weapon
  35. entity.hitbox_position
  36. entity.get_steam64
  37. entity.get_bounding_box
  38. client.set_event_callback
  39. client.log
  40. client.color_log
  41. client.exec
  42. client.userid_to_entindex
  43. client.draw_debug_text
  44. client.draw_hitboxes
  45. client.random_int
  46. client.random_float
  47. client.screen_size
  48. client.visible
  49. client.trace_line
  50. client.trace_bullet
  51. client.scale_damage
  52. client.delay_call
  53. client.latency
  54. client.camera_angles
  55. client.camera_angles
  56. client.timestamp
  57. client.eye_position
  58. client.set_clan_tag
  59. client.system_time
  60. client.reload_active_scripts
  61. ui.new_checkbox
  62. ui.new_slider
  63. ui.new_combobox
  64. ui.new_multiselect
  65. ui.new_hotkey
  66. ui.new_button
  67. ui.new_color_picker
  68. ui.new_textbox
  69. ui.reference
  70. ui.set
  71. ui.get
  72. ui.set_callback
  73. ui.set_visible
  74. ui.is_menu_open
  75. ui.mouse_position
  76. renderer.text
  77. renderer.measure_text
  78. renderer.rectangle
  79. renderer.line
  80. renderer.gradient
  81. renderer.circle
  82. renderer.circle_outline
  83. renderer.triangle
  84. renderer.world_to_screen
  85. renderer.indicator
  86. renderer.texture
  87. renderer.load_svg
  88. cvar.set_string
  89. syntax: cvar.set_string(value)
  90. value - String value
  91. Back to TOC
  92.  
  93. cvar.get_string
  94. syntax: cvar.get_string()
  95. Returns nil on failure.
  96. Back to TOC
  97.  
  98. cvar.set_float
  99. syntax: cvar.set_float(value)
  100. value - Float value
  101. cvar.cl_interp_ratio:set_float(1)
  102. Back to TOC
  103.  
  104. cvar.set_raw_float
  105. syntax: cvar.set_raw_float(value)
  106. value - Float value
  107. This sets the float value without changing the integer and string values.
  108. Back to TOC
  109.  
  110. cvar.get_float
  111. syntax: cvar.get_float()
  112. Returns nil if called on a ConCommand.
  113. Back to TOC
  114.  
  115. cvar.set_int
  116. syntax: cvar.set_int(value)
  117. value - Integer value
  118. Back to TOC
  119.  
  120. cvar.set_raw_int
  121. syntax: cvar.set_raw_int(value)
  122. value - Integer value
  123. This sets the integer value without changing the float and string values.
  124. Back to TOC
  125.  
  126. cvar.get_int
  127. syntax: cvar.get_int()
  128. Returns nil if called on a ConCommand.
  129. Back to TOC
  130.  
  131. cvar.invoke_callback
  132. syntax: cvar.invoke_callback()
  133. 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.
  134. cvar.snd_setmixer:invoke_callback("Ambient", "vol", "0") -- equivalent to typing "snd_setmixer Ambient vol 0" in console
  135. Back to TOC
  136.  
  137. globals.realtime
  138. syntax: globals.realtime()
  139. Returns the local time in seconds.
  140. Back to TOC
  141.  
  142. globals.curtime
  143. syntax: globals.curtime()
  144. Returns the game time in seconds. This number is synchronized with the server.
  145. Back to TOC
  146.  
  147. globals.frametime
  148. syntax: globals.frametime()
  149. Returns the number of seconds elapsed during the last game frame.
  150. Back to TOC
  151.  
  152. globals.absoluteframetime
  153. syntax: globals.absoluteframetime()
  154. Returns the number of seconds elapsed during the last game frame.
  155. Back to TOC
  156.  
  157. globals.maxplayers
  158. syntax: globals.maxplayers()
  159. Returns the maximum number of players in the server.
  160. Back to TOC
  161.  
  162. globals.tickcount
  163. syntax: globals.tickcount()
  164. Returns the number of ticks elapsed in the server.
  165. Back to TOC
  166.  
  167. globals.tickinterval
  168. syntax: globals.tickinterval()
  169. Returns the time elapsed in one game tick in seconds.
  170. Back to TOC
  171.  
  172. globals.framecount
  173. syntax: globals.framecount()
  174. Returns the number of frames since the game started
  175. Back to TOC
  176.  
  177. globals.mapname
  178. syntax: globals.mapname()
  179. Returns the name of the loaded map, or nil if you are not in game.
  180. Back to TOC
  181.  
  182. globals.lastoutgoingcommand
  183. syntax: globals.lastoutgoingcommand()
  184. Returns the command number of the last outgoing command.
  185. Back to TOC
  186.  
  187. entity.get_local_player
  188. syntax: entity.get_local_player()
  189. Returns the entity index for the local player, or nil on failure.
  190. Back to TOC
  191.  
  192. entity.get_all
  193. syntax: entity.get_all(classname)
  194. classname - Optional string that specifies the class name of entities that will be added to the list, for example "CCSPlayer".
  195. Returns an array of entity indices. Pass no arguments for all entities.
  196. Back to TOC
  197.  
  198. entity.get_players
  199. syntax: entity.get_players(enemies_only)
  200. enemies_only - Optional. If true then you and the players on your team will not be added to the list.
  201. Returns an array of player entity indices. Dormant and dead players will not be added to the list.
  202. Back to TOC
  203.  
  204. entity.get_game_rules
  205. syntax: entity.get_game_rules()
  206. Returns entity index of CCSGameRulesProxy instance, or nil if none exists.
  207. Back to TOC
  208.  
  209. entity.get_player_resource
  210. syntax: entity.get_player_resource()
  211. Returns entity index of CCSPlayerResource instance, or nil if none exists.
  212. Back to TOC
  213.  
  214. entity.get_classname
  215. syntax: entity.get_classname(ent)
  216. ent - Entity index.
  217. Returns the name of the entity's class, or nil on failure.
  218. Back to TOC
  219.  
  220. entity.set_prop
  221. syntax: entity.set_prop(ent, propname, value, array_index)
  222. ent - Entity index.
  223. propname - Name of the networked property.
  224. value - The property will be set to this value. For vectors or angles, separate the components by commas.
  225. array_index - Optional. If propname is an array, the value at this array index will be set.
  226. Back to TOC
  227.  
  228. entity.get_prop
  229. syntax: entity.get_prop(ent, propname, array_index)
  230. ent - Entity index.
  231. propname - Name of the networked property.
  232. array_index - Optional. If propname is an array, the value at this array index will be returned.
  233. Returns the value of the property, or nil on failure. For vectors or angles, this returns three values.
  234. Back to TOC
  235.  
  236. entity.is_enemy
  237. syntax: entity.is_enemy(ent)
  238. ent - Entity index.
  239. Returns true if the entity is on the other team.
  240. Back to TOC
  241.  
  242. entity.is_alive
  243. syntax: entity.is_alive(ent)
  244. ent - Entity index.
  245. Returns true if the player is not dead.
  246. Back to TOC
  247.  
  248. entity.is_dormant
  249. syntax: entity.is_dormant(ent)
  250. ent - Entity index.
  251. Returns true if the player is not dormant.
  252. Back to TOC
  253.  
  254. entity.get_player_name
  255. syntax: entity.get_player_name(ent)
  256. ent - Player entity index.
  257. Returns the player's name, or the string "unknown" on failure.
  258. Back to TOC
  259.  
  260. entity.get_player_weapon
  261. syntax: entity.get_player_weapon(ent)
  262. ent - Player entity index.
  263. Returns the entity index of the player's active weapon, or nil if the player is not alive, dormant, etc.
  264. Back to TOC
  265.  
  266. entity.hitbox_position
  267. syntax: entity.hitbox_position(player, hitbox)
  268. player - Entity index of the player.
  269. hitbox - Either a string of the hitbox name, or an integer index of the hitbox.
  270. Returns world coordinates x, y, z, or nil on failure.
  271. Back to TOC
  272.  
  273. entity.get_steam64
  274. syntax: entity.get_steam64(player)
  275. player - Entity index of the player.
  276. Returns steamID3, or nil on failure.
  277. Back to TOC
  278.  
  279. entity.get_bounding_box
  280. syntax: entity.get_bounding_box(player)
  281. player - Entity index of the player.
  282. 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.
  283. Back to TOC
  284.  
  285. client.set_event_callback
  286. syntax: client.set_event_callback(event_name, callback)
  287. event_name - Name of the event.
  288. callback - Lua function to call when this event occurs.
  289. Raises an error and prints a message in console upon failure.
  290. Back to TOC
  291.  
  292. client.log
  293. syntax: client.log(msg, ...)
  294. msg - The message
  295. ... - Optional comma-separated arguments to concatenate with msg.
  296. Back to TOC
  297.  
  298. client.color_log
  299. syntax: client.color_log(r, g, b, msg, ...)
  300. r - Red (0-255)
  301. g - Red (0-255)
  302. b - Red (0-255)
  303. msg - The message
  304. ... - Optional comma-separated arguments to concatenate with msg.
  305. Back to TOC
  306.  
  307. client.exec
  308. syntax: client.exec(cmd, ...)
  309. cmd - The console command(s) to execute.
  310. ... - Optional comma-separated arguments to concatenate with cmd.
  311. Back to TOC
  312.  
  313. client.userid_to_entindex
  314. syntax: client.userid_to_entindex(userid)
  315. userid - This is given by some game events.
  316. Returns the entity index, or 0 on failure.
  317. Back to TOC
  318.  
  319. client.draw_debug_text
  320. syntax: client.draw_debug_text(x, y, z, line_offset, duration, r, g, b, a, ...)
  321. x - Position in world space
  322. y - Position in world space
  323. z - Position in world space
  324. line_offset - Used for vertical alignment, use 0 for the first line.
  325. duration - Time in seconds that the text will remain on the screen.
  326. r - Red (1-255)
  327. g - Green (1-255)
  328. b - Blue (1-255)
  329. a - Alpha (1-255)
  330. ... - The text that will be drawn
  331. Avoid calling this during the paint event.
  332. Back to TOC
  333.  
  334. client.draw_hitboxes
  335. syntax: client.draw_hitboxes(entindex, duration, hitboxes, r, g, b, a, tick)
  336. entindex - Entity index
  337. duration - Time in seconds
  338. hitboxes - Either the hitbox index, an array of hitbox indices, or 19 for all hitboxes
  339. r - Red (1-255)
  340. g - Green (1-255)
  341. b - Blue (1-255)
  342. a - Alpha (1-255)
  343. tick - Optional integer
  344. Draws hitbox overlays. Avoid calling this during the paint event.
  345. Back to TOC
  346.  
  347. client.random_int
  348. syntax: client.random_int(minimum, maximum)
  349. minimum - Lowest possible result
  350. maximum - Highest possible result
  351. Returns a random integer between minimum and maximum.
  352. Back to TOC
  353.  
  354. client.random_float
  355. syntax: client.random_float(minimum, maximum)
  356. minimum - Lowest possible result
  357. maximum - Highest possible result
  358. Returns a random float between minimum and maximum.
  359. Back to TOC
  360.  
  361. client.screen_size
  362. syntax: client.screen_size()
  363. Returns (width, height).
  364. Back to TOC
  365.  
  366. client.visible
  367. syntax: client.visible(x, y, z)
  368. x - Position in world space
  369. y - Position in world space
  370. z - Position in world space
  371. Returns true if the position is visible. For example, you could use a player's origin to see if they are visible.
  372. Back to TOC
  373.  
  374. client.trace_line
  375. syntax: client.trace_line(skip_entindex, from_x, from_y, from_z, to_x, to_y, to_z)
  376. skip_entindex - Ignore this entity while tracing
  377. from_x - Position in world space
  378. from_y - Position in world space
  379. from_z - Position in world space
  380. to_x - Position in world space
  381. to_y - Position in world space
  382. to_z - Position in world space
  383. 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.
  384. Back to TOC
  385.  
  386. client.trace_bullet
  387. syntax: client.trace_bullet(from_player, from_x, from_y, from_z, to_x, to_y, to_z)
  388. from_player - Entity index of the player whose weapon will be used for this trace
  389. from_x - Position in world space
  390. from_y - Position in world space
  391. from_z - Position in world space
  392. to_x - Position in world space
  393. to_y - Position in world space
  394. to_z - Position in world space
  395. Returns entindex, damage. Entindex is nil when no player is hit.
  396. Back to TOC
  397.  
  398. client.scale_damage
  399. syntax: client.scale_damage(entindex, hitgroup, damage)
  400. entindex - Player entity index
  401. hitgroup - Hit group index
  402. damage - Damage
  403. Returns adjusted damage for the specified hitgroup
  404. Back to TOC
  405.  
  406. client.delay_call
  407. syntax: client.delay_call(delay, callback, ...)
  408. delay - Time in seconds to wait before calling callback.
  409. callback - The lua function that will be called after delay seconds.
  410. ... - Optional arguments that will be passed to the callback.
  411. Back to TOC
  412.  
  413. client.latency
  414. syntax: client.latency()
  415. Returns your latency in seconds.
  416. Back to TOC
  417.  
  418. client.camera_angles
  419. syntax: client.camera_angles()
  420. Returns pitch, yaw, roll of where you are looking.
  421. Back to TOC
  422.  
  423. client.camera_angles
  424. syntax: client.camera_angles(pitch, yaw)
  425. pitch - Pitch
  426. yaw - Yaw
  427. Set camera angles
  428. Back to TOC
  429.  
  430. client.timestamp
  431. syntax: client.timestamp()
  432. Returns high precision timestamp in milliseconds.
  433. Back to TOC
  434.  
  435. client.eye_position
  436. syntax: client.eye_position()
  437. Returns x, y, z world coordinates of the local player's eye position, or nil on failure.
  438. Back to TOC
  439.  
  440. client.set_clan_tag
  441. syntax: client.set_clan_tag(...)
  442. ... - The text that will be drawn
  443. 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.
  444. Back to TOC
  445.  
  446. client.system_time
  447. syntax: client.system_time()
  448. Returns hour, minute, seconds, milliseconds.
  449. local h, m, s, ms = client.system_time()
  450. Back to TOC
  451.  
  452. client.reload_active_scripts
  453. syntax: client.reload_active_scripts()
  454. Reloads all scripts the following frame.
  455. Back to TOC
  456.  
  457. ui.new_checkbox
  458. syntax: ui.new_checkbox(tab, container, name)
  459. tab - The name of the tab: AA, RAGE, LEGIT, MISC, PLAYERS, SKINS, or VISUALS.
  460. container - The name of the existing container to which this control will be added.
  461. name - The name of the checkbox.
  462. Returns a special value that can be passed to ui.get and ui.set, or throws an error on failure.
  463. Back to TOC
  464.  
  465. ui.new_slider
  466. syntax: ui.new_slider(tab, container, name, min, max, init_value, show_tooltip, unit, scale, tooltips)
  467. tab - The name of the tab: AA, RAGE, LEGIT, MISC, PLAYERS, SKINS, or VISUALS.
  468. container - The name of the existing container to which this control will be added.
  469. name - The name of the slider.
  470. min - The minimum value that can be set using the slider.
  471. max - The maximum value that can be set using the slider.
  472. init_value - Optional integer. The initial value. If not provided, the initial value will be min.
  473. show_tooltip - Optional boolean. true if the slider should display its current value.
  474. 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.
  475. 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.
  476. 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.
  477. Returns a special value that can be passed to ui.get and ui.set, or throws an error on failure.
  478. Back to TOC
  479.  
  480. ui.new_combobox
  481. syntax: ui.new_combobox(tab, container, name, ...)
  482. tab - The name of the tab: AA, RAGE, LEGIT, MISC, PLAYERS, SKINS, or VISUALS.
  483. container - The name of the existing container to which this control will be added.
  484. name - The name of the combobox.
  485. ... - One or more comma separated string values that will be added to the combobox. Alternatively, a table of strings that will be added.
  486. Returns a special value that can be passed to ui.get and ui.set, or throws an error on failure.
  487. Back to TOC
  488.  
  489. ui.new_multiselect
  490. syntax: ui.new_multiselect(tab, container, name, ...)
  491. tab - The name of the tab: AA, RAGE, LEGIT, MISC, PLAYERS, SKINS, or VISUALS.
  492. container - The name of the existing container to which this control will be added.
  493. name - The name of the multiselect.
  494. ... - One or more comma separated string values that will be added to the combobox. Alternatively, a table of strings that will be added.
  495. Returns a special value that can be passed to ui.get and ui.set, or throws an error on failure.
  496. Back to TOC
  497.  
  498. ui.new_hotkey
  499. syntax: ui.new_hotkey(tab, container, name, inline)
  500. tab - The name of the tab: AA, RAGE, LEGIT, MISC, PLAYERS, SKINS, or VISUALS.
  501. container - The name of the existing container to which this control will be added.
  502. name - The name of the hotkey.
  503. inline - Optional boolean. If set to true, the hotkey will be placed to the right of the preceding menu item.
  504. Returns a special value that can be passed to ui.get to see if the hotkey is pressed, or throws an error on failure.
  505. Back to TOC
  506.  
  507. ui.new_button
  508. syntax: ui.new_button(tab, container, name, callback)
  509. tab - The name of the tab: AA, RAGE, LEGIT, MISC, PLAYERS, SKINS, or VISUALS.
  510. container - The name of the existing container to which this checkbox will be added.
  511. name - The name of the button.
  512. callback - The lua function that will be called when the button is pressed.
  513. Throws an error on failure. The return value should not be used with ui.set or ui.get.
  514. Back to TOC
  515.  
  516. ui.new_color_picker
  517. syntax: ui.new_color_picker(tab, container, name, r, g, b, a)
  518. tab - The name of the tab: AA, RAGE, LEGIT, MISC, PLAYERS, SKINS, or VISUALS.
  519. container - The name of the existing container to which this checkbox will be added.
  520. name - The name of the color picker. This will not be shown, it is only used to identify this item in saved configs.
  521. r - Optional initial red value (0-255)
  522. g - Optional initial green value (0-255)
  523. b - Optional initial blue value (0-255)
  524. a - Optional initial alpha value (0-255)
  525. Throws an error on failure. The color picker is placed to the right of the previous menu item.
  526. Back to TOC
  527.  
  528. ui.new_textbox
  529. syntax: ui.new_textbox(tab, container)
  530. tab - The name of the tab: AA, RAGE, LEGIT, MISC, PLAYERS, SKINS, or VISUALS.
  531. container - The name of the existing container to which this textbox will be added.
  532. Throws an error on failure. Returns a special value that can be used with ui.get
  533. Back to TOC
  534.  
  535. ui.reference
  536. syntax: ui.reference(tab, container, name)
  537. tab - The name of the tab: AA, RAGE, LEGIT, MISC, PLAYERS, SKINS, or VISUALS.
  538. container - The name of the existing container to which this checkbox will be added.
  539. name - The name of the menu item.
  540. 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.
  541. Back to TOC
  542.  
  543. ui.set
  544. syntax: ui.set(item, value, ...)
  545. item - The result of either ui.new_checkbox, ui.new_slider, or ui.reference.
  546. value - The value to which the menu item will be set.
  547. ... - Optional. For multiselect comboboxes, you may want to set more than one option.
  548. 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.
  549. Back to TOC
  550.  
  551. ui.get
  552. syntax: ui.get(item)
  553. item - The special value returned by ui.new_checkbox, ui.new_slider, ui.new_combobox, ui.new_hotkey, or ui.reference.
  554. 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.
  555. Back to TOC
  556.  
  557. ui.set_callback
  558. syntax: ui.set_callback(item, callback)
  559. item - The special value returned by ui.new_*. Do not try passing a reference to an existing menu item.
  560. 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.
  561. Back to TOC
  562.  
  563. ui.set_visible
  564. syntax: ui.set_visible(item, visible)
  565. item - A menu item reference.
  566. visible - Boolean. Pass false to hide the control from the menu.
  567. Back to TOC
  568.  
  569. ui.is_menu_open
  570. syntax: ui.is_menu_open()
  571. Returns true if the menu is currently open.
  572. Back to TOC
  573.  
  574. ui.mouse_position
  575. syntax: ui.mouse_position()
  576. Returns current mouse coordinates x, y
  577. Back to TOC
  578.  
  579. renderer.text
  580. syntax: renderer.text(x, y, r, g, b, a, flags, max_width, ...)
  581. x - Screen coordinate
  582. y - Screen coordinate
  583. r - Red (1-255)
  584. g - Green (1-255)
  585. b - Blue (1-255)
  586. a - Alpha (1-255)
  587. 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.
  588. max_width - Text will be clipped if it exceeds this width in pixels. Use 0 for no limit.
  589. ... - Text that will be drawn
  590. This can only be called from the paint callback.
  591. Back to TOC
  592.  
  593. renderer.measure_text
  594. syntax: renderer.measure_text(flags, ...)
  595. flags - "+" for large text, "-" for small text, or nil for normal sized text.
  596. ... - Text that will be measured
  597. Returns width, height. This can only be called from the paint callback.
  598. Back to TOC
  599.  
  600. renderer.rectangle
  601. syntax: renderer.rectangle(x, y, w, h, r, g, b, a)
  602. x - Screen coordinate
  603. y - Screen coordinate
  604. w - Width in pixels
  605. h - Height in pixels
  606. r - Red (1-255)
  607. g - Green (1-255)
  608. b - Blue (1-255)
  609. a - Alpha (1-255)
  610. This can only be called from the paint callback.
  611. Back to TOC
  612.  
  613. renderer.line
  614. syntax: renderer.line(xa, ya, xb, yb, r, g, b, a)
  615. xa - Screen coordinate of point A
  616. ya - Screen coordinate of point A
  617. xb - Screen coordinate of point B
  618. yb - Screen coordinate of point B
  619. r - Red (1-255)
  620. g - Green (1-255)
  621. b - Blue (1-255)
  622. a - Alpha (1-255)
  623. This can only be called from the paint callback.
  624. Back to TOC
  625.  
  626. renderer.gradient
  627. syntax: renderer.gradient(x, y, w, h, r1, g1, b1, a1, r2, g2, b2, a2, ltr)
  628. x - Screen coordinate
  629. y - Screen coordinate
  630. w - Width in pixels
  631. h - Height in pixels
  632. r1 - Red (1-255)
  633. g1 - Green (1-255)
  634. b1 - Blue (1-255)
  635. a1 - Alpha (1-255)
  636. r2 - Red (1-255)
  637. g2 - Green (1-255)
  638. b2 - Blue (1-255)
  639. a2 - Alpha (1-255)
  640. ltr - Left to right. Pass true for horizontal gradient, or false for vertical.
  641. This can only be called from the paint callback.
  642. Back to TOC
  643.  
  644. renderer.circle
  645. syntax: renderer.circle(x, y, r, g, b, a, radius, start_degrees, percentage)
  646. x - Screen coordinate
  647. y - Screen coordinate
  648. r - Red (1-255)
  649. g - Green (1-255)
  650. b - Blue (1-255)
  651. a - Alpha (1-255)
  652. radius - Radius of the circle in pixels.
  653. start_degrees - 0 is the right side, 90 is the bottom, 180 is the left, 270 is the top.
  654. percentage - Must be within [0.0-1.0]. 1.0 is a full circle, 0.5 is a half circle, etc.
  655. This can only be called from the paint callback.
  656. Back to TOC
  657.  
  658. renderer.circle_outline
  659. syntax: renderer.circle_outline(x, y, r, g, b, a, radius, start_degrees, percentage, thickness)
  660. x - Screen coordinate
  661. y - Screen coordinate
  662. r - Red (1-255)
  663. g - Green (1-255)
  664. b - Blue (1-255)
  665. a - Alpha (1-255)
  666. radius - Radius of the circle in pixels.
  667. start_degrees - 0 is the right side, 90 is the bottom, 180 is the left, 270 is the top.
  668. percentage - Must be within [0.0-1.0]. 1.0 is a full circle, 0.5 is a half circle, etc.
  669. thickness - Thickness of the outline in pixels.
  670. This can only be called from the paint callback.
  671. Back to TOC
  672.  
  673. renderer.triangle
  674. syntax: renderer.triangle(x0, y0, x1, y1, x2, y2, r, g, b, a)
  675. x0 - Screen coordinate X for point A
  676. y0 - Screen coordinate Y for point A
  677. x1 - Screen coordinate X for point B
  678. y1 - Screen coordinate Y for point B
  679. x2 - Screen coordinate X for point C
  680. y2 - Screen coordinate Y for point C
  681. r - Red (1-255)
  682. g - Green (1-255)
  683. b - Blue (1-255)
  684. a - Alpha (1-255)
  685. This can only be called from the paint callback.
  686. Back to TOC
  687.  
  688. renderer.world_to_screen
  689. syntax: renderer.world_to_screen(x, y, z)
  690. x - Position in world space
  691. y - Position in world space
  692. z - Position in world space
  693. 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.
  694. Back to TOC
  695.  
  696. renderer.indicator
  697. syntax: renderer.indicator(r, g, b, a, ...)
  698. r - Red (1-255)
  699. g - Green (1-255)
  700. b - Blue (1-255)
  701. a - Alpha (1-255)
  702. ... - The text that will be drawn
  703. Returns the Y screen coordinate (vertical offset) of the drawn text, or nil on failure. This can only be called from the paint callback.
  704. Back to TOC
  705.  
  706. renderer.texture
  707. syntax: renderer.texture(id, x, y, w, h, r, g, b, a)
  708. id - Texture ID
  709. x - X screen coordinate
  710. y - Y screen coordinate
  711. w - Width
  712. h - Height
  713. r - Red (0-255)
  714. g - Green (0-255)
  715. b - Blue (0-255)
  716. a - Alpha (0-255)
  717. Back to TOC
  718.  
  719. renderer.load_svg
  720. syntax: renderer.load_svg(contents, width, height)
  721. contents - SVG file contents
  722. width - Width
  723. height - Height
  724. Returns a texture ID that can be used with renderer.texture, or nil on failure
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement