Files
joey aa2b2b098f Added new script command:
- level.putexplosion(radius, x, y)
2021-03-08 11:52:39 -05:00

162 lines
4.9 KiB
Plaintext

---------------------------
- RC requests address of npc-server once it receives a player with the (Server) nickname. Not sure if it makes a difference, but level is set as a space " ", account can be anything.
---------------------------
Scripting Reference:
Global:
Functions:
tokenize(string, token = ' ') - splits a string into tokens by the given character, defaults to space
Properties:
server (readonly, Server object)
Server Object:
Functions:
findlevel(string) - finds a level by name
findnpc(id/string) - finds an npc by id or name
savelog("filename", "message") - save a log message to a file in logs/
sendtonc("message") - outputs `message` to RC's with NC-access
sendtorc("message") - outputs `message` to RC's
Properties:
flags['key'] - retrieve/manipulate server flags
npcs - array of npcs on the server [probably shouldn't use this IMO]
players - array of players on the server
timevar - new world time
timevar2 - time elappsed since 1970
Level Object:
Functions:
findareanpcs(x, y, width, height) - get an array of npcs in this area
findnearestplayers(x, y) - gets an array of pairs of the distance and player object from the x/y
putexplosion(radius, x, y) - places an explosion in the level
putnpc(x, y, "script", options) - puts an npc in the level, options is currently unused as of now and can be left outputs
onwall(x, y) - returns if tile[x, y] is a wall tile
Properties:
name
issparringzone - true/false (read-only)
npcs - list of level npcs
players - list of players in the level
NPC Object:
Functions:
blockagain() - block players from moving through the npc
canwarp() - allows database npc to test for links
cannotwarp() - disables database npc link testing (default)
destroy() - only available for use on npcs created via putnpc
dontblock() - npc won't block player movement
drawoverplayer() - npc will draw over the player
drawunderplayer() - npc will draw under the player
hide() - hide the npc
message("message") - sets npc chat
move(x, y, time, options) - moves the npc by x/y over a specified time
scheduleevent(time, function, arg) - schedule an event to run at the specified time in seconds, arg can be an object of data (ex: { "foo": "bar", "player": player })
show() - show the npc
showcharacter() - displays a character instead of an image
setani("ani", "param0", "param1"..)
setcharani("ani", "param0", "param1"..) - same as above
setcharprop("code", "value") - sets character prop
setimg("filename") - sets npc image
setimgpart("filename", offsetx, offsety, width, height)
setshape(type, width, height) - sets shape of npc
join("className") - joins a class to the npc
registerTrigger("action", function) - registers an action for triggeractions
setpm(function) - only works for database npcs with the name "Control-NPC", each call will unset the previous binded function
warpto(levelname, x, y)
Properties:
id - (read-only)
ani
ap
attr[idx] (index can be between 1-30)
bodyimg
bombs
chat
colors[idx] - index range is 0-4
darts
dir
flags['key'] - retrieve/manipulate npc flags
glovepower
hearts
headimg
height (read-only)
horseimg
image
level - the level object
levelname
name (read-only, only set for database npcs for now)
nick
rupees
save[idx] - (index can be between 0-9)
shieldimg
swordimg
timeout
width (read-only)
x
y
Player Object:
Functions:
addweapon("weapon") - adds a weapon to the player
hasweapon("weapon") - checks if a player has a weapon
removeweapon("weapon") - removes a weapon from a player
disableweapons() - disables players weapons
enableweapons() - enables player weapons
freezeplayer() - freezes the player, preventing them from movement
unfreezeplayer() - unfreeze player
attached(npcid|npcobject) - returns true if the player is attached to the npc
attachnpc(npcid) - attachs a player to an npc
detachnpc() - detaches a player from an npc
join("className") - joins a class to the player
say("message") - sends a sign message to the player
sendrpgmessage("message") - sends a message to the players rpg window
sendpm("message") - sends a pm from the npc-server
setani("ani", "param0", "param1"..)
setlevel2("levelname", x, y) - warps a player to the level
triggeraction(x, y, "action", "args"..)
Properties:
id - (read-only)
account - (read-only)
ani
ap
attr[idx] - index range 1-30
bodyimg
bombs
chat
colors[idx] - index range is 0-4
darts
dir
hearts
headimg
flags['key'] - retrieve/manipulate player flags
fullhearts
glovepower
guild
isadmin
isclient
isstaff - true if account is in the staff= serveroptions
level - the level object
levelname
mp
nick
platform - os type (win/linux?)
rupees
shieldimg
shieldpower
swordimg
swordpower
weapons - array of weapon names
x
y
Weapon Object:
Functions:
Properties:
name
image