Difference between revisions of "Extended Iptscrae Scripting"
Line 776: | Line 776: | ||
0 ME REMOVEPIC | 0 ME REMOVEPIC | ||
</pre> | </pre> | ||
===PAUSEPIC=== | |||
Pauses a gif animation. | |||
* Parameters: | |||
** state: Spot's state that the picture is in. | |||
** SpotID: The ID of the hotspot that the picture is in. | |||
===REMOVEPIC=== | ===REMOVEPIC=== | ||
Removes a pic from the doors specified | Removes a pic from the doors specified state. Also removes the image from ram, a good way to manage a large number of images. | ||
* Parameters: | * Parameters: | ||
** | ** state: Specifies which spotstate that the pictures in. | ||
** SpotID: The ID of the hotspot that the picture is being removed from. | ** SpotID: The ID of the hotspot that the picture is being removed from. | ||
Line 789: | Line 796: | ||
0 ME REMOVEPIC | 0 ME REMOVEPIC | ||
</pre> | </pre> | ||
===RESUMEPIC=== | |||
Resumes a gif animation after having used the PAUSEPIC function. | |||
* Parameters: | |||
** state: Spot's state that the picture is in. | |||
** SpotID: The ID of the hotspot that the picture is in. | |||
===ROOMPICNAME=== | ===ROOMPICNAME=== | ||
Line 806: | Line 820: | ||
ROOMWIDTH RANDOM POSY SETPOS | ROOMWIDTH RANDOM POSY SETPOS | ||
</pre> | </pre> | ||
===ROOMHEIGHT=== | ===ROOMHEIGHT=== | ||
Line 818: | Line 830: | ||
</pre> | </pre> | ||
===SETPICFRAME=== | |||
Sets the current frame in a gif animation. | |||
* Parameters: | |||
** frameIndex: The frame index you wish to set the gif animation to. | |||
** state: The spot state that the picture is in. | |||
** SpotID: The ID of the spot that the picture is in. | |||
===SETLOCLOCAL=== | ===SETLOCLOCAL=== |
Revision as of 22:05, 3 April 2011
This page documents all the new Iptscrae commands and events that are supported by PalaceChat. This documentation assumes you already have a general knowledge of the Iptscrae scripting language. If you do not already have a general understanding of the Iptscrae scripting language it is recommended you read through the original Iptscrae Scripting Manual
New Events
ON COLORCHANGE
This event will fire when a user changes their color. The special variable WHOCHANGE contains the users ID.
ON FACECHANGE
This event will fire when a user changes their face. The special variable WHOCHANGE contains the users ID.
ON FRAMECHANGE
This event will fire every time the frame changes for a animated gif that is in the current spot state. The special variable FRAME contains the index number.
ON HTTPERROR
This event will fire when a download error occurs after a HTTPGET command is issued. The special variable ERRORMSG contains the error message.
ON HTTPRECIEVED
This event will fire when a HTTPGET download has completed. Exclusive variables HEADERS, CONTENTS, FILENAME and TYPE are available for this event. HEADERS is the http recieved headers as a Hash element. FILENAME is the name of the file recieved. TYPE is the Content-Type recieved. CONTENTS is a Atomlist if TYPE = "text/iptscrae" but will be a string for all other content-type's.
Some received content types will be processed internally right after this event occurs. Types being iptscrae,images, and html. To prevent this from occurring you can set CONTENTS to ""
ON KEYDOWN
This event will fire when the user presses a key on the keyboard (other then a macro key and other then a face/color change key). This event will only fire when the enviornment is in focus and will NOT fire when typing into the chatfield. Special variable KEYSTR contains the key that was pressed. Setting KEYSTR to "" will hault the chatfield from gaining focus like it normally would when the user types into the enviornment.
ON KEYUP
This event will fire when the user releases a key on the keyboard (other then a macro key and other then a face/color change key). This event will only fire when the enviornment is in focus and will NOT fire when typing into the chatfield. Special variable KEYSTR contains the key that was pressed.
ON IDLE
This event will be fired when the user is idle for 10 minutes.
ON MOUSEDRAG
This event will fire continuously as the user clicks and drags on a hotspot.
ON MOUSEDOWN
This is the exact same as the ON SELECT event.
ON MOUSEMOVE
This event will be fired continuously as the user moves the mouse cursor over the hotspot's area.
ON MOUSEUP
This event will fire when a user clicks a hotspot after releasing their mouse button, if the mouse is still over the hotspot when the button is released.
ON NAMECHANGE
This event will fire when any user changes their username. Variable WHOCHANGE contains the ID of the user who has changed there name, and variable LASTNAME contains the name they had previous to the change.
Example:
ON NAMECHANGE { LASTNAME " has changed his/her username to " & WHOCHANGE WHONAME & LOGMSG }
ON ROLLOVER
This event will be fired when the user's mouse cursor enters the hotspot's area.
Example:
ON ROLLOVER { 1 ME SETSPOTSTATELOCAL ; Make button glow }
ON ROLLOUT
This event will be fired when the user's mouse cursor leaves the hotspot's area.
Example:
ON ROLLOUT { 0 ME SETSPOTSTATELOCAL ; Make button return to normal }
ON ROOMLOAD
This event will fire right before the room is rendered. It is useful for making local changes to whats displayed in the room in a seemless way.
ON ROOMREADY
IMPORTANT: This event is not yet implemented.
This event will be fired once all the images for the current room have been downloaded and processed. Any usage of the new ROOMWIDTH and ROOMHEIGHT commands should be in this event handler, as the actual room size is unknown until the background image has been processed.
Example:
ON ROOMREADY { "The room graphics have finished downloading." LOGMSG "This room is sized: " ROOMWIDTH ITOA & "x" & ROOMHEIGHT ITOA & "." & LOGMSG }
ON SERVERMSG
All messages except user chat and local messages will fire this event. Variable CHATSTR contains the message.
Example:
ON SERVERMSG { CHATSTR LOGMSG }
ON STATECHANGE
This event will fire when a doors state is changed.
Example:
ON STATECHANGE { ME GETSPOTSTATE newState = "New state is: " newState ITOA & LOGMSG "Previous state was: " LASTSTATE ITOA & LOGMSG }
ON USERENTER
This event will fire when any user enters the room. Variable WHOENTER contains the ID of the user who has entered.
Example:
ON USERENTER { "Hello " WHOENTER WHONAME & SAY }
ON USERLEAVE
This event will fire when any user leaves the room. Variable WHOLEAVE contains the ID of the user who has left.
Example:
ON USERLEAVE { "Hello " WHOLEAVE WHONAME & SAY }
ON USERMOVE
This event will fire when any user moves. Variable WHOMOVE contains the ID of the user who has moved.
Example:
ON USERMOVE { WHOMOVE WHOPOS y = x = x ITOA " " & y ITOA & LOGMSG }
ON WEBSTATUS
This event will fire in the door of a WEBEMBED when its status changes Special variable NEWSTATUS contains the new status string.
ON WEBTITLE
This event will fire in the door of a WEBEMBED when its title changes Special variable NEWTITLE contains the new title string.
ON WEBDOCBEGIN
This event will fire in the door of a WEBEMBED when a document is beginning to download. Special variable DOCURL contains the url string.
ON WEBDOCDONE
This event will fire in the door of a WEBEMBED when a document is finished downloading. Special variable DOCURL contains the url string.
Example:
ON WEBDOCDONE { { "The web page has finished loading!" LOGMSG } ME WEBLOCATION DOCURL == IF }
New Commands
General Utility
ADDHEADER
Add a custom header for the HTTPGET command.
- Parameters:
- headerName: The name of the header you wish to add.
- headerValue: The value of the header you wish to add.
Example:
"name" USERNAME ADDHEADER
ALERTBOX
This command will open a popup box with a custom message.
- Parameters:
- message: The message to be displayed in the popup box.
Example:
"Hello world!" ALERTBOX
BITAND
Performs a bitwise And comparison of two numbers.
- Parameters:
- value1: the first number.
- value2: the second number.
Example:
{"True story bro." SAY} 1 1 BITAND IF
BITOR
Performs a bitwise Or comparison of two numbers.
- Parameters:
- value1: the first number.
- value2: the second number.
BITSHIFTLEFT
Performs a bitwise ShiftLeft operation on a number (shifting the bits by the amount specified).
- Parameters:
- aNumber: The value to be shifted.
- shiftAmount: The amount to shift left by.
BITSHIFTRIGHT
Performs a bitwise ShiftRight operation on a number (shifting the bits by the amount specified).
- Parameters:
- aNumber: The value to be shifted.
- shiftAmount: The amount to shift right by.
BITXOR
Performs a bitwise Xor operation of two numbers.
- Parameters:
- value1: the first number.
- value2: the second number.
CHARTONUM
Returns as an number, the ASCII value for a character.
- Parameters:
- character: A string character.
Example:
;now ipt knows its abc's in numeric form! "ABCDEFGHIJKLMNOPQRSTUVWXYZ" abc = abc STRLEN len = { abc i 1 SUBSTRING CHARTONUM ITOA logmsg i++}{len i >} WHILE
CLEARTOOLTIP
This command will close the tooltip set by the SETTOOLTIP command.
CONFIRMBOX
This command will open a popup box with a custom message and OK and Cancel button and return the result.
- Parameters:
- message: The message to be displayed in the popup box.
Example:
{"I pressed OK" SAY} {"I pressed Cancel" SAY} "Do you want to continue?" CONFIRMBOX IFELSE
ENCODEURL
Useful for converting a string into a HTTP url safe encoding.
- Parameters:
- urlComponent: A string to be converted.
Example:
USERNAME ENCODEURL SAY
DECODEURL
Useful for converting a string from a HTTP url safe encoding.
- Parameters:
- urlComponent: A string to be converted.
Example:
"This%20is%20a%20test%21" DECODEURL SAY
HASHTOJSON
Converts a Hash element into a JSON string.
- Parameters:
- hashElement: The hash element to be converted into a json string.
Example:
NEWHASH myhash = "foo" myhash "bar" PUT myhash HASHTOJSON LOGMSG
HTTPGET
This command will download the passed url via HTTP protocol. If the recieved Content-Type is text/iptscrae or text/plain the downloaded contents will be executed as iptscrae (currently the only valid text encoding is utf-8). If the recieved Content-Type is text/html it will be rendered in a popup window. If the recieved Content-Type is image/* (meaning any image format) it will save (and reload that image if its filename is present in the room). The filename can be set by using the Content-Disposition header (ie. Content-Disposition: inline; filename="test.png"). If the HTTPGET command was executed via the Cyborg the image recieved will be imported as an Prop. The headers that are sent from the client are: Accept-Charset, Accept-Language, Accept-Encoding, User-Agent, Origin, Userkey, Referer
- Parameters:
- url: The request url.
Example:
"http://pchat.org/api/headers.php" HTTPGET
HTTPCANCEL
Used to cancel all HTTPGET requests. When executed in a cyborg script it will only cancel cyborg generated requests. When executed in a room script it will only cancel room generated requests.
Example:
ON LEAVE { HTTPCANCEL }
JSONTOHASH
Parses and converts a JSON string into a Hash element. You can then use the GET or PUT commands to read or write to the Hash storage. JSON is widely used across the web as a popular data feed format, in combination with HTTPGET iptscrae is now more powerful then ever.
- Parameters:
- jsonString: The JSON string to be parsed and converted into a hash element.
Example:
"{\"foo\":\"bar\"}" JSONTOHASH myhash = myhash "foo" GET SAY
LOADWEBSITE
This command will load the website of the url passed in a popup window.
- Parameters:
- url: The website address to load in the popup.
Example:
"http://pchat.org" LOADWEBSITE
IPTVERSION
This command now returns 2 for both PalaceChat and OpenPalace.
Example:
{ "I'm using the latest version of iptscrae!" SAY } IPTVERSION 2 == IF
OPENPALACE
Pushes a 1 onto the stack if the user is using OpenPalace. On non-OpenPalace clients, it will be interpreted as an uninitialized variable, and will evaluate to 0 (zero.) You can use this function to detect OpenPalace and provide customized scripting for OpenPalace users.
Example:
{ "I'm using OpenPalace!" SAY } { "I'm not using OpenPalace! :-(" SAY } OPENPALACE IFELSE
PALACECHAT
Pushes the version number of the PalaceChat client onto the stack if the user is using PalaceChat. On non-PalaceChat clients, it will be interpreted as an uninitialized variable, and will evaluate to 0 (zero.) You can use this function to detect PalaceChat and provide customized scripting for PalaceChat users.
Example:
{ "I'm using PalaceChat!" SAY } { "I'm not using PalaceChat! :-(" SAY } PALACECHAT IFELSE
NBRSERVERUSERS
Pushes the number of users on the server onto the stack.
Example:
NBRSERVERUSERS ITOA SAY
NEWHASH
Creates a new blank hash element.
Example:
NEWHASH myhash = NBRROOMUSERS ARRAY ary = {i ROOMUSER WHONAME ary i PUT i++} ary FOREACH ROOMNAME myhash "roomname" PUT ary myhash "roomusers" PUT myhash HASHTOJSON LOGMSG
NUMTOCHAR
Returns the character whose ASCII value is passed.
- Parameters:
- codePoint: The numeric value of the character.
Example:
;now ipt knows its abc's? 65 i = { i NUMTOCHAR logmsg i++}{91 i >} WHILE
REGEXP
This works just like the command GREPSTR except that it's patterns are not specially filtered for backwards compatibility with scripts written for p32 like GREPSTR is. It uses the PCRE library, 7.7
REGEXPREPLACE
This works just like the command GREPSUB except that it is not limited to only 10 matches.
REMOVEHEADER
Removes a specific http header from the headers for HTTPGET.
- Parameters:
- headerName: The name of the header to be removed.
REPLACE
Replaces the first occurrence of a string with another string.
- Parameters:
- oldString: The string to be replaced.
- newString: The replacement string.
- sourceString: The original string.
Example:
"I find this handy." source = "it" "this" source REPLACE source = source LOGMSG
REPLACEALL
Replaces all occurrence of a string with another string.
- Parameters:
- oldString: The string to be replaced.
- newString: The replacement string.
- sourceString: The original string.
Example:
"I think that I am obessed with PalaceChat." source = "," " " source REPLACEALL source = source LOGMSG
RESETHEADERS
Resets all http headers for HTTPGET back to default.
SETCURSOR
Sets the cursor to one of the standard predefined cursors. Valid values are from 1 through 15, any other value will reset it to default.
SETCURSORPIC
Sets the cursor to use a custom picture.
- Parameters:
- x: The x cordinate in the picture to use as the click area.
- y: The y cordinate in the picture to use as the click area.
- fileName: The file name of the picture to use.
SETTOOLTIP
Opens a tooltip with the passed message.
- Parameters:
- message: The message for the tool tip.
Example:
ON ROLLOVER { "cool" SETTOOLTIP } ON ROLLOUT { CLEARTOOLTIP }
SETUSERNAME
This command sets your username (it does not save in preferences).
- Parameters:
- userName: The name to set.
Example:
"cool" SETUSERNAME
STOPALARM
This command haults an alarm that was generated in a specific spot. Meaning any SETALARM or ALARMEXEC will be canceled. It will not cancel room generated alarms if executed in a cyborg and will not cancel cyborg generated alarms if executed in a room script.
- Parameters:
- spotId: The spot id of the alarms that you want to cancel.
Example:
ME STOPALARM
STOPALARMS
This command haults all alarms. Meaning any SETALARM or ALARMEXEC or TIMEREXEC will be canceled. It will not cancel room generated alarms if executed in a cyborg and will not cancel cyborg generated alarms if executed in a room script.
TEXTSPEECH
This command will speak the passed string.
- Parameters:
- toSpeak: The string to be spoken.
Example:
"Hello world!" TEXTSPEECH
TIMEREXEC
This works just like the old command ALARMEXEC except that it uses the same context from which it was called in. Meaning local variables from the event from which it is called will be accessable in the timers atomlist making it so you don't have to use GLOBAL variables like you would have to in ALARMEXEC.
WHOCOLOR
Gets the facecolor of a the specified user.
- Parameters:
- userID: The ID of the user.
Example:
ON COLORCHANGE { WHOCHANGE WHONAME " has changed their color to " & WHOCHANGE WHOCOLOR ITOA & LOGMSG }
WHOFACE
Gets the facecolor of a the specified user.
- Parameters:
- userID: The ID of the user.
Example:
ON FACECHANGE { WHOCHANGE WHONAME " has changed their face to " & WHOCHANGE WHOFACE ITOA & LOGMSG }
Room and Hotspot Commands
ADDPIC
Adds a newly specified picture to the door, automatically downloading the image if nessacery.
- Parameters:
- fileName: The file name of the image.
- SpotID: The ID of the hotspot that the picture is to be added to.
Example:
"awsome.png" ME ADDPIC
CACHESCRIPT
This command lets you create and store a iptscrae event which will not be removed from memory until you log off of the server. After being created the event will be used in every room you visit on the server. This command will not function for Cyborg scripting.
- Parameters:
- atomlist: The scripting to be executed in the event created.
- eventName: The name of the event you wish to create.
Example:
{ROOMNAME SAY} "ENTER" CACHESCRIPT
FILEEXISTS
Checks if a file exists in the users local server media directory.
- Parameters:
- fileName: The name of the file to check for.
Example:
{"The file exists!" SAY} {"The file doesn't exist." SAY} "clouds.gif" FILEEXISTS IFELSE
GETPICDIMENSIONS
Pushes the width and height of the picture associated with the specified state of the specified hotspot.
- Parameters:
- state: The spot state that the picture is associated with, negative value will default it to the current state of the door.
- SpotID: The ID of the hotspot that the picture is in.
Example:
;this example gets the width and height of the current picture in ;the current door. -1 ME GETPICDIMENSIONS height = width =
GETPICLOC
Pushes the x and y cordinates of the picture associated with the specified state of the specified hotspot. The values are relative to the hotspots x and y cordinates.
- Parameters:
- state: The spot state that the picture is associated with, negative value will default it to the current state of the door.
- SpotID: The ID of the hotspot that the picture is in.
Example:
;this example gets the x and y of the current picture in the ;current door. -1 ME GETPICLOC y = x =
GETSPOTLOC
Pushes the x and y cordinates of the specified hotspot.
- Parameters:
- SpotID: The ID of the hotspot that the picture is in.
Example:
;this example gets the x and y of the current hotspot. ME GETSPOTLOC y = x =
GETPICBRIGHTNESS
This command returns the brightness value of a picture that was set with the SETPICBRIGHTNESS function.
- Parameters:
- state: The state of the spot id that the pic is in.
- spotId: The id of the spot that the pic is in.
GETPICOPACITY
This command returns the opacity value of a picture that was set with the SETPICOPACITY function.
- Parameters:
- state: The state of the spot id that the pic is in.
- spotId: The id of the spot that the pic is in.
GETPICSATURATION
This command returns the saturation value of a picture that was set with the SETPICSATURATION function.
- Parameters:
- state: The state of the spot id that the pic is in.
- spotId: The id of the spot that the pic is in.
GETPICNAME
This command returns the file name of the picture of the passed spot id and state.
- Parameters:
- state: The state of the spot id you get the picture name from.
- spotId: The id of the spot to get the picture name from.
Example:
;this example gets the file name of the picture of the current spot and state. -1 ME GETPICNAME SAY
GETPICPIXEL
This command returns the value of a pixel of a picture that is in a spot.
- Parameters:
- x: The x cordinates of the pixel relative to the room.
- y: The y cordinates of the pixel relative to the room.
- state: The state of the spot that the pic is in.
- spotId: The id of the spot that the pic is in.
Example:
;this example highlites a pic only if the cursor passes over a visible part of it ON MOUSEMOVE { ;get the pixel of a pic at the current mouse position in the current spot and state. ;the pixel value returned is a 32bit integer (ABGR pixel format) MOUSEPOS -1 ME GETPICPIXEL pixel = ;in order to isolate a color channel you must use BITSHIFTRIGHT ;shift 24 bits to the right to get alpha pixel 24 BITSHIFTRIGHT alpha = ;now test wether the alpha value is a zero or not (zero meaning invisible pixel) ;and increase the pictures brightness if alpha is a non-zero value {15 -1 ME SETPICBRIGHTNESS} {0 -1 ME SETPICBRIGHTNESS} alpha IFELSE }
HIDEAVATARS
Hides all avatars in the room. This could be useful for certain kinds of games. It only applies locally, for the user executing the script.
Example:
ON ENTER { HIDEAVATARS }
IMAGETOMEDIA
Saves an image file in the media folder with the passed filename and image data. Generally only good for being used in the ON HTTPRECIEVED event. If used in the HTTPRECIEVED event you must set CONTENTS to "" to prevent the file from being saved twice.
- Parameters:
- fileName: The file name you wish to save the image as.
- imageData: A string of raw image data.
Example:
ON HTTPRECIEVED { { "myimage.png" CONTENTS IMAGETOMEDIA "" CONTENTS = } TYPE "image/png" REGEXP IF }
ISKEYDOWN
Detect if a specific key is currently pressed down by its keycode.
- Parameters:
- keyCode: The keycode to check for as a number.
Example:
ON KEYDOWN { {"left arrow is being pressed" LOGMSG} 123 ISKEYDOWN IF {"right arrow is being pressed" LOGMSG} 124 ISKEYDOWN IF {"down arrow is being pressed" LOGMSG} 125 ISKEYDOWN IF {"up arrow is being pressed" LOGMSG} 126 ISKEYDOWN IF }
ISRIGHTCLICK
Detect if a click on a door is a right click.
Example:
ON SELECT { { "Right click." LOGMSG } { "Left click." LOGMSG } ISRIGHTCLICK IFELSE }
INSERTPIC
Inserts a newly specified picture to the door in the specified index, automatically downloading the image if nessacery.
- Parameters:
- fileName: The file name of the image.
- index: Specifies which spotstate
- SpotID: The ID of the hotspot that the picture is to be added to.
Example:
;inserting a picture to the first spot state of the door "awsome.png" 0 ME INSERTPIC
LOCINSPOT
Checks whether or not an X and Y coordinate is within a spot/door.
- Parameters:
- x: The x coordiante relative to the room.
- y: The y coordiante relative to the room.
- SpotID: The ID of the hotspot that you're checking if the xy is within.
Example:
;removes the picture from the first spot in the door. 0 ME REMOVEPIC
PAUSEPIC
Pauses a gif animation.
- Parameters:
- state: Spot's state that the picture is in.
- SpotID: The ID of the hotspot that the picture is in.
REMOVEPIC
Removes a pic from the doors specified state. Also removes the image from ram, a good way to manage a large number of images.
- Parameters:
- state: Specifies which spotstate that the pictures in.
- SpotID: The ID of the hotspot that the picture is being removed from.
Example:
;removes the picture from the first spot in the door. 0 ME REMOVEPIC
RESUMEPIC
Resumes a gif animation after having used the PAUSEPIC function.
- Parameters:
- state: Spot's state that the picture is in.
- SpotID: The ID of the hotspot that the picture is in.
ROOMPICNAME
Pushes the file name of the background image onto the stack.
Example:
ROOMPICNAME SAY
ROOMWIDTH
Pushes the width of the room's background image onto the stack. If the background image has not yet been loaded, it will push 512, the default room width, onto the stack.
Example:
;move the user to a random x position in the room. ROOMWIDTH RANDOM POSY SETPOS
ROOMHEIGHT
Pushes the height of the room's background image onto the stack. If the background image has not yet been loaded, it will push 384, the default room height, onto the stack.
Example:
;move the user to a random y position in the room. POSX ROOMHEIGHT RANDOM SETPOS
SETPICFRAME
Sets the current frame in a gif animation.
- Parameters:
- frameIndex: The frame index you wish to set the gif animation to.
- state: The spot state that the picture is in.
- SpotID: The ID of the spot that the picture is in.
SETLOCLOCAL
This command sets the absolute position of a hotspot locally. It doesn't change the hotspot's location in the room definition on the server. When a user re-enters a room, all hotspot locations will be reset to their state as specified in the pserver.pat file.
- Parameters:
- X: The position for the picture on the x axis relative to the hotspot's location.
- Y: The position for the picture on the y axis relative to the hotspot's location.
- SpotID: The ID of the spot you wish to modify.
Example:
20 40 ME SETLOCLOCAL
SETPICLOCLOCAL
Changes the location of the picture associated with the specified state of the specified hotspot. The coordinates are relative to the location of the hotspot.
- Parameters:
- X: The position for the picture on the x axis relative to the hotspot's location.
- Y: The position for the picture on the y axis relative to the hotspot's location.
- state: The spot state that the picture is associated with, negative value will default it to the current state of the door. (this parameter is only available with IPTSCRAE version 2 and higher)
- SpotID: The ID of the spot you wish to modify.
Example:
;good practice to check IPTVERSION for the state parameter. 20 40 {-1} IPTVERSION 1 > IF ME SETPICLOCLOCAL
SETPICBRIGHTNESS
It will interpret the command and read the parameters off the stack, which means your scripts will not break, but the command doesn't actually do anything.
Changes the brightness of the picture associated with the specified state of the specified hotspot.
- Parameters:
- Brightness: The pictures brightness. Valid values range from -100 to 100. Default is 0
- state: The spot state that the picture is associated with, negative value will default it to the current state of the door.
- SpotID: The ID of the spot you wish to modify.
Example:
;sets the current state picture to be brighter than normal. 50 -1 ME SETPICBRIGHTNESS
SETPICOPACITY
Changes the opacity of the picture associated with the specified state of the specified hotspot.
- Parameters:
- Opacity: The pictures opacity. Valid values range from 0 to 100. Default is 100
- state: The spot state that the picture is associated with, negative value will default it to the current state of the door.
- SpotID: The ID of the spot you wish to modify.
Example:
;sets the current state picture to half opacity. 50 -1 ME SETPICOPACITY
SETPICSATURATION
It will interpret the command and read the parameters off the stack, which means your scripts will not break, but the command doesn't actually do anything.
Changes the color saturation of the picture associated with the specified state of the specified hotspot.
- Parameters:
- Saturation: The pictures color saturation. Valid values range from -10000 to 10000. Default is 100
- state: The spot state that the picture is associated with, negative value will default it to the current state of the door.
- SpotID: The ID of the spot you wish to modify.
Example:
;sets the current state picture to greyscale. 0 -1 ME SETPICSATURATION
SETSPOTNAMELOCAL
Locally changes the name of the specified hotspot. Only updates for the user who is running the script. You might use this to display the current score in a game. You can hide a spot name by setting it to the empty string ("")
Example:
SCORE GLOBAL 15 SPOTID = "Your score is: " SCORE ITOA & SPOTID SETSPOTNAMELOCAL
SHOWAVATARS
Makes all avatars in the room visible again after a HIDEAVATARS command has hidden them.
Example:
ON SELECT { SHOWAVATARS }
WEBEMBED
Embeds a web browser control into the spot specified loading the url passed. It will fill the area of the spot. Passing a empty string will remove the web object.
- Parameters:
- url: The url of the website you wish to display.
- SpotID: The ID of the spot you wish to have the web control embedded.
Example:
"http://pchat.org" ME WEBEMBED
WEBLOCATION
Retrieve the current url of a WEBEMBED.
- Parameters:
- SpotID: The ID of the spot that the webembed is in.
Example:
ON WEBDOCDONE { { "The page is finished loading." LOGMSG } ME WEBLOCATION DOCURL == IF }
Prop Commands
IMAGETOPROP
Imports a image as a prop that is stored locally on the users hard drive in the servers media folder. This command is only allowed to be used in room scripting.
- Parameters:
- fileName: The name of the image file.
Example:
"cool.png" IMAGETOPROP
LOADPROPS
Allows you to pre-load props in the background. This is probably most useful for game developers. This is especially important on OpenPalace, because with a web-based client, there is no way to keep props cached from one session to the next, so they must be loaded from the server every time.
Important: You may only load up to 500 props at a time with this command. Attempting to load more will cause an Iptscrae error.
Example:
[ 48329285 394829 -195839523 ] LOADPROPS
LOOSEPROP
Pushes the prop id of the loose prop by index.
Example:
;this example causes you to wear the last dropped loose prop. 0 LOOSEPROP propId = propId DONPROP
LOOSEPROPIDX
Pushes the index of the loose prop by prop id onto the stack. If there are two or more loose props with the same id the index of the first one is pushed.
Example:
;this example asumes a prop with the id of 60035 is already a loose prop. 60035 LOOSEPROPIDX index = index REMOVELOOSEPROP
LOOSEPROPPOS
Pushes the x and y cordinates of a loose prop by index onto the stack.
Example:
;this example logs the cordinates of the last dropped loose prop. 0 LOOSEPROPPOS y = x = x ITOA " " & y ITOA & LOGMSG
MOVELOOSEPROP
Sets the location of a looseprop by index. The looseprop will not update its position until the server responds to the query.
- Parameters:
- X: The position for the loose prop on the x axis.
- Y: The position for the loose prop on the y axis.
- Index: The index of the looseprop within the room.
Example:
;move the last dropped looseprop to your mouse position. MOUSEPOS 0 MOVELOOSEPROP
NBRLOOSEPROPS
Pushes the number of loose props onto the stack.
Example:
;this example logs the prop id's of all the loose props in the room. { i LOOSEPROP ITOA LOGMSG i++ }{ i NBRLOOSEPROPS <} WHILE
PROPDIMENSIONS
Pushes the width and height of a prop onto the stack.
Example:
;this example logs the width and height of a prop. 60035 PROPDIMENSIONS height = width = width ITOA "x" & height ITOA & LOGMSG
PROPOFFSETS
Pushes the x and y offset of a prop relative to how it would appear on a user onto the stack.
Example:
;this example places a loose prop at your mouse position based on ;how it would appear on a user. 60035 PROPOFFSETS offy = offx = MOUSEPOS y = x = 60035 x offx + y offy + ADDLOOSEPROP
REMOVELOOSEPROP
Removes of a looseprop by index. The looseprop will not be removed until the server responds to the query.
Example:
;remove the last dropped looseprop. 0 REMOVELOOSEPROP
Drawing Commands
OVAL
Draws a oval with the current pen and penfill settings.
- Parameters:
- X: The position for the oval on the x axis relative to the center of the oval.
- Y: The position for the oval on the y axis relative to the center of the oval.
- Width: The width of the oval
- Height: The height of the oval.
Example:
;this example draws a large green oval across the room with ;50% opacity with a red border. 127 PENFILLOPACITY 0 255 0 PENFILLCOLOR 255 0 0 PENCOLOR 3 PENSIZE ROOMWIDTH w = ROOMHEIGHT h = w 2 / x = h 2 / y = x y w h OVAL
PENOPACITY
Sets the Opacity for drawn lines. Valid values range from 0 to 255. Be sure to set PENOPACITY back to 255 at the end of any script that uses it.
- Parameters:
- Opacity: The line opacity for lines, polygons and ovals.
Example:
;this example draws a line across the room with half opacity in the ;color red. 127 PENOPACITY 255 0 0 PENCOLOR 9 PENSIZE 0 0 ROOMWIDTH ROOMHEIGHT LINE 255 PENOPACITY ;be sure to reset the opacity to full after
PENFILLCOLOR
Sets the fill color for polygons and ovals. The parameters are identical to that of the function PENCOLOR. (red green blue)
Example:
;this example draws a large green oval across the room with 50% opacity ;with a red border. 127 PENFILLOPACITY 0 255 0 PENFILLCOLOR 255 0 0 PENCOLOR 3 PENSIZE ROOMWIDTH w = ROOMHEIGHT h = w 2 / x = h 2 / y = x y w h OVAL
PENFILLOPACITY
Sets the fill Opacity for polygons and ovals. Valid values range from 0 to 255. Setting PENFILLOPACITY to zero will turn fills off completely. The default value is zero.
- Parameters:
- Opacity: The fill opacity for polygons and ovals.
Example:
;this example draws a large green oval across the room with 50% opacity ;with a red border. 127 PENFILLOPACITY 0 255 0 PENFILLCOLOR 255 0 0 PENCOLOR 3 PENSIZE ROOMWIDTH w = ROOMHEIGHT h = w 2 / x = h 2 / y = x y w h OVAL
POLYGON
Draws a filled polygon if PENFILLOPACITY is not set to zero. Draws an array of lines if PENFILLOPACITY is zero.
- Parameters:
- Number Array: An array of x's and y's.
Example:
;draws a random color over the entire room with a semi translucent opacity. 0 PENOPACITY PENFRONT 255 RANDOM 255 RANDOM 255 RANDOM PENCOLOR 180 PENFILLOPACITY ROOMWIDTH x = ROOMHEIGHT y = [0 0 0 y x y x 0] POLYGON
DRAWTEXT
Draws text at the x and y provided in the current penfont, pencolor and penopacity.
- Parameters:
- X: The position for the text on the x axis.
- Y: The position for the text on the y axis.
- Text: The string of text to be drawn.
Example:
;draws red text in the top left corner of the room. "Arial" PENFONT PENFRONT 255 0 0 PENCOLOR 255 PENOPACITY "This is a test" 0 0 DRAWTEXT
PENFONT
Sets the font to be used in DRAWTEXT.
- Parameters:
- fontName: The exact name of the font to be used in quotes.
Example:
;draws red text in the top left corner of the room. "Arial" PENFONT PENFRONT 255 0 0 PENCOLOR 255 PENOPACITY 18 PENSIZE "This is a test" 0 0 DRAWTEXT
PENBOLD
Turns bold on or off for DRAWTEXT.
- Parameters:
- number: 0 turns bold off, 1 turns bold on.
Example:
;draws bold red text in the top left corner of the room. 1 PENBOLD "Arial" PENFONT PENFRONT 255 0 0 PENCOLOR 255 PENOPACITY 18 PENSIZE "This is a test" 0 0 DRAWTEXT
PENUNDERLINE
Turns underline on or off for DRAWTEXT.
- Parameters:
- number: 0 turns underline off, 1 turns underline on.
Example:
;draws bold red text in the top left corner of the room. 1 PENUNDERLINE "Arial" PENFONT PENFRONT 255 0 0 PENCOLOR 255 PENOPACITY 18 PENSIZE "This is a test" 0 0 DRAWTEXT
PENITALIC
Turns penitalic on or off for DRAWTEXT.
- Parameters:
- number: 0 turns penitalic off, 1 turns penitalic on.
Example:
;draws bold red text in the top left corner of the room. 1 PENITALIC "Arial" PENFONT PENFRONT 255 0 0 PENCOLOR 255 PENOPACITY 18 PENSIZE "This is a test" 0 0 DRAWTEXT
SHOWPAINT
Generates scripting based on paint currently drawn in the room. This command is just like the SHOWLOOSEPROPS command except for paint instead.