public class KWScript
extends java.lang.Object
Scripting allows you to take kLoOge.Werks farther than you would otherwise be able to by allowing you to create short programs that can be applied to Maps, Icons or the global environment.
The scripting language that kLoOge.Werks employs is called BeanShell, which is a freely availble and extremely flexible scripting language. You can find documentation for this language at: http://www.beanshell.org.
What can you do with scripting? You can make Icons change visibility, move them around and have them target other Icons, for example. You can also write scripts that are notified of events like the game time changing, or the round changing. You can even create Icons, move them between Maps or off of all Maps. In short, scripting is fairly powerful.
What can't you do with scripting? Primarily, you can not track real time events (Icons moving or changing state, for example). Just about anything else, though, can be handled via creative scripting.
The methods described below cover every aspect of the program that you can access through scripting. These are diverse and granular, so a complete read is encouraged.
Examples are included with the distribution and are a good place to start when learning what does what and how scripts should be structured.
Scripts can either be assigned to an Icon, Map or the global environment, but they can also be referenced directly through a Game System Definition file. This is, perhaps, the most potent use of scripting, since scripts in the Definition can actually modify Icon rolls before they are parsed by the program.
Assigning scripts is done through the program's interface. Icons, Maps and the global environment can have scripts assigned. To do so, select the "Script Manager" menu item either by right-clicking on a Map or Icon, or from the "Actions" menu.
This brings up the Script Manager dialog. There can only be one of these dialogs open at a time. If you open it for an Icon, then want to manipulate another Icon's scripts, the dialog's contents will be replaced with that Icon's script lists. The same is true for Maps and globals.
The controls of the Script Manager dialog are a little daunting, but every one has a tooltip that instructs you as to what the button does. You also have access to a popup menu by right-clicking on the script icon. This menu can be augmented by the scripts themselves, so be aware that added functionality may lurk there.
One final note to keep in mind -- scripting is programming. When programming errors occur, the program misbehaves. You can, quite easily, disrupt kLoOge.Werks with a script. You can cause it to crash, corrupt campaign files and, generally, make your life miserable. Additionally, the error messages that scripts generate are quite often misleading or completely uninformative.
As a result, consider yourself warned -- writing scripts is not for the faint of heart. If you trash your campaign file or cause the program to crash or become unresponsive, you are pretty much on your own. We will not be able to recover your campaign. We may be able to help you diagnose your script errors, but we by no means guarantee that we can (or that we will even try).
If you start down this path, consider yourself on your own. If that bothers you, then don't write scripts. Period.
There are always some adventurous types who are willing to brave these uncertain waters, and it is for them that scripting was implemented. Hopefully, the fruits of their labors will be passed on to the community at large, so others can benefit from their perseverance.
Modifier and Type | Field and Description |
---|---|
static CSParser |
csp |
static java.lang.String |
Effect_Unchanged
Flag to indicate that a field of an Effect should be left unchanged.
|
static int |
Face_East
Flag representing an Icon's facing direction.
|
static int |
Face_None
Flag representing an Icon's facing direction.
|
static int |
Face_North
Flag representing an Icon's facing direction.
|
static int |
Face_Northeast
Flag representing an Icon's facing direction.
|
static int |
Face_Northwest
Flag representing an Icon's facing direction.
|
static int |
Face_South
Flag representing an Icon's facing direction.
|
static int |
Face_Southeast
Flag representing an Icon's facing direction.
|
static int |
Face_Southwest
Flag representing an Icon's facing direction.
|
static int |
Face_West
Flag representing an Icon's facing direction.
|
static boolean |
IE_Active
Icon Effect property - Effect is active (enabled)
|
static java.lang.String |
IE_DescOnly
Icon Effect property - Description only visible to Players
|
static int |
IE_Encounter
Icon Effect property - Expire at end of encounter
|
static int |
IE_End
Icon Effect property - Expire on end of turn
|
static boolean |
IE_NoRemoveWhenExpired
Icon Effect property - Do not remove Effect after expiration
|
static boolean |
IE_NoSaveToEnd
Icon Effect property - Do not "save" to end the Effect
|
static java.lang.String |
IE_NoShow
Icon Effect property - Not visible to Players
|
static boolean |
IE_NotActive
Icon Effect property - Effect is not active (disabled)
|
static boolean |
IE_RemoveWhenExpired
Icon Effect property - Remove Effect after expiration
|
static boolean |
IE_SaveToEnd
Icon Effect property - "Save" to end the Effect
|
static java.lang.String |
IE_Show
Icon Effect property - Visible to Players
|
static int |
IE_Start
Icon Effect property - Expire on start of turn
|
static int |
IT_Adventure
Flag representing a type of Icon.
|
static int |
IT_Character
Flag representing a type of Icon.
|
static int |
IT_Doc
Flag representing a type of Icon.
|
static int |
IT_Image
Flag representing a type of Icon.
|
static int |
IT_Item
Flag representing a type of Icon.
|
static int |
IT_Map
Flag representing a type of Icon.
|
static int |
IT_Movie
Flag representing a type of Icon.
|
static int |
IT_NPC
Flag representing a type of Icon.
|
static int |
IT_Sound
Flag representing a type of Icon.
|
static java.lang.String |
SOUND_EVENT_PROPERTY
Property to set when sound events should be received.
|
static int |
ST_Client
Flag to indicate that this script is intended to run on a Client.
|
static int |
ST_Def
Flag to indicate that this script is intended to be run from the
definition file.
|
static int |
ST_Global
Flag to indicate that this is a global script.
|
static int |
ST_Icon
Flag to indicate that this script is intended to be associated
with an Icon.
|
static int |
ST_Map
Flag to indicate that this script is intended to be associated
with a Map.
|
static int |
ST_Master
Flag to indicate that this script is intended to run on the Master.
|
Modifier and Type | Method and Description |
---|---|
static void |
addCalendarEventListener(CalendarListener l)
Adds the supplied
CalendarListener to the list of things
interested in receiving calendar event messages. |
static void |
addCampaignTab(java.lang.String title,
javax.swing.Icon icon,
java.awt.Component c,
java.lang.String tip)
Adds a tab pane to the "campaign" area of the main interface.
|
static void |
addClientEventListener(ClientListener l)
Adds the supplied
ClientListener to the list of things
interested in receiving Client event messages. |
static void |
addCombatEventListener(CombatListener l)
Adds the supplied
CombatListener to the list of things
interested in receiving combat event messages. |
static java.lang.String |
addDataLocation(java.lang.String f)
Add the program's data location to the supplied string.
|
static void |
addIconEffect(java.lang.Object o,
java.lang.String desc,
int end,
java.lang.Object endIcon,
java.lang.String show,
boolean active,
boolean removeWhenExpired,
boolean saveToEnd,
java.lang.String mods)
Add an effect to the specified Icon.
|
static void |
addIconEffect(java.lang.Object o,
java.lang.String desc,
java.lang.String duration,
java.lang.String remaining,
java.lang.String show,
boolean active,
boolean removeWhenExpired,
boolean saveToEnd,
java.lang.String mods)
Add an effect to the specified Icon.
|
static void |
addIconEffect(java.lang.Object o,
java.lang.String desc,
java.lang.String duration,
java.lang.String remaining,
java.lang.String show,
boolean active,
java.lang.String mods)
Add an effect to the specified Icon.
|
static void |
addIconEventListener(IconListener l)
Adds the supplied
IconListener to the list of things
interested in receiving Icon event messages. |
static void |
addLine(java.lang.String s)
Deprecated.
As of 3.1.0 this method has been deprecated and will no longer
perform any function. Instead, use the
startBlock and
finishBlock methods to perform the duties that this method
was intended to perform. |
static void |
addMapEventListener(MapListener l)
Adds the supplied
MapListener to the list of things
interested in receiving Map event messages. |
static void |
addMapPanel(java.lang.String title,
javax.swing.Icon icon,
java.awt.Component c,
java.lang.String tip)
Adds a tab pane to the "map" area of the main interface.
|
static void |
addMenuItem(javax.swing.JMenuItem mi)
Adds the supplied
JMenuItem to the application's menu
bar. |
static boolean |
addNote(java.lang.Object o,
java.lang.String title,
java.lang.String text,
boolean append)
Adds a note to the Icon's character sheet.
|
static void |
addPendingDamage(java.lang.Object o,
java.lang.Object o2,
java.lang.Object de,
int amt)
Add a pending hit point adjustment to an Icon.
|
static void |
addPropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
Add a script event property change listener.
|
static void |
addScriptListener(ScriptListener sl)
Adds the supplied
ScriptListener to the list of things
interested in receiving script event messages. |
static void |
addTag(java.lang.String tag,
boolean value)
Add a tag/value pair to a script's XML save data.
|
static void |
addTag(java.lang.String tag,
java.awt.Color v)
Add a tag/value pair to a script's XML save data.
|
static void |
addTag(java.lang.String tag,
double value)
Add a tag/value pair to a script's XML save data.
|
static void |
addTag(java.lang.String tag,
int value)
Add a tag/value pair to a script's XML save data.
|
static void |
addTag(java.lang.String tag,
long value)
Add a tag/value pair to a script's XML save data.
|
static void |
addTag(java.lang.String tag,
java.lang.Object value)
Add a tag/value pair to a script's XML save data.
|
static void |
addTarget(java.lang.Object sobj,
java.lang.Object tobj)
Add an Icon to the source Icon's targeted list.
|
static void |
addToolbarButton(javax.swing.JButton button)
Adds the supplied button to the application's toolbar.
|
static void |
addVetoableChangeListener(java.lang.String propertyName,
java.beans.VetoableChangeListener listener)
Add a vetoable script event property change listener.
|
static void |
adjustHP(java.lang.Object o,
int[] delta,
int dmr)
Adjust the current hit points for the specified Icon.
|
static void |
adjustHP(java.lang.Object o,
int[] delta,
int[] dmr)
Adjust the current hit points for the specified Icon.
|
static void |
advanceInitiative()
Advances to the next initiative.
|
static void |
animateIcon(java.lang.Object o,
boolean b)
Deprecated.
As of 2.7.6 this method has been deprecated. Icons no longer have
an animated image.
|
static void |
applyPendingDamage(java.lang.Object o)
Apply any pending damage to the Icon.
|
static boolean |
armedRequired()
Check whether a weapon must be "armed" in order to be used.
|
static void |
bumpMinute(int delta)
Advance the game calendar's minute time by the amount supplied.
|
static java.awt.geom.Point2D |
captureMouseClick(java.lang.Object icon) |
static void |
centerOn(java.lang.Object o)
Center the display on an Icon.
|
static void |
centerOn(java.awt.geom.Point2D p)
Center the display on an arbitrary point.
|
static boolean |
charSheetLocked(java.lang.Object o)
Determine whether an Icon's character sheet is locked for editing.
|
static void |
chatMsg(java.lang.Object o,
java.lang.String msg)
A chat routine that allows you to issue, essentially, a "chat as"
message from an Icon.
|
static void |
chatMsg(java.lang.String msg)
A minimal routine to send a chat message to everyone.
|
static void |
chatMsgLocal(java.lang.String msg)
Issue a local chat message.
|
static void |
clearAllTargets(java.lang.Object o)
Remove all targets from an Icon's target list.
|
static void |
clearPendingDamage(java.lang.Object o)
Clear any pending damage for an Icon.
|
static void |
clientSendChatMsg(boolean special,
java.awt.Color c,
java.lang.String dmMsg,
java.lang.String cMsg,
boolean toAll)
Instruct the program (when running as a Client) to send a chat
message.
|
static java.lang.String |
colorToHex(java.awt.Color c)
Transform the suppliedd Color into a string hex representation appropriate for use
in an HTML string.
|
static boolean |
combatEngaged()
Tests whether combat is currently occuring.
|
static void |
configureCampaignTab(java.lang.String title,
javax.swing.Icon icon,
java.awt.Component c,
java.lang.String tip)
Alter the appearance of an already added "campaign" tab.
|
static void |
configureMapPanel(java.lang.String title,
javax.swing.Icon icon,
java.awt.Component c,
java.lang.String tip)
Alter the appearance of an already added "Map" tab.
|
static boolean |
controllIcon(java.lang.Object icon)
Take control of the supplied Icon.
|
static void |
copyIcon(java.lang.Object o)
Copies the supplied Icon to the program's paste buffer.
|
static void |
createDrawnItem(java.awt.geom.Rectangle2D bounds,
boolean square,
java.awt.Color fillColor,
java.awt.Color lineColor,
int opacity,
boolean visible,
java.lang.String name,
java.lang.String description)
Create a DrawnItem on the current Map.
|
static java.lang.Object |
createFileIcon(int type,
java.lang.String name,
java.lang.String file)
Create a new "file" Icon.
|
static java.lang.Object |
createNoteIcon(java.lang.String name,
java.lang.String note)
Create a new Note Icon.
|
static java.lang.Object |
createNPC(java.lang.String name,
java.lang.String[] images,
java.lang.String animImage,
int curImg,
java.lang.String charSheet)
Creates a new NPC Icon based on the supplied parameters.
|
static java.lang.Object |
createPC(java.lang.String name,
java.lang.String[] images,
java.lang.String animImage,
int curImg,
java.lang.String charSheet)
Creates a new PC Icon based on the supplied parameters.
|
static void |
endCombat()
End combat.
|
static boolean |
englishUnits()
Check whether the host program is operating with English units.
|
static java.lang.Object |
findExpr(java.lang.Object o,
java.lang.String s)
Search for an expression with the given raw label.
|
static boolean |
findExpression(java.lang.Object o,
java.lang.String s)
Determine if an expression with the supplied name exists for an Icon.
|
static java.lang.Object |
findIcon(long id)
Retrieve an Icon based on it's ID.
|
static java.lang.Object |
findIcon(java.lang.String name)
Searches the campaign tree for an Icon with the supplied name.
|
static boolean |
findNote(java.lang.Object o,
java.lang.String title)
Searches for a note on the Icon's character sheet with the given title.
|
static void |
finishBlock(java.lang.String tag)
End a block in a script's XML save data.
|
static void |
firePropertyChange(java.lang.String propertyName,
java.lang.Object oldValue,
java.lang.Object newValue)
This method should NOT be called by scripts!
That said, you can call this method to cause a property change event
to be fired.
|
static void |
fireScriptEvent(java.util.EventObject event)
Causes a
ScriptEvent to be issued to all listeners. |
static void |
fireVetoableChange(java.lang.String propertyName,
java.lang.Object oldValue,
java.lang.Object newValue)
This method should NOT be called by scripts!
That said, you can call this method to cause a property change event
to be fired.
|
static java.awt.Frame |
getAppFrame()
Returns the top-level application window.
|
static java.lang.Object |
getAssociatedIcon()
Retrieves the Icon that the currently open Script Manager dialog is
associated with.
|
static int |
getAttack()
Retrieve the current combat attack.
|
static java.lang.Object |
getCharacterSheetData(java.lang.Object o,
int row,
java.lang.String tag)
Retrieve a single field's data from an Icon's character sheet.
|
static java.lang.Object[] |
getCharacterSheetData(java.lang.Object o,
java.lang.String tag)
Retrieve the data contained in a table on an Icon's character sheet.
|
static int |
getCharacterSheetTableRows(java.lang.Object o,
java.lang.String tag)
Retrieve the number of rows in a particular table.
|
static java.lang.Object[] |
getClientList()
Retrieve an array of all the connected clients.
|
static java.lang.String |
getClientName(java.lang.String id)
Returns the session name of a Client.
|
static java.lang.Object[] |
getControlledIcons()
Retrieve an array of all the currently controlled Icons in the campaign.
|
static java.lang.Integer[] |
getCurrentHP(java.lang.Object o)
Retrieve an Icon's current number of hit points.
|
static int |
getCurrentIconImage(java.lang.Object o)
Retrieve the index of the supplied Icon's current image.
|
static java.lang.Object |
getCurrentIconTarget(java.lang.Object icon)
Retrieve the Icon that the supplied Icon has designated as the "current"
target.
|
static java.lang.Object |
getCurrentMap()
Retrieve a reference object that represents the current Map.
|
static java.lang.String |
getDay()
Retrieve the name of the current day of the week.
|
static int |
getDayOfMonth()
Retrieve the current day of the month.
|
static java.lang.String |
getDefID()
Retrieve the ID string for the currently loaded definition file.
|
static int |
getDPI()
Retrieves the current DPI (dots per inch) of the screen.
|
static java.lang.String |
getExpr(java.lang.Object expr)
Retrieve the expression to be parsed from an Expression object.
|
static boolean |
getExprIsCriticalHit(java.lang.Object de)
Deprecated.
As of 3.1.0 this method has been deprecated. Use the more
logically named method
isCriticalHit instead. |
static boolean |
getExprIsCriticalMiss(java.lang.Object de)
Deprecated.
As of 3.1.0 this method has been deprecated. Use the more
logically named method
isCriticalMiss instead. |
static boolean |
getExprIsHit(java.lang.Object de)
Deprecated.
As of 3.1.0 this method has been deprecated. Use the more
logically named method
isHit instead. |
static int |
getExprResult(java.lang.Object de)
Retrieve the result from an expression.
|
static java.lang.String |
getFieldData(java.lang.Object src,
java.lang.String id,
int row)
Retrieve the data contained in a field of a table for a particular Icon.
|
static java.lang.String |
getFieldModifiers(java.lang.Object icon,
int row,
java.lang.String tag)
Retrieve any modifiers that should be applied to an expression.
|
static java.lang.String |
getFieldModifiers(java.lang.Object o,
java.lang.Object field)
Retrieve any modifiers that should be applied to an expression.
|
static int |
getHour()
Retrieve the current hour of the day.
|
static int |
getHpAdjustment(java.lang.Object icon,
java.lang.String desc,
int amt,
java.lang.String fieldName)
Apply the program's special HP adjustment, if defined by the definition.
|
static java.awt.geom.Rectangle2D |
getIconBounds(java.lang.Object o)
Retrieve an Icon's current absolute bounds.
|
static java.awt.geom.Point2D |
getIconCenter(java.lang.Object o)
Retrieve the absolute center of an Icon.
|
static java.awt.Color |
getIconChatColor(java.lang.Object o)
Retrieve an Icon's custom chat color.
|
static java.lang.String |
getIconClass(java.lang.Object icon)
Retrieve an Icon's class.
|
static java.lang.String |
getIconController(java.lang.Object icon)
Get the ID of the player who is currently controlling an Icon.
|
static java.lang.Object[] |
getIconEffectNames(java.lang.Object o)
Retrieve a list of the Effects that are currently applied to an Icon.
|
static java.lang.Object[] |
getIconEffects(java.lang.Object o)
Retrieve a list of the Effects that currently belong to an Icon.
|
static java.lang.Object[] |
getIconEffectsForValue(java.lang.Object o)
Retrieve the list of the Effects that currently belong to an Icon.
|
static java.lang.Object |
getIconEffectValue(java.lang.Object effect,
java.lang.String key)
Retrieve a single value contained in an Icon Effect.
|
static int |
getIconFace(java.lang.Object o)
Retrieve an Icon's current facing direction.
|
static boolean |
getIconFriendly(java.lang.Object o)
Retrieve an whether an Icon is friendly.
|
static boolean |
getIconHeld(java.lang.Object o)
Retrieve an Icon's "held" state.
|
static boolean |
getIconHidden(java.lang.Object o)
Retrieve an Icon's hidden state.
|
static boolean |
getIconHostile(java.lang.Object o)
Retrieve an whether an Icon is hostile.
|
static long |
getIconID(java.lang.Object o)
Retrieve an Icon's unique ID.
|
static int |
getIconInitiative(java.lang.Object o)
Retrieve an Icon's initiative.
|
static java.awt.geom.Point2D |
getIconLocation(java.lang.Object o)
Retrieve an Icon's current absolute location.
|
static java.lang.Object |
getIconMap(java.lang.Object o)
Retrieve a reference to the Map that the supplied Icon is currently
located on.
|
static java.lang.String |
getIconName(java.lang.Object o)
Retrieve the name of an Icon.
|
static boolean |
getIconNeutral(java.lang.Object o)
Retrieve an whether an Icon is neutral.
|
static int |
getIconOpacity(java.lang.Object o)
Retrieve an Icon's current opacity.
|
static int |
getIconRotation(java.lang.Object o)
Retrieve an Icon's current rotation.
|
static java.lang.Object[] |
getIconsFromWell(int type)
Retrieves an array of objects representing the Icons of the supplied
type that are currently in the Campaign tree "well."
|
static double |
getIconSize(java.lang.Object o)
Retrieve an Icon's size.
|
static int |
getIconType(java.lang.Object o)
Retrieve an Icon's type.
|
static boolean |
getIconUserState(java.lang.Object o)
Retrieve an Icon's "user" state.
|
static boolean |
getIconVisibility(java.lang.Object o)
Retrieve an Icon's visible state.
|
static int |
getInitiative()
Retrieve the current combat initiative.
|
static java.lang.Object |
getInitiativeIcon()
Retrieve the Icon that is going on the current initiative.
|
static java.lang.Object[] |
getMapDeadIcons(java.lang.Object o)
Retrieve an array of Icons on the supplied Map that are considered to be
"dead."
|
static java.lang.Object[] |
getMapIcons(java.lang.Object o)
Returns an array of all the Icons on the supplied Map.
|
static java.awt.geom.Point2D |
getMapPoint(java.lang.Object o)
Retrieve the current location of the mouse on the current Map.
|
static int |
getMapZoom()
Retrieve the zoom level of the current Map.
|
static java.lang.Integer[] |
getMaxHP(java.lang.Object o)
Retrieve an Icon's maximum number of hit points.
|
static int |
getMinute()
Retrieve the current minute into the hour from the calendar.
|
static java.lang.String |
getModifiedFieldData(java.lang.Object src,
java.lang.String tag,
int row)
Retrieve the data contained in a field of a table for a particular Icon.
|
static java.lang.String |
getMonth()
Retrieve the name of the current month.
|
static int |
getNumHpFields()
Retrieve the number of hit point fields the current game system
supports.
|
static int |
getNumIconImages(java.lang.Object o)
Retrieve the number of static images associated with an Icon.
|
static java.awt.Color |
getRollColor(java.lang.String type)
Retrieve the color that the user has specified should be used for various roll types.
|
static java.lang.Object[] |
getRollTargets(java.lang.Object icon)
Retrieve the Icons that are targeted by the current roll.
|
static int |
getRound()
Retrieve the current combat round.
|
static java.lang.String |
getScriptFolder()
Retrieve the location where the program looks for scripts.
|
static java.lang.Object[] |
getSelectedIcons()
Returns an array of objects representing the currently selected Icons.
|
static java.lang.Object[] |
getSelectedIconsOnMap(java.lang.Object map)
Retrieve all the currently selected Icons on the supplied Map.
|
static java.lang.String |
getSessionName()
Retrieve your current session name.
|
static java.lang.Object[] |
getSoundFileNames()
Retrieve the list of sounds that are currently installed.
|
static java.util.ArrayList<java.lang.Object> |
getTabButtons(java.lang.Object icon)
Retrieve a list containing all the buttons on the current Dice Dialog tab.
|
static int |
getTableColumn(java.lang.String tableTag,
java.lang.String columnTag)
Retrieve the column index, based on a table's tag and the column's tag.
|
static java.lang.Object[] |
getTargeters(java.lang.Object o)
Retrieve an array of the Icons that are currently targeting this one.
|
static java.lang.Object[] |
getTargets(java.lang.Object icon)
Retrieve an array of all the Icons that this Icon is currently
targeting.
|
static double |
getThreatenedArea(java.lang.Object o)
Retrieve the area being threatened by this Icon.
|
static java.lang.Object[] |
getThreatenedIcons(java.lang.Object o)
Retrieve an array of Icons that this Icon is currently able to
threaten.
|
static java.awt.geom.Rectangle2D |
getViewportBounds()
Retrieve the bounds of the current Map as it appears in the
viewport.
|
static java.awt.geom.Point2D |
getViewportCenter()
Retrieve the center location of the current Map as it appears in the
viewport.
|
static java.lang.String |
getWorkingFolder()
Retrieve the folder that the program uses to retrive components required
to operate.
|
static java.lang.String |
getYear()
Retrieve the name of the current year.
|
static boolean |
healFromZero()
Determine if the definition supports the concept of "healing from zero."
What's that? If you don't know, then you'll probably have to wait to
see.
|
static void |
healIcon(java.lang.Object icon)
Increase an Icon's hit points to the point where it is considered to
be fully healed.
|
static boolean |
iconHasAnimImage(java.lang.Object o)
Deprecated.
As of 2.7.6 this method has been deprecated, since there is no longer
a distinction of an Icon having an animated image.
|
static boolean |
iconsHaveSameDisposition(java.lang.Object icon1,
java.lang.Object icon2)
Determine if two Icons have the same disposition.
|
static boolean |
isAffected(java.lang.Object icon,
java.lang.String desc)
Determine if an Icon is currently affected by the effect.
|
static boolean |
isClient()
Deprecated.
use isPlayer() instead.
|
static boolean |
isCriticalHit(java.lang.Object de)
Retrieve whether an expression resulted in a critical hit.
|
static boolean |
isCriticalMiss(java.lang.Object de)
Retrieve whether an expression resulted in a critical miss.
|
static boolean |
isGridSnapEnabled(java.lang.Object map)
Determines whether grid snap is enabled on the supplied map.
|
static boolean |
isHit(java.lang.Object de)
Retrieve whether an expression resulted in a hit.
|
static boolean |
isIcon(java.lang.Object o)
Test whether an Icon is an actionable Icon.
|
static boolean |
isIconAlive(java.lang.Object o)
Checks to see if an Icon is "alive."
|
static boolean |
isIconBloodied(java.lang.Object icon)
Retrieve whether an Icon is "bloodied" or not.
|
static boolean |
isIconControlled(java.lang.Object icon)
Determine if an Icon is currently being controlled by someone.
|
static boolean |
isIconDead(java.lang.Object o)
Checks to see if an Icon is "dead."
|
static boolean |
isIconDisabled(java.lang.Object icon)
Retrieve whether an Icon is disabled or not.
|
static boolean |
isInitiative(java.lang.Object o)
Determine if it is an Icon's turn in initiative.
|
static boolean |
isItem(java.lang.Object icon)
Determine whether the supplied reference to an Icon is an Item or not.
|
static boolean |
isMaster()
Check if the application is running as a Master (GM).
|
static boolean |
isNPC(java.lang.Object icon)
Determine whether the supplied reference to an Icon is an NPC or not.
|
static boolean |
isPC(java.lang.Object icon)
Determine whether the supplied reference to an Icon is a PC or not.
|
static boolean |
isPlayer()
Check if the application is running as a Player.
|
static boolean |
isSelected(java.lang.Object o)
Retrieve whether or not an Icon is currently selected.
|
static boolean |
isTargeting(java.lang.Object sicon,
java.lang.Object ticon)
Determine if an Icon is currently targeting another Icon.
|
static void |
killIcon(java.lang.Object icon)
Reduce an Icon's hit points to the point where it is considered to
be "dead." For systems with multiple hit point sources, this
method will reduce all the hit point sources to the point of "death."
|
static void |
logDebuggingInfo(java.lang.String s)
Output a String to the Java Output console.
|
static void |
masterChatMsg(boolean special,
java.awt.Color c,
java.lang.String msg,
boolean toAll)
Send a chat message only to the Master.
|
static void |
masterChatMsg(java.lang.Object icon,
boolean special,
java.awt.Color c,
java.lang.String msg,
boolean toAll)
Send a chat message only to the Master.
|
static void |
masterSendChatMsg(boolean special,
java.awt.Color c,
java.lang.String dmMsg,
java.lang.String cMsg,
boolean toAllClients,
boolean toMaster)
Instructs the program (when running as a Master) to send a chat
message.
|
static double |
measureDistance(java.lang.Object o1,
java.lang.Object o2)
Measure the distance between two Icons at Map scale.
|
static double |
measureTargetDistance(java.lang.Object o1,
java.lang.Object o2)
Measure the targeting distance between two Icons at Map scale.
|
static boolean |
modifyIconEffect(java.lang.Object icon,
java.lang.String desc,
java.lang.String[] args)
Modify an existing Effect for the supplied Icon.
|
static void |
modifyIconEffect(java.lang.Object o,
java.lang.String desc,
java.lang.String duration,
java.lang.String remaining,
java.lang.String show,
boolean active,
java.lang.String mods)
Deprecated.
This version does not allow you to modify all the attributes of an Effect.
|
static void |
moveIconTo(java.lang.Object sobj,
java.lang.Object dobj)
Move the Icon from wherever it is to the destination, provided the
destination is a valid place for the Icon to reside.
|
static void |
moveIconToCurrentMap(java.lang.Object o)
Moves an Icon from its present location (whether in a "well" or on a
Map, including the current Map) to the current Map.
|
static java.lang.String |
nextToken()
Retrieve the next token from previously saved XML data.
|
static int |
parse(java.lang.Object icon,
java.lang.String s)
Invoke the program's dice parser to parse the supplied string into
an integer result, providing the Icon as reference (if needed).
|
static int |
parse(java.lang.String s)
Invoke the program's dice parser to parse the supplied string into
an integer result.
|
static double |
parseDouble(java.lang.String s)
Parse a double from a String.
|
static java.lang.Object |
parseFull(java.lang.Object icon,
java.lang.String s)
Unlike the other
parse methods available, this one does not produce any
directly usable results. |
static int |
parseInt(java.lang.String s)
Parse an integer from a String.
|
static java.lang.Object[] |
pasteIcon(java.awt.geom.Point2D p,
boolean add_num)
Paste the previously copied Icon to the current Map.
|
static void |
playSound(java.lang.String sound,
boolean send_on)
Plays the specified sound file.
|
static void |
popXMLBuffer()
Pop the latest XML parser from the stack, returning control to the previous
parser.
|
static void |
postDeferredCharacterSheetUpdates()
Process all stored character sheet updates in one fell swoop.
|
static void |
pushXMLBuffer(java.lang.String s)
Push a new XML parser onto the stack of parsers.
|
static java.awt.Color |
readColor(java.lang.String s)
Retrieve a color from the next value of previously saved XML data.
|
static void |
releaseIconControl(java.lang.Object icon)
Release control of an Icon.
|
static java.awt.geom.Point2D |
remapPoint(int idpi,
double x,
double y)
Set the location of a point based on translating one screen's DPI to
the current screen's DPI.
|
static void |
removeCalendarEventListener(CalendarListener l)
Remove the supplied
CalendarListener from the list of things
interested in receiving calendar event messages. |
static void |
removeCampaignTab(java.awt.Component c)
Removes the supplied component (and the tab that contains it) from the
program's interface.
|
static void |
removeClientEventListener(ClientListener l)
Remove the supplied
ClientListener from the list of things
interested in receiving Client event messages. |
static void |
removeCombatEventListener(CombatListener l)
Remove the supplied
CombatListener from the list of things
interested in receiving combat event messages. |
static void |
removeIcon(java.lang.Object o)
Removes the Icon from whatever Map it is on and places it in its "well"
in the campaign tree.
|
static void |
removeIconEffect(java.lang.Object o,
java.lang.String desc)
Remove an effect for the specified Icon.
|
static void |
removeIconEventListener(IconListener l)
Remove the supplied
IconListener from the list of things
interested in receiving Icon event messages. |
static void |
removeMapEventListener(MapListener l)
Remove the supplied
MapListener from the list of things
interested in receiving Map event messages. |
static void |
removeMapPanel(java.awt.Component c)
Removes the supplied component (and the tab that contains it) from the
program's interface.
|
static void |
removeMenuItem(javax.swing.JMenuItem mi)
Removes the supplied
JMenuItem from the application's
menu bar. |
static void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Remove a property change listener from the list of listeners.
|
static void |
removeScriptListener(ScriptListener sl)
Remove the supplied
ScriptListener from the list of things
interested in receiving script event messages. |
static void |
removeTarget(java.lang.Object sobj,
java.lang.Object tobj)
Remove an Icon to the source Icon's targeted list.
|
static void |
removeToolbarButton(javax.swing.JButton button)
Remove the supplied button from the application's toolbar.
|
static void |
removeVetoableChangeListener(java.beans.VetoableChangeListener listener)
Remove a vetoable property change listener from the list of listeners.
|
static void |
requestFocus(java.awt.Component c)
Requests that the supplied
Component receive keyboard focus. |
static java.lang.String |
resolveTableData(java.lang.Object o,
int row,
java.lang.Object v)
Apply the program's token/variable resolution to a string.
|
static double |
retrieveDoubleResult(java.lang.Object o)
Retrieve the double result of a previously parsed expression.
|
static java.lang.String |
retrieveFullResult(java.lang.Object o)
Retrieve the full (Master) result string of a previously parsed expression.
|
static int |
retrieveIntResult(java.lang.Object o)
Retrieve the integer result of a previously parsed expression.
|
static java.lang.String |
retrievePlayerResult(java.lang.Object o)
Retrieve the partial (Player) result string of a previously parsed expression.
|
static boolean |
roll(java.lang.Object o,
java.lang.String s)
Roll a dice expression for the supplied Icon.
|
static int |
rollExpr(java.lang.Object o,
java.lang.Object de)
Roll a dice expression for the supplied Icon.
|
static boolean |
saveCharacterSheet(java.lang.Object o,
java.lang.String fileName)
Save (export) an Icon's character sheet to an XML file.
|
static void |
selectIcon(java.lang.Object o,
boolean selected)
Select/Deselect the provided Icon (as if it had been clicked on by
the user).
|
static void |
selectIcon(java.lang.Object o,
boolean selected,
boolean add_to)
Select/Deselect the provided Icon (as if it had been clicked on by
the user).
|
static void |
selectIcons(java.lang.Object[] o,
boolean selected)
Select/Deselect all the Icons contained in the supplied array.
|
static void |
sendMessageToClients(java.lang.Object[] clients,
java.lang.String msg)
Send a private message to one or more Clients.
|
static void |
setAcceptInit(boolean b)
Deprecated.
This functionality has been removed.
|
static void |
setCharacterSheet(java.lang.Object o,
java.lang.String charSheet)
Replaces an Icon's character sheet with the data contained in the
supplied file.
|
static void |
setCharacterSheetData(java.lang.Object icon,
int row,
java.lang.String tag,
java.lang.Object data)
Set a single field of a Table to the supplied value.
|
static void |
setCharacterSheetData(java.lang.Object icon,
java.lang.String tableTag,
java.lang.Object[] data)
Sets a full table's data on an Icon's character sheet.
|
static void |
setCharacterSheetDataDeferred(java.lang.Object icon,
int row,
java.lang.String tag,
java.lang.Object data)
Due to the nature of character sheet data and dice expressions, if you are
going to be making more than one character sheet udpate during the
execution of your script, it behooves you and the entire system to "cache"
the updates using this routine and then, when you finish, call
postDeferredCharacterSheetUpdates() . |
static void |
setCharacterSheetDataDeferred(java.lang.Object icon,
java.lang.String tableTag,
java.lang.Object[] data)
Due to the nature of character sheet data and dice expressions, if you are
going to be making more than one character sheet udpate during the
execution of your script, it behooves you and the entire system to "cache"
the updates using this routine and then, when you finish, call
postDeferredCharacterSheetUpdates() . |
static void |
setCurrentIconImage(java.lang.Object o,
int i) |
static void |
setCurrentTarget(java.lang.Object src,
java.lang.Object target)
Sets an Icon's current target to "target." The supplied target must already be
targeted by "src."
|
static void |
setFileSelectionFilter(javax.swing.JFileChooser chooser,
java.lang.String[] exts,
java.lang.String desc)
The scripting environment does not currently support some Java
classes.
|
static void |
setIconChatColor(java.lang.Object o,
java.awt.Color c)
Set an Icon's custom chat color.
|
static void |
setIconFace(java.lang.Object o,
int face)
Set the direction that an Icon is facing.
|
static void |
setIconFace(java.lang.Object o1,
java.lang.Object o2)
Set an Icon's facing direction based on the location of another Icon.
|
static void |
setIconFace(java.lang.Object o1,
java.awt.geom.Point2D p)
Set an Icon's facing direction based on a location on the Map
|
static void |
setIconFriendly(java.lang.Object o)
Sets an Icon to be friendly to PCs.
|
static void |
setIconHeld(java.lang.Object o,
boolean held)
Toggle an Icon between being "held" (incapacitated) and "active."
|
static void |
setIconHidden(java.lang.Object o,
boolean hidden)
Toggle an Icon between being hidden or not.
|
static void |
setIconHostile(java.lang.Object o)
Sets an Icon to be hostile to PCs.
|
static void |
setIconHostile(java.lang.Object o,
boolean hostile)
Toggle an Icon being hostile to PCs.
|
static void |
setIconLocation(java.lang.Object o,
java.awt.geom.Point2D p,
boolean multi_stage,
boolean first,
boolean last)
Move an Icon to the position provided.
|
static void |
setIconName(java.lang.Object o,
java.lang.String s)
Sets the name of an Icon.
|
static void |
setIconNeutral(java.lang.Object o)
Sets an Icon to be friendly to PCs.
|
static void |
setIconOpacity(java.lang.Object o,
int opc)
Set an Icon's transparency level.
|
static void |
setIconRotation(java.lang.Object o,
int r)
Set an Icon's amount of rotation.
|
static void |
setIconUserState(java.lang.Object o,
boolean state)
Toggle an Icon between being in the "user state" and "active."
|
static void |
setIconVisibility(java.lang.Object o,
boolean vis)
Toggle an Icon between being visible to Clients and being invisible
to Clients.
|
static void |
setImagePreviewer(javax.swing.JFileChooser chooser)
This method provides a convenient way for you to supply your
JFileChooser dialogs with an image preview component. |
static void |
setMapZoom(int z)
Set's the current Map's zoom level.
|
static void |
setMaxHP(java.lang.Object o,
int[] hps)
Set the maximum hit points for an Icon.
|
static void |
setRollModified(java.lang.Object expr,
boolean b)
Tell the program whether a roll has been modified or not.
|
static void |
setSoundPreviewer(javax.swing.JFileChooser chooser)
This method provides a convenient way for you to supply your
JFileChooser dialogs with a sound preview component. |
static boolean |
showConfirmDialog(java.lang.Object message,
java.lang.String title,
java.awt.Rectangle bounds)
A convenience routine for scripts so they can easily throw up a resizable, modal
dialog.
|
static void |
showDicePanel(java.lang.Object o,
boolean show)
Toggle the display of an Icon's dice panel.
|
static boolean |
siUnits()
Check whether the host program is operating with SI units.
|
static void |
startBlock(java.lang.String tag)
Begin a block in a script's XML save data.
|
static void |
startCombat()
Initiate combat.
|
static void |
stopScript(java.lang.Object o)
Stop a running script.
|
static boolean |
threatened(java.lang.Object o1,
java.lang.Object o2)
Check to see if one Icon is within the threatened range of another.
|
static void |
tokenSkip()
Skip the next token from previously saved XML data.
|
static java.lang.String |
tokenValue()
Retrieve the next value from previously saved XML data.
|
static void |
visualEffect(java.lang.Object src,
java.lang.Object[] targets,
java.awt.Color flash_color,
java.lang.String effect,
java.lang.String sound,
int type)
Create a visual effect, as created for Spells and other rolls.
|
static void |
visualEffect(java.awt.geom.Point2D p,
double radius,
java.lang.String effect,
java.lang.String sound)
Create a visual effect on the current Map, as created for Spells and other rolls.
|
static void |
zoomTo(java.awt.Rectangle r)
Set the current Map's zoom level so that the supplied rectangle fills
(as much as possible) the entire display.
|
static void |
zoomTo(java.awt.geom.Rectangle2D r)
Set the current Map's zoom level so that the supplied rectangle fills
(as much as possible) the entire display.
|
public static final int IT_Map
public static final int IT_Adventure
public static final int IT_Item
public static final int IT_Character
public static final int IT_NPC
public static final int IT_Doc
public static final int IT_Image
public static final int IT_Sound
public static final int IT_Movie
public static final int Face_None
public static final int Face_North
public static final int Face_Northeast
public static final int Face_East
public static final int Face_Southeast
public static final int Face_South
public static final int Face_Southwest
public static final int Face_West
public static final int Face_Northwest
public static final int ST_Master
You can OR flags together to add functionality. For instance,
ORing ST_Master
and ST_Client
together will
indicate that the script can run on either a Master or a Client.
public static final int ST_Client
public static final int ST_Global
public static final int ST_Map
public static final int ST_Icon
public static final int ST_Def
public static final java.lang.String Effect_Unchanged
public static final java.lang.String SOUND_EVENT_PROPERTY
public static final java.lang.String IE_Show
public static final java.lang.String IE_DescOnly
public static final java.lang.String IE_NoShow
public static final int IE_Start
public static final int IE_End
public static final int IE_Encounter
public static final boolean IE_Active
public static final boolean IE_NotActive
public static final boolean IE_RemoveWhenExpired
public static final boolean IE_NoRemoveWhenExpired
public static final boolean IE_SaveToEnd
public static final boolean IE_NoSaveToEnd
public static CSParser csp
public static java.awt.Frame getAppFrame()
public static boolean isClient()
public static boolean isMaster()
public static void addMapPanel(java.lang.String title, javax.swing.Icon icon, java.awt.Component c, java.lang.String tip)
title
- The title string for the tab (can be HTML).icon
- An icon to use as the tab's icon image (can be null).c
- The component to add to the tab (usually a JPanel or similar that
contains your GUI).tip
- A tooltip to place on the tab.public static void removeMapPanel(java.awt.Component c)
c
- The component to remove.public static void configureMapPanel(java.lang.String title, javax.swing.Icon icon, java.awt.Component c, java.lang.String tip)
title
- The new title (or null to remove the title).icon
- The new icon (or null to remove the icon).c
- The component whose tab is being configured.tip
- The new tooltip (or null to remove).public static void addToolbarButton(javax.swing.JButton button)
button
- The button to add.public static void removeToolbarButton(javax.swing.JButton button)
button
- The button to remove.public static java.lang.String addDataLocation(java.lang.String f)
Note that the results of this method may be unreliable if the program is running in Client mode.
f
- The file to add the data location to.public static java.lang.String getDefID()
You can use this to do basic sanity checking in your scripts to be sure, for example, that you are running under an expected definition (should you have definition-dependent code in your script).
public static java.lang.Object getAssociatedIcon()
null
if no Script Manager exists (or it is
associated with either a Map or the global space).public static void clientSendChatMsg(boolean special, java.awt.Color c, java.lang.String dmMsg, java.lang.String cMsg, boolean toAll)
Note: This method can only be called when the application is running as a Client.
special
- Indicates whether this is a "special" message (a die roll, for
example), which will be rendered in italics.c
- The color for this chat message (or null for the default).dmMsg
- The message as the Master will see it.cMsg
- The message as other Clients will see it.toAll
- TRUE sends the message to all other clients. FALSE sends it only to
the Master.public static void masterSendChatMsg(boolean special, java.awt.Color c, java.lang.String dmMsg, java.lang.String cMsg, boolean toAllClients, boolean toMaster)
Note: This method can only be called when the application is running as a Master.
special
- TRUE indicates that this is a "special" message, which will be
rendered in italics. FALSE means that it is a normal message.c
- The color to use for the message (or null for the default).dmMsg
- The message as the Master will see it.cMsg
- The message as Clients will see it.toAllClients
- TRUE sends the message to all Clients. FALSE does not.toMaster
- TRUE also sends the message to the Master. FALSE will not.public static void chatMsg(java.lang.String msg)
msg
- The message to send.clientSendChatMsg(boolean, java.awt.Color, java.lang.String, java.lang.String, boolean)
,
masterSendChatMsg(boolean, java.awt.Color, java.lang.String, java.lang.String, boolean, boolean)
,
masterChatMsg(boolean, java.awt.Color, java.lang.String, boolean)
public static void chatMsg(java.lang.Object o, java.lang.String msg)
Note that clients can only chat as friendly Icons that are not being controlled by someone else.
o
- The Icon that you would like the message to issue from.msg
- The chat message.public static void masterChatMsg(boolean special, java.awt.Color c, java.lang.String msg, boolean toAll)
Note: This method can only be called when the application is running as a Master.
special
- TRUE indicates that this is a "special" message, which will be
rendered in italics. FALSE indicates that it is a "normal" message.c
- The color to use for this message (or null for the default).msg
- The message to send.toAll
- TRUE sends the message to all Clients as well. FALSE keeps it to the
Master.public static java.lang.Object[] getClientList()
For the Master, this returns all the clients. For a Client, this returns the Master and every other Client connected.
public static java.lang.String getClientName(java.lang.String id)
id
- The id of the Client whose name will be returned.public static void sendMessageToClients(java.lang.Object[] clients, java.lang.String msg)
clients
- An array of Strings that contain the IDs of the Clients who are
intended to receive the message.msg
- The message to be sent.public static void addClientEventListener(ClientListener l)
ClientListener
to the list of things
interested in receiving Client event messages.l
- The listener to add.public static void removeClientEventListener(ClientListener l)
ClientListener
from the list of things
interested in receiving Client event messages.l
- The listener to remove.public static java.lang.Object getCurrentMap()
public static int getDPI()
public static java.lang.Object[] getSelectedIcons()
Note that this array may be empty (if there are currently no Icons selected).
Also note that there is no restriction that the selected Icons will all be on the same Map (or on any Map at all).
Finally, note that the objects returned are opaque and should only be used to pass arguments to other methods.
public static java.lang.Object[] getMapIcons(java.lang.Object o)
o
- The Map to retrieve Icons from.public static java.awt.geom.Point2D getMapPoint(java.lang.Object o)
o
- The Map.public static java.awt.geom.Point2D remapPoint(int idpi, double x, double y)
The intent is that you will have an absolute location that you have retrieved from a file (for instance). This absolute location will be different on different displays, so in order to map between the original screen and the current screen, you supply the DPI of the original screen and allow the application to convert between the two.
idpi
- The incoming (original) DPI of the screen that held the point.x
- The "X" location of the point.y
- The "Y" location of the point.public static java.lang.Object[] getIconsFromWell(int type)
type
- The type of "well" to retrieve the Icons from. This must be one of
the valid constants of the class.public static boolean isSelected(java.lang.Object o)
o
- The Icon whose selected state you would like to retrieve.public static void selectIcon(java.lang.Object o, boolean selected)
o
- An object reference representing the Icon to be modified.selected
- TRUE indicates that the supplied Icon should be selected. FALSE
indicates that it should be deselected.public static void selectIcon(java.lang.Object o, boolean selected, boolean add_to)
o
- An object reference representing the Icon to be modified.selected
- TRUE indicates that the supplied Icon should be selected. FALSE
indicates that it should be deselected.add_to
- TRUE if the Icon should be selected in addition to any already
selected Icons. FALSE if all other selected Icons should be
deselected. Ignored if selected
is FALSE.public static void selectIcons(java.lang.Object[] o, boolean selected)
o
- An array of objects representing the Icons to be modified.selected
- TRUE indicates the the Icons should be selected. FALSE indicates that
the Icons should be deselected.public static java.lang.String getIconName(java.lang.Object o)
o
- Object reference representing the Icon.""
if the Icon could not be found.public static void setIconName(java.lang.Object o, java.lang.String s)
Note: this method can only be called by the application running in Master mode.
o
- Object reference representing the Icon.s
- The new name of the Icon.public static int getIconType(java.lang.Object o)
o
- Object reference representing the Icon whose type is being retrieved.public static long getIconID(java.lang.Object o)
o
- The Icon whose ID you are interested in retrievingpublic static java.lang.Object getIconMap(java.lang.Object o)
o
- The Icon whose parent Map you would like to retrieve.null
if the Icon is not currently
on a Map.public static java.awt.geom.Point2D getIconLocation(java.lang.Object o)
o
- The Icon whose location should be returned.public static void setIconLocation(java.lang.Object o, java.awt.geom.Point2D p, boolean multi_stage, boolean first, boolean last)
first
parameter to TRUE on your first call and last
to FALSE.
For each subsequent call, set first
to FALSE and
last
also to FALSE.
Then, when you have completed your movement, call this routine a
final time with first
set to FALSE and last
set to TRUE.
All this complexity allows the application to properly measure the distance the Icon has traveled over the course of the movement.
o
- The Icon to move.p
- The point to move the Icon to.multi_stage
- This is a multi-stage movement, which means that it should be
measured.first
- TRUE if this is the first step of a multi-stage movement. FALSE if
it is not.last
- TRUE if this is the last step of a multi-stage movement. FALSE if it
is not.public static int getNumIconImages(java.lang.Object o)
o
- The Icon whose total number of static images should be returned.public static boolean iconHasAnimImage(java.lang.Object o)
o
- The Icon to be checked for an animated image.public static void animateIcon(java.lang.Object o, boolean b)
o
- The Icon whose state you would like to toggle.b
- TRUE to animate the Icons, FALSE to return to the unanimated state.public static int getCurrentIconImage(java.lang.Object o)
o
- Reference to the Icon whose current image you are interested in.public static void setCurrentIconImage(java.lang.Object o, int i)
public static boolean getIconVisibility(java.lang.Object o)
o
- The Icon.public static void setIconVisibility(java.lang.Object o, boolean vis)
o
- Reference object representing the Icon.vis
- TRUE means the Icon is visible to Clients. FALSE means that it is
not.public static boolean getIconHidden(java.lang.Object o)
o
- The Icon.public static void setIconHidden(java.lang.Object o, boolean hidden)
Note: this method can only be called by the application running in Master mode.
o
- Reference object representing the Icon.hidden
- TRUE means the Icon is hidden. FALSE means that it is
not.public static boolean getIconHeld(java.lang.Object o)
o
- The Icon.public static void setIconHeld(java.lang.Object o, boolean held)
Note: This method can only be called by the application running in Master mode.
o
- Reference object representing the Icon.held
- TRUE indicates that the Icon should be "held" (incapacitated). FALSE
indicates that the Icon is not "held."public static boolean getIconUserState(java.lang.Object o)
o
- The Icon.public static void setIconUserState(java.lang.Object o, boolean state)
Note: This method can only be called by the application running in Master mode.
o
- Reference object representing the Icon.state
- TRUE indicates that the Icon should be in the "user state." FALSE
indicates that the Icon is active.public static int getIconOpacity(java.lang.Object o)
o
- The Icon.public static void setIconOpacity(java.lang.Object o, int opc)
Note: This method can only be called by the application running in Master mode.
o
- Reference object representing the Icon.opc
- The amount of transparency. 0 (Zero) indicates fully transparent and
100 (one hundred) indicates fully opaque.public static int getIconRotation(java.lang.Object o)
o
- The Icon.public static void setIconRotation(java.lang.Object o, int r)
o
- Reference object representing the Icon.r
- The amount of rotation in degrees. 0 (Zero) indicates unrotated and
360 (three hundred and sixty) indicates fully rotated.public static int getIconFace(java.lang.Object o)
o
- The Icon.public static void setIconFace(java.lang.Object o, int face)
o
- Reference object representing the Icon.face
- The direction that the Icon is facing.Face_None
public static void setIconFace(java.lang.Object o1, java.lang.Object o2)
o1
- The Icon that will be facing the second Icon.o2
- The Icon being faced by the first Icon.public static void setIconFace(java.lang.Object o1, java.awt.geom.Point2D p)
o1
- The Icon that will have its facing direction modified.p
- The point (an absolute Map location) for the Icon to face.public static boolean getIconHostile(java.lang.Object o)
o
- The Icon.public static void setIconHostile(java.lang.Object o, boolean hostile)
Note: This method can only be called by the application running in Master mode.
o
- Reference object representing the Icon.hostile
- TRUE indicates that the Icon is hostile to PCs. FALSE indicates that
the Icon is potentially friendly to PCs.public static boolean isIconAlive(java.lang.Object o)
o
- Reference object representing the Icon.public static boolean isIconDead(java.lang.Object o)
o
- Reference object representing the Icon.public static void addTarget(java.lang.Object sobj, java.lang.Object tobj)
sobj
- The source Icon (the one doing the targeting).tobj
- The Icon being targeted.public static void removeTarget(java.lang.Object sobj, java.lang.Object tobj)
sobj
- The source Icon (the one doing the targeting).tobj
- The Icon you wish to have the source stop targeting.public static java.lang.Object[] getTargets(java.lang.Object icon)
icon
- The Icon whose target list should be retrieved.public static boolean isTargeting(java.lang.Object sicon, java.lang.Object ticon)
sicon
- The Icon whose targeting list you would like to examine.ticon
- The Icon that is potentially being targeted by the source.public static void clearAllTargets(java.lang.Object o)
o
- The Icon whose target list you would like to clear.public static double getThreatenedArea(java.lang.Object o)
o
- The Icon whose threatened area you wish to retrieve.public static java.lang.Object[] getThreatenedIcons(java.lang.Object o)
For clients, only visible Icons will be included in the returned array.
o
- The Icon whose potential targets you would like to retrieve.public static java.awt.Color getIconChatColor(java.lang.Object o)
o
- The Icon whose chat color you would like to retrieve.null
if no custom color has
been assigned.public static void setIconChatColor(java.lang.Object o, java.awt.Color c)
o
- The Icon whose chat colour you would like to change.c
- The color to set, or null
to return to the default.public static int getIconInitiative(java.lang.Object o)
o
- The Icon whose initiative you are interested in.public static boolean isInitiative(java.lang.Object o)
Use this method to determine if it is really the Icon's turn to go.
o
- The Icon whose initiative is being checked.public static int getNumHpFields()
public static void adjustHP(java.lang.Object o, int[] delta, int dmr)
o
- The Icon whose hit points you would like to adjust.delta
- An array of delta values to adjust the Icon's hit points by. Since
game systems can support multiple hit point sources, this must be an
array (even if that array only contains one element).
A "delta" is a difference. If you want to lower an Icon's current hit points, you would supply a negative delta (like "-6," for example).
In this way you do not need to first query the Icon's current hit points before making an adjustment -- you simply apply the adjustment you want.
dmr
- A damage reduction amount. If the adjustment was reduced by something,
set the amount of the reduction here.public static java.lang.Integer[] getCurrentHP(java.lang.Object o)
o
- The Icon whose current hit points you would like to retrieve.public static java.lang.Integer[] getMaxHP(java.lang.Object o)
o
- The Icon whose maximum hit points you would like to retrieve.public static void setMaxHP(java.lang.Object o, int[] hps)
Note: This method can only be called by the application running in Master mode.
o
- Reference to the Icon whose hit points are to be changed.hps
- An array of int
s (one for each hit point field) that
contains the new maximum for the Icon's hit points.public static boolean isIcon(java.lang.Object o)
o
- The Icon whose type is being queried.public static void moveIconToCurrentMap(java.lang.Object o)
Note: This method can only be called by the application running in Master mode.
o
- Reference object representing the Icon.public static void moveIconTo(java.lang.Object sobj, java.lang.Object dobj)
For instance, you can move NPC and Character Icons to a Map, but you can not move them to an Adventure.
Note: This method can only be called by the application running in Master mode.
sobj
- The Icon being moved.dobj
- The destination Icon.public static void removeIcon(java.lang.Object o)
If you supply null
instead of an Icon, then all
currently selected Icons will be removed.
Note: This method can only be called by the application running in Master mode.
o
- The Icon to remove, or null
to remove all selected Icons.public static java.lang.Object findIcon(java.lang.String name)
This can be a haphazard way of searching for an Icon, so use it with due caution.
name
- The name of the Icon that you are looking for.null
if nothing appropriate was found.public static java.lang.Object findIcon(long id)
id
- The ID that you are looking for.null
if none was found.public static void copyIcon(java.lang.Object o)
Note: This method can only be called by the application running in Master mode.
o
- The Icon to be copied.public static java.lang.Object[] pasteIcon(java.awt.geom.Point2D p, boolean add_num)
p
- The spot on the Map where the new Icon should be placed. This is an
absolute location at Map scale. It will be translated into a screen
location at the current zoom level. If you pass in null
you take your chances on just where the pasted Icon will be placed.add_num
- TRUE indicates that a paste count should be added to the Icon's name.public static void centerOn(java.lang.Object o)
o
- The Icon to center on.public static void centerOn(java.awt.geom.Point2D p)
p
- The point to center on. This is an absolute location, which will be
translated to a screen location at the current zoom level.public static double measureDistance(java.lang.Object o1, java.lang.Object o2)
o1
- The Icon you are measuring from.o2
- The Icon you are measuring to.public static int getMapZoom()
public static void setMapZoom(int z)
z
- The zoom level to set the Map to, as an integer percentage.public static void zoomTo(java.awt.Rectangle r)
r
- The rectangle (using absolute coordinates) to zoom to.public static int getRound()
public static int getInitiative()
public static int getAttack()
public static void addCombatEventListener(CombatListener l)
CombatListener
to the list of things
interested in receiving combat event messages.l
- The listener to add.public static void removeCombatEventListener(CombatListener l)
CombatListener
from the list of things
interested in receiving combat event messages.l
- The listener to remove.public static void addIconEventListener(IconListener l)
IconListener
to the list of things
interested in receiving Icon event messages.l
- The listener to add.public static void removeIconEventListener(IconListener l)
IconListener
from the list of things
interested in receiving Icon event messages.l
- The listener to remove.public static void addMapEventListener(MapListener l)
MapListener
to the list of things
interested in receiving Map event messages.
A MapListener
receives events from whatever Map is
the current one. Once a MapListener
is installed, there
is no need to install any more when the current Map changes.
It is probably best to have only one MapListener
,
since the number of events generated can be quite high, but that is
up to you.
l
- The listener to add.public static void removeMapEventListener(MapListener l)
MapListener
from the list of things
interested in receiving Map event messages.l
- The listener to remove.public static void addCalendarEventListener(CalendarListener l)
CalendarListener
to the list of things
interested in receiving calendar event messages.
A CalendarListener
receives events from the calendar
as time passes.
l
- The listener to add.public static void removeCalendarEventListener(CalendarListener l)
CalendarListener
from the list of things
interested in receiving calendar event messages.l
- The listener to remove.public static void addScriptListener(ScriptListener sl)
ScriptListener
to the list of things
interested in receiving script event messages.
A ScriptListener
receives events from other scripts.
In this way, you can have scripts that "talk" to each other,
coordinating activities, for example.
sl
- The listener to add.public static void removeScriptListener(ScriptListener sl)
ScriptListener
from the list of things
interested in receiving script event messages.sl
- The listener to remove.public static void fireScriptEvent(java.util.EventObject event)
ScriptEvent
to be issued to all listeners.event
- The event that will be broadcast to all listeners.public static java.lang.Object[] getSoundFileNames()
public static void playSound(java.lang.String sound, boolean send_on)
sound
- The sound to play.send_on
- TRUE if the sound should be played for everyone connected. FALSE
indicates that the sound should only be played locally.public static void bumpMinute(int delta)
delta
- The amount (positive or negative) to increment the game calendar's
time by.public static int getMinute()
public static int getHour()
public static int getDayOfMonth()
public static java.lang.String getDay()
null
if none is defined or the
calendar is not turned on).public static java.lang.String getMonth()
null
if none is defined or the
calendar is not turned on).public static java.lang.String getYear()
null
if none is defined or the
calendar is not turned on).public static boolean roll(java.lang.Object o, java.lang.String s)
o
- The Icon that will be rolled for.s
- The dice expression's raw-label or desc-label. The program determines which dice
expression to roll based on the raw label (as defined in the
definition file). You must know the expression's raw-label or desc-label in order
to roll the expression. Note that if you are rolling an attack, there
is no way to specify an armor class type, so the first armor class
type in the definition file will be used (rolling from an Icon's popup
menu behaves the same way).public static int parse(java.lang.String s)
The input string should contain only one expression (as opposed to multiple expressions), or else unexpected results might be returned.
Also, the expression need not be surrounded by curly braces ("{" and "}"), as this method will surround the expression with them if they are missing.
s
- A string containing an expression to be parsed. Keep it simple, since
we only return the integer result of the expression (and not the
fully parsed result string.public static void stopScript(java.lang.Object o)
To stop a script, pass this method the ScriptObject
object. This object is supplied to the script by the host program
and should only be used for this purpose.
Example
// Some event occurs, making us want to leave. KWScript.stopScript(ScriptObject);
o
- ScriptObject
-- a reference to the script itself.public static void addIconEffect(java.lang.Object o, java.lang.String desc, java.lang.String duration, java.lang.String remaining, java.lang.String show, boolean active, java.lang.String mods)
o
- Reference to the Icon that should have the effect added to it.desc
- The effect's descriptionduration
- The effect's duration as either a number converted to a string, or
in "3d6h12m" notationremaining
- The effect's remaining time as either a number or in "3d6h12m" notationshow
- "Y" for Clients to see all the details of the effect, "N" for Clients
to see nothing and "D" for Clients to only see the description. Note
that if the effect is created by a Client, then this parameter is
ignored and set to "Y."active
- TRUE if the effect is in effect, FALSE otherwisemods
- String conaining the modifiers applied to the Icon by this effect (comma
seperated, TOKEN=modifier)
For the special tokens GLOW, RING, SQR, SQRG, the "modifier" portion of the
"mods" string has a special format (since these tokens contain their own
array of sub-options).
The format for these is:
sub-token:sub-value;sub-token:sub-value;...The recognized "sub-tokens" are:
radius: the radius of the Effect (a double) color: the color of the Effect (an RGB triplet, for example: #FFFFFF) opacity: the opacity of the Effect (a double in the range of 0.0 to 1.0) blur: the amount of blurring to apply to "glows" (an integer)Sub-tokens can appear in any order and will default to reasonable values if not included.
public static java.lang.Object[] getCharacterSheetData(java.lang.Object o, java.lang.String tag)
This function retrieves data a whole table at a time. Currently, this is the finest granularity provided.
Note that the data returned is the raw data as it appears on the character sheet. No tokens have been resolved, no modifiers added -- what you see on the character sheet is what you get.
o
- Reference to the Icon whose character sheet is to be queried
or the raw character sheet data (as supplied to the script).tag
- The "table-tag" of the table you would like to retrieve. This
information comes from the definition file (and only the definition
file), so you will need to know this tag before trying to call this
function.null
if the
table could not be found, you don't have access to the table's data
or the table was empty (although this last situation usually returns
a zero length array instead of null
). Note that the
data returned is a copy of the data contained in the character sheet,
so modifying the returned data will not modify the original data in the
character sheet.public static java.lang.Object createFileIcon(int type, java.lang.String name, java.lang.String file)
Note that the created Icon will not be placed in the campaign tree or on a Map. It is up to the script to take the returned Icon and place it somewhere appropriate.
Note: This method can only be called when the application is running as a Master.
type
- The type of icon to create. Must be one of IT_Doc, IT_Image,
IT_Sound or IT_Movie.name
- The name of the Icon.file
- The file to use. This should be within the program's data
location, or else bad things are likely to happen.null
if there was a
problem.public static java.lang.Object createNoteIcon(java.lang.String name, java.lang.String note)
Note that the created Icon will not be placed in the campaign tree or on a Map. It is up to the script to take the returned Icon and place it somewhere appropriate.
Note: This method can only be called when the application is running as a Master.
name
- The name of the Icon.note
- The text that the note should contain.null
if there was a problem.public static java.lang.Object createNPC(java.lang.String name, java.lang.String[] images, java.lang.String animImage, int curImg, java.lang.String charSheet) throws java.lang.Exception
Note: This method can only be called when the application is running as a Master.
name
- The name of the new Icon.images
- An array of file names to use as the Icon's static images. Even if
you are only supplying one image for the icon, it must be placed in
an array.animImage
- The file name of an animated GIF to use for the Icon.curImg
- The index into the images
array to use as the Icon's
current image, or -1
if you would like the animated
image to be used.charSheet
- The file name of an XML character sheet to be imported into the Icon
when it is created. If not supplied the Icon will be left with a
blank character sheet.null
if there was an error.java.lang.Exception
- If there is a problem with image names, indexes or such, an Exception
will be thrown.public static java.lang.Object createPC(java.lang.String name, java.lang.String[] images, java.lang.String animImage, int curImg, java.lang.String charSheet) throws java.lang.Exception
Note: This method can only be called when the application is running as a Master.
name
- The name of the new Icon.images
- An array of file names to use as the Icon's static images. Even if
you are only supplying one image for the icon, it must be placed in
an array.animImage
- As of 2.7.6 this file name is simply added to the Icon's list of
images, since a special "animated" image is no longer supported.curImg
- The index into the images
array to use as the Icon's
current image, or -1
if you would like the animated
image to be used.charSheet
- The file name of an XML character sheet to be imported into the Icon
when it is created. If not supplied the Icon will be left with a
blank character sheet.null
if there was an error.java.lang.Exception
- If there is a problem with image names, indexes or such, an Exception
will be thrown.public static void setCharacterSheet(java.lang.Object o, java.lang.String charSheet)
Note that Clients can only replace the character sheet for friendly Icons that are uncontrolled or controlled by the Client.
o
- Reference to the Icon whose character sheet is to be replaced.charSheet
- The file name of the character sheet to load.public static boolean saveCharacterSheet(java.lang.Object o, java.lang.String fileName)
o
- Reference to the Icon whose character sheet you would like to save.
Note that if you are running as a Client there will be restrictions
on whether or not you will be able to save the Icon's character sheet.fileName
- The fully qualified file name to save the character sheet to. If this
does not end in ".xml" then ".xml" will be added.public static void setFileSelectionFilter(javax.swing.JFileChooser chooser, java.lang.String[] exts, java.lang.String desc)
JFileChooser
with a FileFilter
.chooser
- An already-created JFileChooser
that you would like to
define a FileFilter
for.exts
- An String array containing the file extentions that you would like
the JFileCHooser
to filter on. This array should only
contain the extensions, without the leading period. For example,
you would specify "xml" to filter on files that end with ".xml".desc
- A description for the JFileChooser
to display for the
provided extensions.public static void setImagePreviewer(javax.swing.JFileChooser chooser)
JFileChooser
dialogs with an image preview component.
This method will set the provided JFileChooser
's
FileFilter
to something appropriate for images and
create a previewer component for showing a thumbnail of selected
images.
chooser
- The JFileChooser
to add image previewing to.public static void setSoundPreviewer(javax.swing.JFileChooser chooser)
JFileChooser
dialogs with a sound preview component.
This method will set the provided JFileChooser
's
FileFilter
to something appropriate for sounds and
create a previewer component for playing selected sounds.
chooser
- The JFileChooser
to add sound previewing to.public static void startCombat()
Use this method with caution! Avoid creating script triggers that automatically initiate combat, since these can detract from the roleplaying experience and make your game into more of an arcade experience.
endCombat()
public static void endCombat()
startCombat()
public static void setAcceptInit(boolean b)
b
- TRUE to accept initiative rolls, FALSE to stop accepting initiative
rolls.startCombat()
public static void addMenuItem(javax.swing.JMenuItem mi)
JMenuItem
to the application's menu
bar. The JMenuItem
will appear beneath a menu called
"Scripts."mi
- The JMenuItem
to add to the menu bar.public static void removeMenuItem(javax.swing.JMenuItem mi)
JMenuItem
from the application's
menu bar. If this is the last item in the "Scripts" menu, then
the "Scripts" menu will also be removed.mi
- The JMenuItem
to remove.public static void addCampaignTab(java.lang.String title, javax.swing.Icon icon, java.awt.Component c, java.lang.String tip)
title
- The title string for the tab (can be HTML).icon
- An icon to use as the tab's icon image (can be null).c
- The component to add to the tab (usually a JPanel or similar that
contains your GUI).tip
- A tooltip to place on the tab.public static void removeCampaignTab(java.awt.Component c)
c
- The component to remove.public static void configureCampaignTab(java.lang.String title, javax.swing.Icon icon, java.awt.Component c, java.lang.String tip)
title
- The new title (or null to remove the title).icon
- The new icon (or null to remove the icon).c
- The component whose tab is being configured.tip
- The new tooltip (or null to remove).public static java.awt.geom.Point2D getViewportCenter()
null
if there is no current Map.public static void advanceInitiative()
public static java.lang.Object getInitiativeIcon()
null
if no Icon is going or combat is not underway.public static boolean combatEngaged()
TRUE
if combat is occuring, FALSE
otherwise.public static void showDicePanel(java.lang.Object o, boolean show)
o
- Reference to the Icon whose dice panel should be toggled.show
- TRUE
to display the Icon's dice panel, FALSE
to hide it.public static void applyPendingDamage(java.lang.Object o)
o
- Reference to the Icon whose pending damage should be applied.public static void adjustHP(java.lang.Object o, int[] delta, int[] dmr)
o
- The Icon whose hit points you would like to adjust.delta
- An array of delta values to adjust the Icon's hit points by. Since
game systems can support multiple hit point sources, this must be an
array (even if that array only contains one element).
A "delta" is a difference. If you want to lower an Icon's current hit points, you would supply a negative delta (like "-6," for example).
In this way you do not need to first query the Icon's current hit points before making an adjustment -- you simply apply the adjustment you want.
dmr
- A damage reduction amount array (one for each hit point source). If
the adjustment was reduced by something, set the amount of the
reduction here. If not reduced, simply pass in null
.public static boolean findExpression(java.lang.Object o, java.lang.String s)
o
- Reference to the Icon whose dice expression list should be searched.s
- The dice expression name to search for.public static boolean getIconFriendly(java.lang.Object o)
o
- The Icon.public static boolean getIconNeutral(java.lang.Object o)
o
- The Icon.public static void setIconHostile(java.lang.Object o)
Note: This method can only be called by the application running in Master mode.
o
- Reference object representing the Icon.public static void setIconFriendly(java.lang.Object o)
Note: This method can only be called by the application running in Master mode.
o
- Reference object representing the Icon.public static void setIconNeutral(java.lang.Object o)
Note: This method can only be called by the application running in Master mode.
o
- Reference object representing the Icon.public static boolean findNote(java.lang.Object o, java.lang.String title)
o
- Reference object representing the Icon.title
- The title of the note being looked for.TRUE
if the note was found, FALSE
otherwise.public static boolean addNote(java.lang.Object o, java.lang.String title, java.lang.String text, boolean append)
o
- Reference to the Icon.title
- The title to be used for the note.text
- The contents of the note.append
- If TRUE
then append the text to the note if it already exists. If FALSE
then replace the note (if it exists) with the supplied text.TRUE
if the note was added/modified, FALSE
otherwise.public static java.lang.String getSessionName()
public static boolean charSheetLocked(java.lang.Object o)
o
- Reference to the Icon to check.TRUE
if the character sheet is locked for editing,
FALSE
otherwise.public static java.lang.String resolveTableData(java.lang.Object o, int row, java.lang.Object v)
Apply the program's token/variable resolution to a string. Note that this method will not actually solve an expression. So, for example, if you have a string that contains "$S$BAB" and the Icon's character sheet defines "$S" as "+3" and "$BAB" as "+1," you will receive back from this method the string "+3+1".
The idea is that this method would be used by a script that wanted to create an expression that the program will later parse.
o
- Reference to the Icon whose character sheet should be used as a reference for resolving tokens/variables.row
- The table row that the string comes from.v
- The string to be parsed.null
if there was an error.public static java.lang.Object findExpr(java.lang.Object o, java.lang.String s)
o
- Reference to the Icon whose character sheet should be searched for
the expression.s
- The raw label of the expression that you are looking for.null
if the expression
could not be found.public static int rollExpr(java.lang.Object o, java.lang.Object de)
o
- The Icon that will be rolled for.de
- Reference to the expression to be rolled.public static void addPendingDamage(java.lang.Object o, java.lang.Object o2, java.lang.Object de, int amt)
o
- Reference to the Icon that will have the hit point adjustment added
to it.o2
- Reference to the Icon that caused the hit point adjustment.de
- Reference to the expression that initiated the hit point adjustment.amt
- The amount of the adjustment.public static int getExprResult(java.lang.Object de)
de
- Reference to the expression whose result you would like to retrieve.public static boolean getExprIsHit(java.lang.Object de)
isHit
instead.de
- Reference to the expression whose hit status you would like
to retrieve.TRUE
if the expression is a hit, FALSE
otherwise.public static boolean getExprIsCriticalHit(java.lang.Object de)
isCriticalHit
instead.de
- Reference to the expression whose critical hit status you would like
to retrieve.TRUE
if the expression is a critical hit, FALSE
otherwise.public static boolean getExprIsCriticalMiss(java.lang.Object de)
isCriticalMiss
instead.de
- Reference to the expression whose critical miss status you would like
to retrieve.TRUE
if the expression is a critical miss, FALSE
otherwise.public static java.lang.Object[] getTargeters(java.lang.Object o)
o
- Reference to the Icon that is (potentially) being targeted.null
if the Icon isn't being targeted.public static boolean threatened(java.lang.Object o1, java.lang.Object o2)
o1
- Reference to the Icon who is potentially doing the threatening.o2
- Reference to the Icon who is potentially being threatened by the
first Icon.TRUE
if the second Icon is within the threatened range
of the first, FALSE
otherwise.public static boolean siUnits()
TRUE
if using SI units, FALSE
otherwise.public static boolean englishUnits()
TRUE
if using English units, FALSE
otherwise.public static java.lang.Object[] getIconEffectNames(java.lang.Object o)
o
- Reference to the Icon whose Effects you'd like to retrieve.public static double getIconSize(java.lang.Object o)
o
- Reference to the Icon whose size you would like to retrieve.0.0
if there was a problem.public static java.awt.geom.Point2D getIconCenter(java.lang.Object o)
o
- Reference to the Icon whose center you would like to retrieve.public static java.lang.String getFieldModifiers(java.lang.Object o, java.lang.Object field)
o
- Reference to the Icon whose character sheet is being referencedfield
- Reference to the Field that should be checked.public static void modifyIconEffect(java.lang.Object o, java.lang.String desc, java.lang.String duration, java.lang.String remaining, java.lang.String show, boolean active, java.lang.String mods)
o
- Reference to the Icon that should have its effect modified.desc
- The description of the effect to modifyduration
- The effect's duration as either a number converted to a string, or
in "3d6h12m" notation or KWScript.Effect_Unchangedremaining
- The effect's remaining time as either a number converted to a string
or in "3d6h12m" notation or KWScript.Effect_Unchangedshow
- "Y" for Clients to see all the details of the effect, "N" for Clients
to see nothing and "D" for Clients to only see the description or
KWScript.Effect_Unchanged to leave it as is. Note that if the
effect is created by a Client, then this parameter is ignored and
set to "Y" (or KWScript.Effect_Unchanged, as appropriate).active
- TRUE if the effect is in effect, FALSE otherwisemods
- String conaining the modifiers applied to the Icon by this effect (comma
seperated, TOKEN=modifier), or null
to remove the effect's
modifiers or KWScript.Effect_Unchanged to leave the modifiers unchanged.modifyIconEffect(java.lang.Object, java.lang.String, java.lang.String[])
public static void removeIconEffect(java.lang.Object o, java.lang.String desc)
o
- Reference to the Icon that should have its effect removed.desc
- The description of the effect to removepublic static void addLine(java.lang.String s) throws java.io.IOException
startBlock
and
finishBlock
methods to perform the duties that this method
was intended to perform.s
- The string to be added to the script's saved datajava.io.IOException
public static void addTag(java.lang.String tag, java.lang.Object value) throws java.io.IOException
tag
- The tag to surround the data withvalue
- The data to be storedjava.io.IOException
public static void addTag(java.lang.String tag, int value) throws java.io.IOException
tag
- The tag to surround the data withvalue
- The data to be storedjava.io.IOException
public static void addTag(java.lang.String tag, long value) throws java.io.IOException
tag
- The tag to surround the data withvalue
- The data to be storedjava.io.IOException
public static void addTag(java.lang.String tag, double value) throws java.io.IOException
tag
- The tag to surround the data withvalue
- The data to be storedjava.io.IOException
public static void addTag(java.lang.String tag, boolean value) throws java.io.IOException
tag
- The tag to surround the data withvalue
- The data to be storedjava.io.IOException
public static void addTag(java.lang.String tag, java.awt.Color v) throws java.io.IOException
tag
- The tag to surround the data withv
- The color to assign to the tagjava.io.IOException
public static java.lang.String nextToken()
public static java.lang.String tokenValue()
public static java.awt.Color readColor(java.lang.String s) throws ParseException
s
- The data written with addTag(tag, java.awt.Color)
ParseException
public static void tokenSkip()
public static void pushXMLBuffer(java.lang.String s)
s
- The value to create a new parser frompopXMLBuffer()
public static void popXMLBuffer()
pushXMLBuffer(java.lang.String)
public static void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
propertyName
- The name of the property that the listener should be
notified about.listener
- The listener to add to the list of listeners.public static void addVetoableChangeListener(java.lang.String propertyName, java.beans.VetoableChangeListener listener)
propertyName
- The name of the property that the listener should be
notified about.listener
- The listener to add to the list of listeners.public static void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
listener
- The listener to remove from the list.public static void removeVetoableChangeListener(java.beans.VetoableChangeListener listener)
listener
- The listener to remove from the list.public static void firePropertyChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)
propertyName
- The property being changed.oldValue
- What the property used to be (can be null
).newValue
- What the property is now (can also be null
).public static void fireVetoableChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue) throws java.beans.PropertyVetoException
propertyName
- The property being changed.oldValue
- What the property used to be (can be null
).newValue
- What the property is now (can also be null
).java.beans.PropertyVetoException
public static java.lang.String getFieldData(java.lang.Object src, java.lang.String id, int row)
src
- Reference to the Icon whose character sheet is to be queried
or the raw character sheet data (as supplied to the script).id
- The ID of the field you are interested in.row
- The row of the table to retrieve.public static java.lang.Object[] getIconEffects(java.lang.Object o)
returned_array[0] == Object[];Within each element of the returned array is an array in the format of:
item[0] = description (a String) item[1] = duration (a Double) item[2] = remaining (a Double) item[3] = show (one of "Y," "N" or "D") item[4] = end behavior (either "Start" or "End") item[5] = active (a Boolean) item[6] = active (a Boolean) item[7] = active (a Boolean) item[8] = mods (a String of "token=value,token2=val2" format)
o
- Reference to the Icon whose Effects you'd like to retrieve.public static void zoomTo(java.awt.geom.Rectangle2D r)
zoomTo(Rectangle)
, except that it takes a higher
precision Rectangle2D.r
- The rectangle (using absolute coordinates) to zoom to.public static java.lang.String getModifiedFieldData(java.lang.Object src, java.lang.String tag, int row)
src
- The Icon or character sheet the data is coming from.tag
- The tag of the field you are interested in.row
- The row of the table to retrieve.public static void setCurrentTarget(java.lang.Object src, java.lang.Object target)
src
- The Icon whose current target will be settarget
- The Icon targeted by "src"public static void clearPendingDamage(java.lang.Object o)
o
- The Icon whose pending damage will be clearedpublic static java.util.ArrayList<java.lang.Object> getTabButtons(java.lang.Object icon)
icon
- The Icon whose Dice Dialog will be inspected.public static java.lang.Object getCurrentIconTarget(java.lang.Object icon)
NULL
.icon
- The Icon whose list of targets should be checkedNULL
if no
"current" target could be determined.public static boolean isAffected(java.lang.Object icon, java.lang.String desc)
icon
- The Icon to checkdesc
- The description of the effect to check against. Note
that, except for case, the description must match
exactly to be considered.TRUE
if the Icon is affected, FALSE
otherwise.public static java.lang.String getIconClass(java.lang.Object icon)
null
) if
the current definition has not defined a class-field
or the
Icon's character sheet does not contain class information.icon
- The Icon to check.null
if the Icon's
class could not be determined.public static void chatMsgLocal(java.lang.String msg)
msg
- The chat message to be issued.public static boolean healFromZero()
TRUE
if "heal-from-zero" is set, FALSE
otherwise.public static boolean isIconControlled(java.lang.Object icon)
icon
- The Icon to be checked.TRUE
if the Icon is being controlled, FALSE
otherwise.public static java.lang.String getIconController(java.lang.Object icon)
icon
- The Icon whose controller you are interested in.NULL
.public static boolean controllIcon(java.lang.Object icon)
icon
- The Icon to be controlled.TRUE
if the control request succeeded, FALSE
otherwise.public static java.lang.Object[] getControlledIcons()
NULL
).public static void releaseIconControl(java.lang.Object icon)
icon
- The Icon whose control is to be released.public static void setCharacterSheetData(java.lang.Object icon, java.lang.String tableTag, java.lang.Object[] data)
icon
- The Icon whose character sheet is to be modified.tableTag
- The character sheet's table tag.data
- the data to write to the table.public static void killIcon(java.lang.Object icon)
icon
- The Icon to kill.public static void healIcon(java.lang.Object icon)
icon
- The Icon to heal.public static boolean isIconDisabled(java.lang.Object icon)
icon
- The Icon to check.true
if the Icon is disabled, false
otherwise.public static boolean isIconBloodied(java.lang.Object icon)
true
if
the definition defines criteria for "bloodied" and the Icon matches this criteria.icon
- The Icon to check.true
if the Icon is "bloodied," false
otherwise.public static java.lang.String getExpr(java.lang.Object expr)
expr
- The Expression object to retrieve the expression String from.public static void visualEffect(java.lang.Object src, java.lang.Object[] targets, java.awt.Color flash_color, java.lang.String effect, java.lang.String sound, int type)
src
- The Icon from which the effect originatestargets
- The targets of the effect (can be null
)flash_color
- The color to flash the targeted Icons (can be null
)effect
- The effect -- either a color or the name of an Effectsound
- The sound to play when the effect is createdtype
- The type of effect: 0=none, 1=hit, 2=miss, 3=spell, 4=critical hitpublic static void startBlock(java.lang.String tag) throws java.io.IOException
finishBlock
to properly close out the block.
This should only be called in the process of saving a script's data to the
campaign. Calling it at any other time will result in an error.tag
- The name of the block being started.java.io.IOException
finishBlock(java.lang.String)
public static void finishBlock(java.lang.String tag) throws java.io.IOException
startBlock
to properly start the block.
This should only be called in the process of saving a script's data to the
campaign. Calling it at any other time will result in an error.tag
- The name of the block being finished.java.io.IOException
startBlock(java.lang.String)
public static boolean iconsHaveSameDisposition(java.lang.Object icon1, java.lang.Object icon2)
icon1
- The first Icon in the comparison.icon2
- The second Icon in the comparison.true
if the two Icons have the same
disposition, false
otherwise.public static boolean isHit(java.lang.Object de)
de
- Reference to the expression whose hit status you would like
to retrieve.TRUE
if the expression is a hit, FALSE
otherwise.public static boolean isCriticalHit(java.lang.Object de)
de
- Reference to the expression whose critical hit status you would like
to retrieve.TRUE
if the expression is a critical hit, FALSE
otherwise.public static boolean isCriticalMiss(java.lang.Object de)
de
- Reference to the expression whose critical miss status you would like
to retrieve.TRUE
if the expression is a critical miss, FALSE
otherwise.public static boolean showConfirmDialog(java.lang.Object message, java.lang.String title, java.awt.Rectangle bounds)
message
- The contents of the dialog (can be just about anything).title
- The dialog's title.bounds
- If non-null, a Rectangle to initialize the dialog's size and location
and also store the dialog's size and location before it was closed.true
if the dialog was accepted, false
otherwise.public static boolean armedRequired()
true
if a weapon must be "armed," false
otherwise.public static java.lang.Object getCharacterSheetData(java.lang.Object o, int row, java.lang.String tag)
o
- The Icon or character sheet data that is being accessed.row
- The row of the Table to retrieve the data from.tag
- The Field's tag.null
.public static void setCharacterSheetData(java.lang.Object icon, int row, java.lang.String tag, java.lang.Object data)
icon
- The Icon whose character sheet it being modified.row
- The row of the Table to modify.tag
- The Field's tag.data
- The data to set the row to.public static int parseInt(java.lang.String s)
s
- The String to be parsed.public static java.lang.String getScriptFolder()
public static java.lang.String getWorkingFolder()
public static java.lang.String getFieldModifiers(java.lang.Object icon, int row, java.lang.String tag)
icon
- The Icon in question.tag
- The tag of the fieldrow
- The row of the table you're interested in.public static double parseDouble(java.lang.String s)
s
- The String to be parsed.public static void setRollModified(java.lang.Object expr, boolean b)
expr
- The expression whose "modified" state you would like to set.b
- true
for modified, false
otherwise.public static void setCharacterSheetDataDeferred(java.lang.Object icon, int row, java.lang.String tag, java.lang.Object data)
postDeferredCharacterSheetUpdates()
.
Note, however, that all updates must belong to a single Icon (otherwise
any potential benefit would be lost).icon
- Reference to the Icon whose character sheet will be updated.row
- The row of the table to be updated.tag
- The Field's tag.data
- The data to (eventually) place into the Field.postDeferredCharacterSheetUpdates()
public static void postDeferredCharacterSheetUpdates()
setCharacterSheetDataDeferred(java.lang.Object, int, java.lang.String, java.lang.Object)
public static java.lang.Object[] getMapDeadIcons(java.lang.Object o)
o
- The Map to retrieve the "dead" Icons from.null
if the
supplied Map does not contain any "dead" Icons.public static java.awt.geom.Rectangle2D getViewportBounds()
null
if there is no current Map.public static java.awt.geom.Rectangle2D getIconBounds(java.lang.Object o)
o
- The Icon whose bounds should be returned.public static void createDrawnItem(java.awt.geom.Rectangle2D bounds, boolean square, java.awt.Color fillColor, java.awt.Color lineColor, int opacity, boolean visible, java.lang.String name, java.lang.String description)
bounds
- The absolute bounds of the DrawnItem.square
- true
if the DrawnItem should be square, false
if it
should be circular.fillColor
- The Color to fill the DrawnItem with.lineColor
- The Color to use for drawing the DrawnItem's outline.opacity
- The opacity of the DrawnItem (100 = fully opaque).visible
- true
if the DrawnItem should be visible to Players.name
- The name of the DrawnItem.description
- The description for the DrawnItem.public static int getCharacterSheetTableRows(java.lang.Object o, java.lang.String tag)
o
- Reference to the Icon whose character sheet is being looked attag
- The "table-tag" of the tablepublic static int parse(java.lang.Object icon, java.lang.String s)
The input string should contain only one expression (as opposed to multiple expressions), or else unexpected results might be returned.
Also, the expression need not be surrounded by curly braces ("{" and "}"), as this method will surround the expression with them if they are missing.
icon
- The Icon to use as reference.s
- A string containing an expression to be parsed. Keep it simple, since
we only return the integer result of the expression (and not the
fully parsed result string.public static boolean isNPC(java.lang.Object icon)
icon
- the Icon to checkTRUE
if the Icon is an NPC, FALSE
otherwise.public static boolean isPC(java.lang.Object icon)
icon
- the Icon to checkTRUE
if the Icon is a PC, FALSE
otherwise.public static boolean isItem(java.lang.Object icon)
icon
- the Icon to checkTRUE
if the Icon is an Item, FALSE
otherwise.public static void addIconEffect(java.lang.Object o, java.lang.String desc, java.lang.String duration, java.lang.String remaining, java.lang.String show, boolean active, boolean removeWhenExpired, boolean saveToEnd, java.lang.String mods)
o
- Reference to the Icon that should have the effect added to it.desc
- The effect's descriptionduration
- The effect's duration as either a number converted to a string, or
in "3d6h12m" notationremaining
- The effect's remaining time as either a number or in "3d6h12m" notationshow
- IE_Show
for Players to see all the details of the effect,
IE_NoShow
for Players to see nothing and
IE_DescOnly
for Players to only see the description. Note
that if the effect is created by a Player, then this parameter is
ignored and set to IE_Show
.active
- IE_Active
if the effect is in effect, IE_NotActive
otherwiseremoveWhenExpired
- IE_RemoveWhenExpired
if the effect should be deleted after it expires,
IE_NoRemoveWhenExpired
otherwisesaveToEnd
- IE_SaveToEnd
if a "saving throw" is required to remove this effect,
IE_NoSaveToEnd
otherwisemods
- String conaining the modifiers applied to the Icon by this effect (comma
seperated, TOKEN=modifier)
For the special tokens GLOW, RING, SQR, SQRG, the "modifier" portion of the
"mods" string has a special format (since these tokens contain their own
array of sub-options).
The format for these is:
sub-token:sub-value;sub-token:sub-value;...The recognized "sub-tokens" are:
radius: the radius of the Effect (a double) color: the color of the Effect (an RGB triplet, for example: #FFFFFF) opacity: the opacity of the Effect (a double in the range of 0.0 to 1.0) blur: the amount of blurring to apply to "glows" (an integer)Sub-tokens can appear in any order and will default to reasonable values if not included.
public static void addIconEffect(java.lang.Object o, java.lang.String desc, int end, java.lang.Object endIcon, java.lang.String show, boolean active, boolean removeWhenExpired, boolean saveToEnd, java.lang.String mods)
o
- Reference to the Icon that should have the effect added to it.desc
- The effect's descriptionend
- IE_Start
for the start of the round/turn,
IE_End
for the end of the round/turn,
IE_Encounter
for the end of the "encounter"endIcon
- The Icon on whose initiative the Effect will expireshow
- IE_Show
for Players to see all the details of the effect,
IE_NoShow
for Players to see nothing and
IE_DescOnly
for Players to only see the description. Note
that if the effect is created by a Player, then this parameter is
ignored and set to IE_Show
.active
- IE_Active
if the effect is in effect, IE_NotActive
otherwiseremoveWhenExpired
- IE_RemoveWhenExpired
if the effect should be deleted after it expires,
IE_NoRemoveWhenExpired
otherwisesaveToEnd
- IE_SaveToEnd
if a "saving throw" is required to remove this effect,
IE_NoSaveToEnd
otherwisemods
- String containing the modifiers applied to the Icon by this effect (comma
separated, TOKEN=modifier)
For the special tokens GLOW, RING, SQR, SQRG, the "modifier" portion of the
"mods" string has a special format (since these tokens contain their own
array of sub-options).
The format for these is:
sub-token:sub-value;sub-token:sub-value;...The recognized "sub-tokens" are:
radius: the radius of the Effect (a double) color: the color of the Effect (an RGB triplet, for example: #FFFFFF) opacity: the opacity of the Effect (a double in the range of 0.0 to 1.0) blur: the amount of blurring to apply to "glows" (an integer)Sub-tokens can appear in any order and will default to reasonable values if not included.
public static void logDebuggingInfo(java.lang.String s)
s
- The String to output to the Java Output console.public static boolean isPlayer()
true
false if the application is is Master (GM) mode.public static java.awt.geom.Point2D captureMouseClick(java.lang.Object icon)
public static java.awt.Color getRollColor(java.lang.String type)
type
- the type of roll color to retrievenull
if no
color has been assigned for the given type.public static java.lang.String colorToHex(java.awt.Color c)
c
- the color to transformnull
if the color could not be transformedpublic static java.lang.Object parseFull(java.lang.Object icon, java.lang.String s)
parse
methods available, this one does not produce any
directly usable results. Instead, it takes the supplied string (which must follow the
conventions of the other parse
methods) and wraps it in an Object that stores
all the results of the expression (integer result, double result and all the result strings).
After calling this method, you can use the returned object to call one of the retrieve
methods to pull the desired output from the object.
icon
- Icon references
- the expression to parseretrieve
methods.retrieveIntResult(java.lang.Object)
,
retrieveDoubleResult(java.lang.Object)
,
retrieveFullResult(java.lang.Object)
,
retrievePlayerResult(java.lang.Object)
public static int retrieveIntResult(java.lang.Object o)
o
- the previously parsed objectparseFull(java.lang.Object, java.lang.String)
public static double retrieveDoubleResult(java.lang.Object o)
o
- the previously parsed objectparseFull(java.lang.Object, java.lang.String)
public static java.lang.String retrieveFullResult(java.lang.Object o)
o
- the previously parsed objectparseFull(java.lang.Object, java.lang.String)
public static java.lang.String retrievePlayerResult(java.lang.Object o)
o
- the previously parsed objectparseFull(java.lang.Object, java.lang.String)
public static boolean modifyIconEffect(java.lang.Object icon, java.lang.String desc, java.lang.String[] args)
args
parameter is an array of name/value pairs,
much like arguments are passed to a program.
For example:
String[] args = { "duration", "1", "active", "false", };Like program arguments, the "names" must follow a particular format in order for them to be recognized. Currently recognized names are:
description: Effect description duration: Effect duration remaining: Time remaining show: Show the Effect (one of "Y," "N" or "D") end: End behavior (either "Start" or "End") active: Effect is active (either "true" or "false") remove: Remove the Effect (either "true" or "false") save: Save to end (either "true" or "false") mods: The modifiers for the Effect (TOKEN=value,TOKEN=value...)For the special tokens GLOW, RING, SQR, SQRG, the "value" portion of the "mods" string has a special format (since these tokens contain their own array of sub-options). The format for these is:
sub-token:sub-value;sub-token:sub-value;...The recognized "sub-tokens" are:
radius: the radius of the Effect (a double) color: the color of the Effect (an RGB triplet, for example: #FFFFFF) opacity: the opacity of the Effect (a double in the range of 0.0 to 1.0) blur: the amount of blurring to apply to "glows" (an integer)Sub-tokens can appear in any order and will default to reasonable values if not included.
icon
- The Icon whose Effect you would like to modifydesc
- The description of the Effect you are looking forargs
- What to modify (see above)true
if the Effect was modified, false
otherwisepublic static void masterChatMsg(java.lang.Object icon, boolean special, java.awt.Color c, java.lang.String msg, boolean toAll)
Note: This method can only be called when the application is running as a Master.
icon
- The Icon issuing the message (if any)special
- TRUE indicates that this is a "special" message, which will be
rendered in italics. FALSE indicates that it is a "normal" message.c
- The color to use for this message (or null for the default).msg
- The message to send.toAll
- TRUE sends the message to all Clients as well. FALSE keeps it to the
Master.public static java.lang.Object[] getRollTargets(java.lang.Object icon)
icon
- The Icon making the roll.null
if there are no targets for the roll.public static java.lang.Object[] getSelectedIconsOnMap(java.lang.Object map)
map
- The Map to query.null
if there was a problem.public static int getHpAdjustment(java.lang.Object icon, java.lang.String desc, int amt, java.lang.String fieldName)
icon
- The Icon to query for adjustmentsdesc
- The description of the of the adjustment being madeamt
- The amount of the adjustmentfieldName
- The name of the hit point field to check againstpublic static int getTableColumn(java.lang.String tableTag, java.lang.String columnTag)
tableTag
- the tag of the table you are interested in.columnTag
- the tag of the column whose index you would like to know.-1
if the column was not found.public static void setCharacterSheetDataDeferred(java.lang.Object icon, java.lang.String tableTag, java.lang.Object[] data)
postDeferredCharacterSheetUpdates()
.
Note, however, that all updates must belong to a single Icon (otherwise
any potential benefit would be lost).
This method replaces an entire table, so use it wisely.icon
- Reference to the Icon whose character sheet will be updated.tableTag
- The Table's tag.data
- The data to (eventually) place into the Table.postDeferredCharacterSheetUpdates()
public static java.lang.Object[] getIconEffectsForValue(java.lang.Object o)
getIconEffectValue
to retrieve the individual properties
of the Effect.o
- Reference to the Icon whose Effects you'd like to retrieve.getIconEffectValue(java.lang.Object, java.lang.String)
public static java.lang.Object getIconEffectValue(java.lang.Object effect, java.lang.String key)
key
must be one of the following
values (case is ignored):
DESC: the Effect's description (a String) DURATION: the Effect's duration (a Double) REMAINING: the amount of time remaining for the Effect (a Double) SHOW: the "show" setting for Player visibility of the Effect (a String: "Y," "N," or "D") END: the "end" behavior of the Effect (a String: "Start," "End," or "Encounter") ICON: the ID of the Icon on whose turn the Effect expires (a Long) ACTIVE: whether the Effect is active or not (a Boolean) REMOVE: whether the Effect should be removed when it expires (a Boolean) SAVE: whether a "save" is required to end the Effect (a Boolean) MODS: the modifiers the Effect defines (a String)Note that not all properties are valid for all game systems, so always check your results.
effect
- the Effectkey
- the keyword for the property you would like to retrievenull
getIconEffectsForValue(java.lang.Object)
public static double measureTargetDistance(java.lang.Object o1, java.lang.Object o2)
o1
- The Icon you are measuring from.o2
- The Icon you are measuring to.public static void visualEffect(java.awt.geom.Point2D p, double radius, java.lang.String effect, java.lang.String sound)
p
- The point from which the effect originatesradius
- The size (in feet) the resulting effect should scale toeffect
- The effect -- either a color or the name of an Effectsound
- The sound to play when the effect is createdpublic static boolean isGridSnapEnabled(java.lang.Object map)
map
- The Map to checktrue
if grid snap is enabled, false
otherwisepublic static void requestFocus(java.awt.Component c)
Component
receive keyboard focus.
This is handy when a script opens a dialog and would like a particular
component in that dialog to receive keyboard focus once the dialog becomes
visible (note that this is generally not possible when using JOptionPane-based
dialogs).c
- The component to receive keyboard focus