Extended Iptscrae Scripting

From PalaceChat
Revision as of 22:53, 20 February 2011 by Pawn (talk | contribs) (Created page with 'This page documents new Iptscrae commands that are supported by OpenPalace and [http://pchat.org/ PalaceChat]. =New Events= There are a few new hotspot events supported in OpenP…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

This page documents new Iptscrae commands that are supported by OpenPalace and PalaceChat.

New Events

There are a few new hotspot events supported in OpenPalace and PalaceChat. Be warned, however, that if you use these events in your script, users of the antiquated "The Palace" (Palace32) client will be presented with an Iptscrae Error for those event handlers in the log.

ON HTTPERROR

IMPORTANT: This event is not yet implemented in OpenPalace.

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

IMPORTANT: This event is not yet implemented in OpenPalace.

This event will fire when a HTTPGET download has completed. Special variables FILENAME and TYPE are available for this event.

ON IDLE

IMPORTANT: This event is not yet implemented in OpenPalace.

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

IMPORTANT: This event is not yet implemented in OpenPalace.

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

IMPORTANT: This event is not yet implemented in OpenPalace.

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 in OpenPalace or PalaceChat.

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

IMPORTANT: This event is not yet implemented in OpenPalace.

All messages except user chat and local messages will fire this event. Variable CHATSTR contains the message.

Example:

ON SERVERMSG {
CHATSTR LOGMSG
}


ON STATECHANGE

IMPORTANT: This event is not yet implemented in OpenPalace.

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

IMPORTANT: This event is not yet implemented in OpenPalace.

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

IMPORTANT: This event is not yet implemented in OpenPalace.

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

IMPORTANT: This event is not yet implemented in OpenPalace.

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

IMPORTANT: This event is not yet implemented in OpenPalace.

This event will fire in the door of a WEBEMBED when its status changes Special variable NEWSTATUS contains the new status string.

ON WEBTITLE

IMPORTANT: This event is not yet implemented in OpenPalace.

This event will fire in the door of a WEBEMBED when its title changes Special variable NEWTITLE contains the new title string.

ON WEBDOCBEGIN

IMPORTANT: This event is not yet implemented in OpenPalace.

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

IMPORTANT: This event is not yet implemented in OpenPalace.

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

IMPORTANT: This command is not yet implemented in OpenPalace.

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

IMPORTANT: This command is not yet implemented in OpenPalace.

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

CLEARTOOLTIP

IMPORTANT: This command is not yet implemented in OpenPalace.

This command will close the tooltip set by the SETTOOLTIP command.

CONFIRMBOX

IMPORTANT: This command is not yet implemented in OpenPalace.

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

IMPORTANT: This command is not yet implemented in OpenPalace.

Useful for converting a string into a HTTP url safe encoding.

  • Parameters:
    • urlComponent: A string to be converted.

Example:

USERNAME ENCODEURL SAY

DECODEURL

IMPORTANT: This command is not yet implemented in OpenPalace.

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

IMPORTANT: This command is not yet implemented in OpenPalace.

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

IMPORTANT: This command is not yet implemented in OpenPalace.

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 download 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

IMPORTANT: This command is not yet implemented in OpenPalace.

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

IMPORTANT: This command is not yet implemented in OpenPalace.

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

IMPORTANT: This command is not yet implemented in OpenPalace.

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

IMPORTANT: This command is not yet implemented in OpenPalace.

Pushes the number of users on the server onto the stack.

Example:

NBRSERVERUSERS ITOA SAY

NEWHASH

IMPORTANT: This command is not yet implemented in OpenPalace.

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

REGEXP

IMPORTANT: This command is not yet implemented in OpenPalace.

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

IMPORTANT: This command is not yet implemented in OpenPalace.

This works just like the command GREPSUB except that it is not limited to only 10 matches.

REMOVEHEADER

IMPORTANT: This command is not yet implemented in OpenPalace.

Removes a specific http header from the headers for HTTPGET.

  • Parameters:
    • headerName: The name of the header to be removed.

REPLACE

IMPORTANT: This command is not yet implemented in OpenPalace.

Replaces the first occurrence of a string with another string.

  • Parameters:
    • newString: The replacement string.
    • oldString: The string to be replaced.
    • sourceString: The original string.

Example:

"I find this handy." source =
"it" "this" source REPLACE source =
source LOGMSG

REPLACEALL

IMPORTANT: This command is not yet implemented in OpenPalace.

Replaces all occurrence of a string with another string.

  • Parameters:
    • newString: The replacement string.
    • oldString: The string to be replaced.
    • sourceString: The original string.

Example:

"I think that I am obessed with PalaceChat." source =
"," " " source REPLACEALL source =
source LOGMSG

RESETHEADERS

IMPORTANT: This command is not yet implemented in OpenPalace.

Resets all http headers for HTTPGET back to default.

SETTOOLTIP

IMPORTANT: This command is not yet implemented in OpenPalace.

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 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

Room and Hotspot Commands

ADDPIC

IMPORTANT: This command is not yet implemented in OpenPalace.

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

IMPORTANT: This command is not yet implemented in OpenPalace.

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 =

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

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 {
	{
		CONTENTS "myimage.png" IMAGETOMEDIA
		"" CONTENTS =
	} TYPE "image/png" REGEXP IF
}

ISRIGHTCLICK

Detect if a click on a door is a right click.

Example:

ON SELECT {
	{
		"Right click." LOGMSG
	}
	{
		"Left click." LOGMSG
	} ISRIGHTCLICK IFELSE
}

LOADSCRIPT

This function will download a script file from the media folder of the server where images and sounds are also stored. When the file completes downloading it immediately executes the scripting within it. This function should be handy for large game scripts and other misc things.

  • Parameters:
    • FileName: The name of the script file to download and execute.

Example:

ON ENTER {
"big-script.txt" LOADSCRIPT
}

INSERTPIC

IMPORTANT: This command is not yet implemented in OpenPalace.

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


REMOVEPIC

IMPORTANT: This command is not yet implemented in OpenPalace.

Removes a pic from the doors specified index. Also removes the image from ram, a good way to manage a large number of images.

  • Parameters:
    • index: 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

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


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

IMPORTANT: This command is not yet implemented in OpenPalace.

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

IMPORTANT: This command is not yet implemented in OpenPalace.

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

IMPORTANT: This event is not yet implemented in OpenPalace.

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

IMPORTANT: This event is not yet implemented in OpenPalace.

Retrive the current url of a WEBEMBED.

  • Parameters:
    • SpotID: The ID of the spot that the webembed is in.

Example:

ON WEBDOCDONE {
	{
		"The paage 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

IMPORTANT: This command is not yet implemented in OpenPalace.

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

IMPORTANT: This command is not yet implemented in OpenPalace.

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

IMPORTANT: This command is not yet implemented in OpenPalace.

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

IMPORTANT: This command is not yet implemented in OpenPalace.

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

IMPORTANT: This command is not yet implemented in OpenPalace.

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

IMPORTANT: This command is not yet implemented in OpenPalace.

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

IMPORTANT: This command is not yet implemented in OpenPalace.

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

IMPORTANT: This command is not yet implemented in OpenPalace.

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

IMPORTANT: This command is not yet implemented in OpenPalace.

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

IMPORTANT: This command is not yet implemented in OpenPalace.

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

IMPORTANT: This command is not yet implemented in OpenPalace.

Generates scripting based on paint currently drawn in the room. This command is just like the SHOWLOOSEPROPS command except for paint instead.