java.lang.Cloneable
, CMCommon
, CMObject
, java.lang.Comparable<CMObject>
, MsgListener
, Tickable
DefaultScriptingEngine
, Scriptable
, ScriptableEverymob
public interface ScriptingEngine extends CMCommon, Tickable, MsgListener
Scriptable
Modifier and Type | Interface | Description |
---|---|---|
static class |
ScriptingEngine.ScriptLn |
Wrapper class for a standard parsed line of script,
which includes the full line of text, the parsed line,
and an optional helper object of any sort
|
static class |
ScriptingEngine.SubScript |
Wrapper class for a subscript, which consists of a trigger
and its requisite code.
|
Modifier and Type | Field | Description |
---|---|---|
static int |
CONNECTOR_AND |
index and equate for logical connector AND
|
static int |
CONNECTOR_ANDNOT |
index and equate for logical connector ANDNOT
|
static int[][] |
CONNECTOR_MAP |
A table to describe what happens when connectors are found sequentially (and and not or not and and, etc)
|
static int |
CONNECTOR_NOT |
index and equate for logical connector NOT
|
static int |
CONNECTOR_OR |
index and equate for logical connector OR
|
static int |
CONNECTOR_ORNOT |
index and equate for logical connector ORNOT
|
static java.lang.String[] |
CONNECTORS |
a list of logical connectors (and, or, etc)
|
static java.lang.String[] |
DATETIME_ARGS |
a list of the different parts of a time clock
|
static java.lang.String[] |
funcs |
String list of all valid mobprog functions for logical expressions or string functions
|
static java.lang.String[] |
methods |
String list of all valid mobprog commands
|
static java.lang.String[] |
progs |
String list of all valid trigger keywords
|
static int |
SIGN_EQGT |
Index and equate for =>
|
static int |
SIGN_EQLT |
Index and equate for =<
|
static int |
SIGN_EQUL |
Index and equate for ==
|
static int |
SIGN_GRAT |
Index and equate for >
|
static int |
SIGN_GTEQ |
Index and equate for >=
|
static int |
SIGN_LEST |
Index and equate for <
|
static int |
SIGN_LTEQ |
Index and equate for <=
|
static int |
SIGN_NTEQ |
Index and equate for !=
|
static java.lang.String[] |
SIGNS |
List of evaluation signs ==, !=, >, etc.
|
static int |
SPECIAL_9SHOPHASPRICE |
The index into the local variables array for a random items shop price from shophas
|
static int |
SPECIAL_NUM_OBJECTS |
The number of local variables associated with an execution of a script
|
static int |
SPECIAL_RANDANYONE |
The index into the local variables array for a random pc or mob
|
static int |
SPECIAL_RANDPC |
The index into the local variables array for a random pc
|
idConverter
STATUS_AFFECT, STATUS_ALIVE, STATUS_BEHAVIOR, STATUS_CLASS, STATUS_DEAD, STATUS_END, STATUS_FIGHT, STATUS_MISC, STATUS_MISC2, STATUS_MISC3, STATUS_MISC4, STATUS_MISC5, STATUS_MISC6, STATUS_MISC7, STATUS_NOT, STATUS_OTHER, STATUS_RACE, STATUS_REBIRTH, STATUS_SCRIPT, STATUS_START, STATUS_WEATHER, TICKID_AREA, TICKID_BALLISTICK, TICKID_CLAN, TICKID_CLANITEM, TICKID_DEADBODY_DECAY, TICKID_ELECTRONICS, TICKID_EMAIL, TICKID_EVENT, TICKID_EXIT_BEHAVIOR, TICKID_EXIT_REOPEN, TICKID_ITEM_BEHAVIOR, TICKID_ITEM_BOUNCEBACK, TICKID_LIGHT_FLICKERS, TICKID_LIVEAUCTION, TICKID_LONGERMASK, TICKID_MISCELLANEOUS, TICKID_MOB, TICKID_PROPERTY_SPECIAL, TICKID_QUEST, TICKID_READYTOSTOP, TICKID_ROOM_BEHAVIOR, TICKID_ROOM_ITEM_REJUV, TICKID_SHORTERMASK, TICKID_SOLITARYMASK, TICKID_SPECIALCOMBAT, TICKID_SPECIALMANEUVER, TICKID_SPELL_AFFECT, TICKID_SUPPORT, TICKID_TIMEAUCTION, TICKID_TRAP_DESTRUCTION, TICKID_TRAP_RESET
Modifier and Type | Method | Description |
---|---|---|
java.lang.String |
callFunc(java.lang.String named,
java.lang.String parms,
PhysicalAgent scripted,
MOB source,
Environmental target,
MOB monster,
Item primaryItem,
Item secondaryItem,
java.lang.String msg,
java.lang.Object[] tmp) |
Called a func with the given name, sending the given parms, and returning its
return value, if any, or null.
|
java.lang.String |
defaultQuestName() |
If this script is associated with a particular quest, this
method is called to return that quest name.
|
void |
dequeResponses() |
Forces any queued event responses to be immediately
executed.
|
boolean |
endQuest(PhysicalAgent hostObj,
MOB mob,
java.lang.String quest) |
Calling this method forces this script to look for a trigger
dealing with the end of a quest (QUEST_TIME_PROG * -2).
|
boolean |
eval(PhysicalAgent scripted,
MOB source,
Environmental target,
MOB monster,
Item primaryItem,
Item secondaryItem,
java.lang.String msg,
java.lang.Object[] tmp,
java.lang.String[][] eval,
int startEval) |
Evaluates a scripting function.
|
java.lang.String |
execute(PhysicalAgent scripted,
MOB source,
Environmental target,
MOB monster,
Item primaryItem,
Item secondaryItem,
ScriptingEngine.SubScript script,
java.lang.String msg,
java.lang.Object[] tmp) |
Executes a script in response to an event
The scripts are formatted as a SubScript class.
|
java.util.List<java.lang.String> |
externalFiles() |
If the script is a load command, this will return the
list of loaded script files referenced by the load command
|
java.lang.String |
functify(PhysicalAgent scripted,
MOB source,
Environmental target,
MOB monster,
Item primaryItem,
Item secondaryItem,
java.lang.String msg,
java.lang.Object[] tmp,
java.lang.String evaluable) |
Evaluates one of the boolean functions as a string
variable expression, which gives different and
informative results.
|
java.lang.String |
getLocalVarXML() |
If the variable scope of this script is local, this will return all the variables
and values defined as an xml document for easy storage.
|
MOB |
getMakeMOB(Tickable ticking) |
Creates a mob from the Tickable object sent, possibly saving it
locally to this object for use later.
|
java.lang.String |
getScript() |
Returns the script or load command(s).
|
java.lang.String |
getScriptResourceKey() |
Returns the hey used to cache the script or load commands in here.
|
java.lang.String |
getVar(java.lang.String context,
java.lang.String variable) |
Returns the value of one of the internal variables, determined by the scope
of the script, the context of the variable, and the name of the variable.
|
java.lang.String |
getVarScope() |
Returns the scope of any variables defined within the script.
|
boolean |
isFunc(java.lang.String named) |
Returns whether the script has a function with the given name.
|
boolean |
isSavable() |
Returns whether this script is a temporary attributed of the scripted object,
or a permanent on that should be saved with the object.
|
boolean |
isVar(java.lang.String context,
java.lang.String variable) |
Returns whether an internal variables, determined by the scope
of the script, the context of the variable, and the name of the variable, is defined.
|
java.lang.String[] |
parseEval(java.lang.String evaluable) |
Receives a string for evaluation by the eval function, and stores
it as the first element in the given 2 dimensional string array.
|
void |
registerDefaultQuest(java.lang.Object questName) |
If this script is associated with a particular quest, this
method is called to register that quest name or object.
|
void |
setLocalVarXML(java.lang.String xml) |
If the variable scope of this script is local, this will set all the variables
and values defined from a passed in xml document.
|
void |
setSavable(boolean truefalse) |
Sets whether this script is a temporary attributed of the scripted object,
or a permanent on that should be saved with the object.
|
void |
setScript(java.lang.String newParms) |
Sets the script or load command(s).
|
void |
setVar(java.lang.String context,
java.lang.String variable,
java.lang.String value) |
Sets the value of one of the internal variables, determined by the scope
of the script, the context of the variable, and the name of the variable.
|
void |
setVarScope(java.lang.String scope) |
Sets the scope of any variables defined within the script.
|
boolean |
stepQuest(PhysicalAgent hostObj,
MOB mob,
java.lang.String quest) |
Calling this method forces this script to look for a trigger
dealing with the end of a quest step (QUEST_TIME_PROG * -1).
|
java.lang.String |
varify(MOB source,
Environmental target,
PhysicalAgent scripted,
MOB monster,
Item primaryItem,
Item secondaryItem,
java.lang.String msg,
java.lang.Object[] tmp,
java.lang.String varifyable) |
Uses this scripting engines variable parsing system to replace
any script variables $XXXX with their script determined values.
|
copyOf, ID, initializeClass, newInstance
executeMsg, okMessage
getTickStatus, name, tick
static final int SPECIAL_NUM_OBJECTS
static final int SPECIAL_RANDPC
static final int SPECIAL_RANDANYONE
static final int SPECIAL_9SHOPHASPRICE
static final java.lang.String[] progs
static final java.lang.String[] funcs
static final java.lang.String[] methods
static final java.lang.String[] DATETIME_ARGS
static final java.lang.String[] SIGNS
static final int SIGN_EQUL
static final int SIGN_GTEQ
static final int SIGN_GRAT
static final int SIGN_LEST
static final int SIGN_LTEQ
static final int SIGN_EQGT
static final int SIGN_EQLT
static final int SIGN_NTEQ
static final java.lang.String[] CONNECTORS
static final int CONNECTOR_AND
static final int CONNECTOR_OR
static final int CONNECTOR_NOT
static final int CONNECTOR_ANDNOT
static final int CONNECTOR_ORNOT
static final int[][] CONNECTOR_MAP
java.lang.String execute(PhysicalAgent scripted, MOB source, Environmental target, MOB monster, Item primaryItem, Item secondaryItem, ScriptingEngine.SubScript script, java.lang.String msg, java.lang.Object[] tmp)
scripted
- the object that is scriptedsource
- the source of the eventtarget
- the target of the eventmonster
- a mob representation of the scripted objectprimaryItem
- an item involved in the eventsecondaryItem
- a second item involved in the eventscript
- the script to executemsg
- a string message associated with the eventtmp
- miscellaneous local variablesjava.lang.String varify(MOB source, Environmental target, PhysicalAgent scripted, MOB monster, Item primaryItem, Item secondaryItem, java.lang.String msg, java.lang.Object[] tmp, java.lang.String varifyable)
source
- the source of the eventtarget
- the target of the eventscripted
- the object that is scriptedmonster
- a mob representation of the scripted objectprimaryItem
- an item involved in the eventsecondaryItem
- a second item involved in the eventmsg
- a string message associated with the eventtmp
- miscellaneous local variablesvarifyable
- the string to parsevoid dequeResponses()
MOB getMakeMOB(Tickable ticking)
ticking
- the scripted object to make a fake mob out ofjava.lang.String[] parseEval(java.lang.String evaluable) throws ScriptParseException
evaluable
- the eval expressionScriptParseException
- a parse errorboolean eval(PhysicalAgent scripted, MOB source, Environmental target, MOB monster, Item primaryItem, Item secondaryItem, java.lang.String msg, java.lang.Object[] tmp, java.lang.String[][] eval, int startEval)
scripted
- the object that is scriptedsource
- the source of the eventtarget
- the target of the eventmonster
- a mob representation of the scripted objectprimaryItem
- an item involved in the eventsecondaryItem
- a second item involved in the eventmsg
- a string message associated with the eventtmp
- miscellaneous local variableseval
- the pre-parsed expressionstartEval
- while line to start evaluating on.java.lang.String functify(PhysicalAgent scripted, MOB source, Environmental target, MOB monster, Item primaryItem, Item secondaryItem, java.lang.String msg, java.lang.Object[] tmp, java.lang.String evaluable)
scripted
- the object that is scriptedsource
- the source of the eventtarget
- the target of the eventmonster
- a mob representation of the scripted objectprimaryItem
- an item involved in the eventsecondaryItem
- a second item involved in the eventmsg
- a string message associated with the eventtmp
- miscellaneous local variablesevaluable
- the function expressionjava.lang.String callFunc(java.lang.String named, java.lang.String parms, PhysicalAgent scripted, MOB source, Environmental target, MOB monster, Item primaryItem, Item secondaryItem, java.lang.String msg, java.lang.Object[] tmp)
named
- the name of the FUNCTION_PROG to callparms
- parameters to send as $gscripted
- the object that is scriptedsource
- the source of the eventtarget
- the target of the eventmonster
- a mob representation of the scripted objectprimaryItem
- an item involved in the eventsecondaryItem
- a second item involved in the eventmsg
- a string message associated with the eventtmp
- miscellaneous local variablesboolean isFunc(java.lang.String named)
named
- the FUNCTION_PROG to look forboolean endQuest(PhysicalAgent hostObj, MOB mob, java.lang.String quest)
hostObj
- the scripted objectmob
- a mob representation of the host objectquest
- the name of the quest being endedboolean stepQuest(PhysicalAgent hostObj, MOB mob, java.lang.String quest)
hostObj
- the scripted objectmob
- a mob representation of the host objectquest
- the name of the quest being endedjava.lang.String getScript()
setScript(String)
,
externalFiles()
java.lang.String getScriptResourceKey()
getScript()
void setScript(java.lang.String newParms)
newParms
- the script or load command(s)getScript()
,
externalFiles()
java.util.List<java.lang.String> externalFiles()
getScript()
,
setScript(String)
void registerDefaultQuest(java.lang.Object questName)
questName
- the quest associated with this scriptdefaultQuestName()
java.lang.String defaultQuestName()
registerDefaultQuest(Object)
void setVarScope(java.lang.String scope)
scope
- the scope of variablesgetVarScope()
,
getVar(String, String)
,
getLocalVarXML()
java.lang.String getVarScope()
setVarScope(String)
,
setVar(String, String, String)
,
setLocalVarXML(String)
java.lang.String getLocalVarXML()
setVarScope(String)
,
setVar(String, String, String)
,
setLocalVarXML(String)
void setLocalVarXML(java.lang.String xml)
xml
- the local variable values as xmlgetVarScope()
,
getVar(String, String)
,
getLocalVarXML()
boolean isSavable()
setSavable(boolean)
void setSavable(boolean truefalse)
truefalse
- true if this script is a saveable attribute of the scripted objectisSavable()
java.lang.String getVar(java.lang.String context, java.lang.String variable)
context
- the context of the variable, usually a mob or object namevariable
- the name of the variablesetVarScope(String)
,
getVarScope()
,
setVar(String, String, String)
,
isVar(String, String)
,
getLocalVarXML()
,
setLocalVarXML(String)
boolean isVar(java.lang.String context, java.lang.String variable)
context
- the context of the variable, usually a mob or object namevariable
- the name of the variablesetVarScope(String)
,
getVarScope()
,
getVar(String, String)
,
setVar(String, String, String)
,
getLocalVarXML()
,
setLocalVarXML(String)
void setVar(java.lang.String context, java.lang.String variable, java.lang.String value)
context
- the context of the variable, usually a mob or object namevariable
- the name of the variablevalue
- the value of the variablesetVarScope(String)
,
getVarScope()
,
getVar(String, String)
,
isVar(String, String)
,
getLocalVarXML()
,
setLocalVarXML(String)