Fandom

SketchyPhysicsWiki

AccelVars

103pages on
this wiki
Add New Page
Talk0 Share

Script-level function included in LazyScript Plugin

setAccellVarEdit

Creating an accelleration variable is easy using this function, which works similarly to SP's native get/set var system.

setAccellVar(key, control, accell, decell)

e.g:

setAccellVar("My Var","joy('lefty')",0.01,0.001)

key identifies the variable. You need this to retrieve it, and you can't use the same key more than once. This can be a string or number.

control is the controller. You need to write the controller code as a string (in quotes). If you need to write quotes inside this field, use ' instead of ", or vice versa, and you must use the correct syntax for the controller (e.g "joy('lefty')" rather than "lefty")

accell is how fast the variable will increase with the controller. This must be a number.

decell is how fast the variable will decrease with the controller. This must be a number.


Using this command with a key that already exists allows you to change that variable's settings, e.g. increase/decrease the speed of acceleration.

getAccellVarEdit

Very simple command to use, retrieves the variable's value using the key you provide.

getAccellVar(key)

e.g:

getAccellVar("My Var")


Returns a value between 0 and 1, which will change as you accelerate / decelerate during the sim.

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.