Skip to content

Variable Methods

GodDragoner edited this page Apr 10, 2018 · 14 revisions

Variables

getVar(String variableName)

Gets the value of a variable.

Parameters: variableName - The name of the variable you want to get the current value of

Alias: checkVar, getDate, getVariable

Example: setVar("test", true);

if(getVar("test")) { sendMessage('Test'); }


setVar(String variableName, Object value)

Sets the value of a given variable.

Parameters: variableName - The name of the variable you want to set the current value of value - The value you want to assign to the variable

Alias: setVariable

Example:

setVar("someBoolean", true);

setVar("someNumber", 2);

setVar("someFloat", 5.5);

setVar("someString", "Hello world!");


setTempVar(String variableName, Object value)

Sets the value of a given variable temporary for this session only.

Parameters: variableName - The name of the variable you want to set the current value of value - The value you want to assign to the variable

Alias: setTempVariable

Example:

setTempVar("someBoolean", true);

setTempVar("someNumber", 2);

setTempVar("someFloat", 5.5);

setTempVar("someString", "Hello world!");


deleteVar(String variableName)

Deletes a given variable including its value not matter if the variable is temporary or not.

Parameters: variableName - The name of the variable you want to delete

Alias: delVar, deleteVariable

Example:

deleteVar("someBoolean");

deleteVar("someNumber");


setDate(String variableName)

Sets a given variable to the current date.

Parameters: variableName - The name of the variable you want to set to the current date

Example:

setDate("someDate");

date = getVar("someDate");

date.addMinute(5).addDay(5);

sendMessage(date.hasPassed()); -> Prints false

date.addDay(-6);

sendMessage(date.hasPassed()); -> Prints true


setTempDate(String variableName)

Sets a given variable to the current date temporary for this session only.

Parameters: variableName - The name of the variable you want to set to the current date

Example:

date = setTempDate("someDate");

date.addMinute(5).addDay(5);

sendMessage(date.hasPassed()); -> Prints false

date.addDay(-6);

sendMessage(date.hasPassed()); -> Prints true

Variables provided by the system

startDate -> The date at that the session started

prefSessionLength -> The amount of minutes that sub prefers as a session length

subName -> The name of the sub

domName -> The name of the dom

domFriend1Name -> The name of the first dom friend

domFriend2Name -> The name of the second dom friend

domFriend3Name -> The name of the third dom friend