Behavior, CMCommon, ScriptingEngine, CMObject, Contingent, Modifiable, MsgListener, Tickable, java.lang.Cloneable, java.lang.Comparable<CMObject>public class Scriptable extends StdBehavior implements ScriptingEngine
ScriptingEngine.ScriptLn, ScriptingEngine.SubScript| Modifier and Type | Field | Description |
|---|---|---|
protected ScriptingEngine |
engine |
CAN_AREAS, CAN_EXITS, CAN_ITEMS, CAN_MOBS, CAN_ROOMS, FLAG_LEGALBEHAVIOR, FLAG_MOBILITY, FLAG_POTENTIALLYAGGRESSIVE, FLAG_POTENTIALLYAUTODEATHING, FLAG_TROUBLEMAKINGidConverterCONNECTOR_AND, CONNECTOR_ANDNOT, CONNECTOR_MAP, CONNECTOR_NOT, CONNECTOR_OR, CONNECTOR_ORNOT, CONNECTORS, DATETIME_ARGS, funcs, methods, progs, SIGN_EQGT, SIGN_EQLT, SIGN_EQUL, SIGN_GRAT, SIGN_GTEQ, SIGN_LEST, SIGN_LTEQ, SIGN_NTEQ, SIGNS, SPECIAL_9SHOPHASPRICE, SPECIAL_NUM_OBJECTS, SPECIAL_RANDANYONE, SPECIAL_RANDPCCODES, isSavableBehavior, parmsSTATUS_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| Constructor | Description |
|---|---|
Scriptable() |
| Modifier and Type | Method | Description |
|---|---|---|
java.lang.String |
accountForYourself() |
Returns a string describing what this behavior does.
|
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.
|
protected int |
canImproveCode() |
|
CMObject |
copyOf() |
Similar to Cloneable.clone(), but does its best to make sure that
any internal objects to this class are also copyOfed.
|
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).
|
protected ScriptingEngine |
engine() |
|
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.
|
void |
executeMsg(Environmental affecting,
CMMsg msg) |
The general message event handler for the object.
|
java.util.List<java.lang.String> |
externalFiles() |
Returns a string list of any external files which
may be required to make this ability work.
|
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 |
getParms() |
Returns the raw parameter string for this behavior.
|
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.
|
int |
getTickStatus() |
A coded status for this object during the period where
its tick method is being called.
|
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.
|
java.lang.String |
ID() |
The CoffeeMud Java Class ID shared by all instances of
this object.
|
boolean |
isFunc(java.lang.String named) |
Returns whether the script has a function with the given name.
|
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.
|
boolean |
okMessage(Environmental host,
CMMsg msg) |
The general message event previewer for the object.
|
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) |
Called after a behavior is added to an Environmental 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 |
setParms(java.lang.String newParms) |
Sets the raw parameter string for this behavior.
|
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).
|
boolean |
tick(Tickable ticking,
int tickID) |
this is the method which is called periodically by the threading engine.
|
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.
|
initializeClass, newInstanceclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitisSavable, setSavableamDestroyed, canActAtAll, canFreelyBehaveNormal, canImprove, canImprove, compareTo, destroy, endBehavior, flags, getBehaversMOB, getBehaversRoom, getCodeNum, getInternalCodeNum, getSaveStatIndex, getStat, getStatCodes, grantsAggressivenessTo, I, initializeClass, isSavable, isStat, L, name, newInstance, parmsFormat, sameAs, setSavable, setStat, startBehaviorprotected ScriptingEngine engine
public java.lang.String ID()
CMObjectID in interface CMObjectID in class StdBehaviorprotected int canImproveCode()
canImproveCode in class StdBehaviorprotected ScriptingEngine engine()
public java.lang.String accountForYourself()
BehavioraccountForYourself in interface BehavioraccountForYourself in class StdBehaviorpublic int getTickStatus()
TickablegetTickStatus in interface TickablegetTickStatus in class StdBehaviorTickable.tick(Tickable, int)public void registerDefaultQuest(java.lang.Object questName)
BehaviorregisterDefaultQuest in interface BehaviorregisterDefaultQuest in interface ScriptingEngineregisterDefaultQuest in class StdBehaviorquestName - the Quest nameQuestpublic MOB getMakeMOB(Tickable ticking)
ScriptingEnginegetMakeMOB in interface ScriptingEngineticking - the scripted object to make a fake mob out ofpublic boolean endQuest(PhysicalAgent hostObj, MOB mob, java.lang.String quest)
ScriptingEngineendQuest in interface ScriptingEnginehostObj - the scripted objectmob - a mob representation of the host objectquest - the name of the quest being endedpublic boolean stepQuest(PhysicalAgent hostObj, MOB mob, java.lang.String quest)
ScriptingEnginestepQuest in interface ScriptingEnginehostObj - the scripted objectmob - a mob representation of the host objectquest - the name of the quest being endedpublic CMObject copyOf()
CMObjectcopyOf in interface CMObjectcopyOf in class StdBehaviorpublic java.util.List<java.lang.String> externalFiles()
BehaviorexternalFiles in interface BehaviorexternalFiles in interface ScriptingEngineexternalFiles in class StdBehaviorBehavior.setParms(String)public java.lang.String getScriptResourceKey()
ScriptingEnginegetScriptResourceKey in interface ScriptingEngineScriptingEngine.getScript()public java.lang.String getParms()
BehaviorgetParms in interface BehaviorgetParms in class StdBehaviorBehavior.setParms(String)public java.lang.String[] parseEval(java.lang.String evaluable)
throws ScriptParseException
ScriptingEngineparseEval in interface ScriptingEngineevaluable - the eval expressionScriptParseException - a parse errorpublic void setParms(java.lang.String newParms)
BehaviorsetParms in interface BehaviorsetParms in class StdBehaviornewParms - the parameter string for this behaviorBehavior.getParms()public java.lang.String getVar(java.lang.String context,
java.lang.String variable)
ScriptingEnginegetVar in interface ScriptingEnginecontext - the context of the variable, usually a mob or object namevariable - the name of the variableScriptingEngine.setVarScope(String),
ScriptingEngine.getVarScope(),
ScriptingEngine.setVar(String, String, String),
ScriptingEngine.isVar(String, String),
ScriptingEngine.getLocalVarXML(),
ScriptingEngine.setLocalVarXML(String)public boolean isVar(java.lang.String context,
java.lang.String variable)
ScriptingEngineisVar in interface ScriptingEnginecontext - the context of the variable, usually a mob or object namevariable - the name of the variableScriptingEngine.setVarScope(String),
ScriptingEngine.getVarScope(),
ScriptingEngine.getVar(String, String),
ScriptingEngine.setVar(String, String, String),
ScriptingEngine.getLocalVarXML(),
ScriptingEngine.setLocalVarXML(String)public void setVar(java.lang.String context,
java.lang.String variable,
java.lang.String value)
ScriptingEnginesetVar in interface ScriptingEnginecontext - the context of the variable, usually a mob or object namevariable - the name of the variablevalue - the value of the variableScriptingEngine.setVarScope(String),
ScriptingEngine.getVarScope(),
ScriptingEngine.getVar(String, String),
ScriptingEngine.isVar(String, String),
ScriptingEngine.getLocalVarXML(),
ScriptingEngine.setLocalVarXML(String)public java.lang.String defaultQuestName()
ScriptingEnginedefaultQuestName in interface ScriptingEngineScriptingEngine.registerDefaultQuest(Object)public void setVarScope(java.lang.String scope)
ScriptingEnginesetVarScope in interface ScriptingEnginescope - the scope of variablesScriptingEngine.getVarScope(),
ScriptingEngine.getVar(String, String),
ScriptingEngine.getLocalVarXML()public java.lang.String getVarScope()
ScriptingEnginegetVarScope in interface ScriptingEngineScriptingEngine.setVarScope(String),
ScriptingEngine.setVar(String, String, String),
ScriptingEngine.setLocalVarXML(String)public java.lang.String getLocalVarXML()
ScriptingEnginegetLocalVarXML in interface ScriptingEngineScriptingEngine.setVarScope(String),
ScriptingEngine.setVar(String, String, String),
ScriptingEngine.setLocalVarXML(String)public void setLocalVarXML(java.lang.String xml)
ScriptingEnginesetLocalVarXML in interface ScriptingEnginexml - the local variable values as xmlScriptingEngine.getVarScope(),
ScriptingEngine.getVar(String, String),
ScriptingEngine.getLocalVarXML()public 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)
ScriptingEngineeval in interface ScriptingEnginescripted - 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.public java.lang.String getScript()
ScriptingEnginegetScript in interface ScriptingEngineScriptingEngine.setScript(String),
ScriptingEngine.externalFiles()public void setScript(java.lang.String newParms)
ScriptingEnginesetScript in interface ScriptingEnginenewParms - the script or load command(s)ScriptingEngine.getScript(),
ScriptingEngine.externalFiles()public 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)
ScriptingEngineexecute in interface ScriptingEnginescripted - 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 variablespublic 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)
ScriptingEnginecallFunc in interface ScriptingEnginenamed - 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 variablespublic boolean isFunc(java.lang.String named)
ScriptingEngineisFunc in interface ScriptingEnginenamed - the FUNCTION_PROG to look forpublic void executeMsg(Environmental affecting, CMMsg msg)
MsgListenerexecuteMsg in interface MsgListenerexecuteMsg in class StdBehavioraffecting - either the initiator of the event, or the host of this objectmsg - the CMMsg that needs to be executedCMMsgpublic boolean okMessage(Environmental host, CMMsg msg)
MsgListenerokMessage in interface MsgListenerokMessage in class StdBehaviorhost - either the initiator of the event, or the host of this objectmsg - the CMMsg that wants to be executedCMMsg,
CMMsg.source()public boolean tick(Tickable ticking, int tickID)
Tickabletick in interface Tickabletick in class StdBehaviorticking - a reference to this Tickable objecttickID - the TICKID_ constant describing this periodic call, as defined in TickableTickable,
ServiceEngine,
TickableGrouppublic void dequeResponses()
ScriptingEnginedequeResponses in interface ScriptingEnginepublic 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)
ScriptingEnginevarify in interface ScriptingEnginesource - 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 parsepublic 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)
ScriptingEnginefunctify in interface ScriptingEnginescripted - 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 expression