  | 
				Castle Paradox
    
				 | 
			 
		 
		 
	
		| View previous topic :: View next topic   | 
	 
	
	
		| Author | 
		Message | 
	 
	
		binoal
 
 
  
  Joined: 20 Jun 2009 Posts: 123 Location: My Own Little World
  | 
		
			
				 Posted: Fri Oct 16, 2009 5:41 am    Post subject: HELP MEEE! | 
				     | 
			 
			
				
  | 
			 
			
				So i need a favor. Could someone copy the text in plotscr.hsd and post it here? i can no longer get on my laptop to copy it, and the school computers block all downloads, so i can only copy existing text and paste into a text document. Id just use a proxy to download it, but the dansguardian blocking thingamajig blocks .zip extensions. _________________ Resident Evil RPG Demo
 
 
http://www.castleparadox.com/gamelist-display.php?game=963
 
 
Legend Of Zelda: Reptilian Warlord Demo
 
 
http://www.castleparadox.com/gamelist-display.php?game=961 | 
			 
		  | 
	 
	
		| Back to top | 
		 | 
	 
	
		  | 
	 
	
		TwinHamster ♫ Furious souls, burn eternally! ♫
 
 
  
  Joined: 07 Mar 2004 Posts: 1352
 
  | 
		
			
				 Posted: Fri Oct 16, 2009 8:22 am    Post subject:  | 
				     | 
			 
			
				
  | 
			 
			
				| A cheap flash drive (even the smallest of 'em should be more than enough for OHRRPGCE purposes) seems like it'd be really handy in your situation. | 
			 
		  | 
	 
	
		| Back to top | 
		 | 
	 
	
		  | 
	 
	
		Bob the Hamster OHRRPGCE Developer
 
 
  
  Joined: 22 Feb 2003 Posts: 2526 Location: Hamster Republic (Southern California Enclave)
  | 
		 | 
	 
	
		| Back to top | 
		 | 
	 
	
		  | 
	 
	
		binoal
 
 
  
  Joined: 20 Jun 2009 Posts: 123 Location: My Own Little World
  | 
		 | 
	 
	
		| Back to top | 
		 | 
	 
	
		  | 
	 
	
		binoal
 
 
  
  Joined: 20 Jun 2009 Posts: 123 Location: My Own Little World
  | 
		 | 
	 
	
		| Back to top | 
		 | 
	 
	
		  | 
	 
	
		Calehay ...yeah. Class B Minstrel
 
  
  Joined: 07 Jul 2004 Posts: 549
 
  | 
		
			
				 Posted: Mon Oct 19, 2009 6:23 am    Post subject:  | 
				     | 
			 
			
				
  | 
			 
			
				This is from a nightly that came out around a week and a half ago. Part I:
 
 
 	  | Code: | 	 		  # PLOTSCR.HSD (xocolatl)
 
# This file holds the language definition for OHRRPGCE plotscripting.
 
# modifying this file may have undesired/disasterous effects,
 
# but reading it can be somewhat educational. Especially the constants.
 
 
# functions marked with an x have not been implemented yet.
 
# functions marked with a ? are implemented but untested
 
 
#--------------------------------------------------------------------------
 
# hard coded functions
 
 
define function, begin
 
0,noop,0                    # no operation
 
1,wait,1,1                  # wait(cycles)
 
2,waitforall,0              # wait for script-related walking&panning to stop
 
3,waitforhero,1,0           # wait for hero to stop moving
 
4,waitfornpc,1,0            # wait for npc to stop moving
 
5,suspendnpcs,0             # pause normal NPC movement
 
6,suspendplayer,0           # stop the player from controlling stuff (except text boxes)
 
7,resumenpcs,0              # resume npc automation
 
8,resumeplayer,0            # unlock players controls
 
9,waitforkey,1,99           # wait for a keypress
 
10,walkhero,3,0,2,1         # walk hero(who,direction,distance)
 
11,showtextbox,1,1          # show a text box
 
12,checktag,1,0             # returns the value of a tag
 
13,settag,2,0,0             # set tag(#,true/false)
 
15,usedoor,1,0              # use door(#)
 
16,fightformation,1,0       # fight formation(#)
 
17,getitem,2,0,1            # get item(item,quantity)
 
18,deleteitem,2,0,1         # delete item(item,quantity)
 
19,leader,0                 # returns the current leader
 
20,getmoney,1,0             # get money(amount)
 
21,losemoney,1,0            #? lose money(amount) no checking
 
22,paymoney,1,0             # returns false and subtracts nothing if cannot afford
 
23,unequip,2,0,1            # (who,where)
 
24,forceequip,3,0,1,0       # (who,where,item)
 
25,setheroframe,2,0,0       # (who,frame) frame is 0 or 1
 
26,setNPCframe,2,0,0        # (who,frame) frame is 0 or 1
 
27,suspendoverlay,0         # turns off overhead tiles
 
28,playsong,1,0             # play song(#)
 
29,stopsong,0               # stop the music
 
30,keyval,1,0               # check key by scancode - returns value from keyval array
 
31,rankincaterpillar,1,0    # finds the heros position in the caterpillar
 
32,showbackdrop,1,0         # showbackdrop (#)
 
33,showmap,0                # cancels a showbackdrop
 
34,dismountvehicle,0        # dismount whatever vehicle you may be riding
 
35,useNPC,1,0               # trigger an NPC remotely
 
37,useshop,1,0              #? use shop(#)
 
38,camerafollowshero,1,0    # make camera follow a hero
 
39,camerafollowsnpc,1,0     # make camera follow an npc
 
40,pancamera,3,0,1,2        # pan camera(direction,distance,pixelstep)
 
41,focuscamera,3,0,0,2      # focus camera(x,y,pixelstep)
 
42,waitforcamera,0          # waits for pan or focus to finish
 
43,herox,1,0                # returns the hero's x coordinate
 
44,heroy,1,0                # returns the hero's y coordinate
 
45,npcx,1,0                 # returns the npc's x coordinate
 
46,npcy,1,0                 # returns the npc's y coordinate
 
47,suspendobstruction,0     # lets heros walk through NPCs and vice versa
 
48,resumeobstruction,0      # restores normal obstruction behavior
 
49,suspendherowalls,0       # lets heros walk through walls
 
50,suspendNPCwalls,0        # lets heros and npcs walk through walls
 
51,resumeherowalls,0        # restores normal hero wall behavior
 
52,walknpc,3,0,2,1          # walk npc(who,direction,distance)
 
53,setherodirection,2,0,2   # set hero direction(who,direction)
 
54,setnpcdirection,2,0,2    # set npc direction(who,direction)
 
55,getdefaultweapon,1,0     # (who)
 
56,setdefaultweapon,2,0,0   # (who,item)
 
57,suspendcatapillar,0      # misspelled alias for backcompat
 
58,resumecatapillar,0       # misspelled alias for backcompat
 
59,waitfortextbox,0         # waits for text box to go away
 
60,equipwhere,2,0,0         #? (who,item) returns the slot that an item can be equipped in, or false if the hero cant equip it
 
61,teleporttomap,3,0,0,0    # teleport to map (map,x,y)
 
62,suspendrandomenemys,0    # misspelled alias for backcompat
 
63,resumerandomenemys,0     # misspelled alias for backcompat
 
64,getherostat,3,0,0,0      # returns a hero's stat (who,stat,cur/max)
 
65,resumeoverlay,0          # turns overhead tiles back on
 
66,addhero,1,0              # adds a hero to the party
 
67,deletehero,1,0           # deletes a hero from the party
 
68,swapouthero,1,0          # move a hero out of the active party
 
69,swapinhero,1,0           # moves a hero into the active party (if there is room)
 
70,roominactiveparty,0      # returns the number of empty slots in the active party (0-3)
 
71,lockhero,1,0             # prevents swapping of a hero
 
72,unlockhero,1,0           #? reverses lockhero
 
73,gameover,0               # returns you to the title screen
 
74,setdeathscript,1,0       # changes what script is run when you die
 
75,fadescreenout,3,0,0,0    # fade screen out (red,green,blue)
 
76,fadescreenin,0           # fade back to color after fade screen out
 
77,showvalue,1,0            # display a number in the bottom left corner
 
78,alterNPC,3,0,0,0         # replaces one of an NPC's stats
 
79,shownovalue,0            # hide the number from showvalue
 
80,currentmap,0             # returns the number of the current map
 
81,setherospeed,2,0,4       # changes a heros walking speed
 
82,inventory,1,0            # returns the count of a given item
 
83,setherostat,4,0,0,1,0    # alters a hero's stats (who,stat,value,cur/max)
 
84,suspendboxadvance,0      # prevents user from advancing text boxes
 
85,resumeboxadvance,0       # reverses suspendboxadvance
 
86,advancetextbox,0         # as if the user had pressed a key
 
87,setheroposition,3,0,0,0  # arbitraraly set x,y
 
88,setNPCposition,3,0,0,0   # arbitraraly set x,y
 
89,swapbyposition,2,0,0     # swap two hero slots
 
90,findhero,1,0             # locate hero slot by hero name
 
91,checkequipment,2,0,1     # what is a hero equipped with? (who,where)
 
#92,daysofplay,0             # returns the days, these opcodes remain for compatability
 
#93,hoursofplay,0            # returns the hours
 
#94,minutesofplay,0          # returns the minutes
 
95,resumeNPCwalls,0         # restores normal NPC wall behavior
 
96,setheroz,2,0,0           # sets the hero's vertical position
 
97,readmapblock,3,0,0,0     # get mapblock x,y,layer
 
98,writemapblock,4,0,0,0,0  # set mapblock x,y,value,layer
 
99,readpassblock,2,0,0      # get passblock x,y
 
100,writepassblock,3,0,0,0  # set passblock x,y,value
 
101,NPCdirection,1,0        # return an NPC's direction
 
102,herodirection,1,0       # return a hero's direction
 
103,resetpalette,0          # return the master palette to defaults
 
104,tweakpalette,5,0,0,0,0,255 # alter the master palette
 
105,readcolor,2,0,0         # return a color value
 
106,writecolor,3,0,0,0      # change a color value
 
107,updatepalette,0         # apply changes made with writecolor
 
108,seedrandom,1,0          #? reseed the random number generator
 
109,greyscalepalette,2,0,255# convert the palette to greyscale
 
110,setheropicture,3,0,0,1  # who,picture,type
 
111,setheropalette,3,0,0,1  # who,palette,type
 
112,getheropicture,2,0,1    # who,type
 
113,getheropalette,2,0,1    # who,type
 
114,readglobal,1,0          # index
 
115,writeglobal,2,0,0       # index,value
 
116,heroiswalking,1,0       # (who)
 
#117,NPCiswalking,1,0       #x obsolete, backwards compatability only
 
118,suspendcaterpillar,0    # other heros stop following the leader, and can be manipulated separately.
 
119,resumecaterpillar,0     # turns catapillar party back on
 
120,NPCreference,2,0,0      # get an NPC reference by ID number
 
121,NPCatspot,3,0,0,0       # get NPC reference by X,Y
 
122,getNPCID,1,0            # get the ID number of an NPC reference
 
123,NPCcopycount,1,0        # find out how many copys of an NPC ID are on the map
 
124,changeNPCID,2,0,0       # given an NPC reference, changes its ID
 
125,createNPC,4,0,0,0,2     # create an NPC by ID at a location and return its reference
 
126,destroyNPC,1,0          # destroy the referenced NPC
 
127,teachspell,3,0,0,0      # (who,spell,learntype) tries to teach a hero a spell
 
128,forgetspell,2,0,0       # (who,spell) forget a learned spell
 
129,readspell,3,0,0,0       # (who,list,slot) returns the number of the spell in a slot
 
130,writespell,4,0,0,0,0    # (who,list,slot,spell) forces a hero to learn a spell
 
131,knowsspell,2,0,0        # (who,spell) returns true if the hero already knows this spell
 
132,canlearnspell,3,0,0,0   # (who,spell,learntype) returns true if the hero can learn the spell
 
133,herobyslot,1,0          # returns the hero ID/name of the hero at a particular slot in the party
 
134,herobyrank,1,0          # returns the hero ID/name of the hero at a particular rank in the caterpillar
 
135,puthero,3,0,0,0         #? (who,x,y) set hero pixel-position
 
136,putnpc,3,0,0,0          # (who,x,y) set npc pixel position
 
137,putcamera,2,0,0         # (x,y) set screen pixel position
 
138,heropixelx,1,0          #? (who) get hero pixel x
 
139,heropixely,1,0          #? (who) get hero pixel y
 
140,npcpixelx,1,0           # (who) get npc pixel x
 
141,npcpixely,1,0           # (who) get npc pixel y
 
142,camerapixelx,0          #? get camera pixel x
 
143,camerapixely,0          #? get camera pixel y
 
144,loadtileset,2,-1,-1     # load a new tileset for the current map
 
145,pickhero,0              # lets you manually pick a hero
 
146,renameherobyslot,1,0    # lets you manually rename a hero
 
147,readgeneral,1,0         # directly read from the in-memory array of general game data
 
148,writegeneral,2,0,0      # directly write to the in-memory array of general game data. If you crash your game with this command, don't be too surprised
 
150,statusscreen,1,0        # display the status screen for a hero
 
151,showminimap,0           # display the mini-map
 
152,spellsmenu,1,0          # display the spell menu for a hero
 
153,itemsmenu,0             # display the items menu
 
154,equipmenu,1,0           # display the equip menu for a hero
 
#155,savemenu,0             # obsolete in favor of ID 170
 
157,ordermenu,0             # display the order menu
 
158,teammenu,0              # display the team menu
 
159,initmouse,0             # init mouse, return true if a mouse is installed
 
160,mousepixelx,0           # returns mouse x coordinate on the screen
 
161,mousepixely,0           # returns mouse y coordinate on the screen
 
162,mousebutton,1,0         # returns true if the specified button is pressed
 
163,putmouse,2,160,100      # places the mouse at a point on the screen
 
164,mouseregion,4,0,319,0,199 # define the rectangle in which the mouse can move (xmin, xmax, ymin, ymax)
 
165,npcatpixel,3,0,0,0      # returns NPC at pixel x,y, third arg is which npc (on -1 returns number of npcs at pixel)
 
166,saveinslot,1,0       # save game in slot
 
167,lastsaveslot,0       # returns the last save slot the game was saved in, false if unsaved
 
168,suspendrandomenemies,0  # keeps random enemies from attacking
 
169,resumerandomenemies,0   # undoes suspendrandomenemies
 
170,savemenu,1,-1           # display the save menu
 
171,saveslotused,1,1        # returns true if a saved game exists in the specified slot
 
172,importglobals,3,1,-1,-1 # (slot) or (slot, id) or (slot, first, last) reads a range of globals from a save slot
 
173,exportglobals,3,1,0,4095 # (slot) or (slot, first, last) writes a range of globals to a save slot
 
174,loadfromslot,1,1        # loads saved game from slot
 
175,deletesave,1,1          # delete (hide from load/save screen - data not *actaully* deleted) specified slot
 
176,runscriptbyid,-1        # run a script by its id number and pass any number of arguments
 
177,NPCiswalking,1,0        # (who) returns true if walking (for real, unlike the old implementation)
 
178,readgmap,1,0            # read from general map data array
 
179,writegmap,2,0,0         # write a gmap data item
 
180,mapwidth,0              # returns map height in tiles
 
181,mapheight,0             # returns map width in tiles
 
182,readNPC,2,0,0           # reads information about an NPC on the current map (corresponds to alterNPC)
 
183,setherolevel,3,0,0,1    # change a hero's level
 
184,giveexperience,2,-1,1   # (who, how much) gives a hero or the active party experience
 
185,herolevelled,1,0        # number of levels gained last battle/giveexperience command.
 
186,spellslearnt,2,0,0      # number spells and spell ids hero learnt at last battle/giveexperience command.
 
187,getmusicvolume,0        # music volume on a scale of 0-255 regardless of implementation
 
188,setmusicvolume,1,128    # set music volume on a scale of 0-255
 
#189,getformationsong,1,0   # returns the song associated with a given formation + 1   (obsoleted by opcode 307)
 
190,setformationsong,2,0,0   # sets the song associated with a given formation
 
191,heroframe,1,0           # get hero walkabout frame
 
192,npcframe,1,0            # get npc walkabout frame
 
193,npcextra,2,0,1          # get npc extra data (ref, 1 or 2)
 
194,setnpcextra,3,0,1,0     # set npc extra data (ref, 1 or 2,what)
 
#195,loadsound,2,0,0         # loads a sound into a slot(slot, sfx) #DO NOT USE
 
#196,freesound,1,1           # frees an sfx slot(slot) #DO NOT USE
 
197,playsound,3,1,0,0       # plays an sfx (num, loop?, preempt?)
 
198,pausesound,1,1          # pauses an sfx (num) (stop, but don't rewind)
 
199,stopsound,1,1           # stops an sfx (num)  (stop, and rewind)
 
200,system hour,0
 
201,system minute,0
 
202,system second,0
 
203,current song,0
 
204,get hero name,2,0,0       # (string, hero) - puts the name of hero(hero) in string(string)
 
205,set hero name,2,0,0       # (string, hero) - sets the name of hero(hero) to string(string)
 
206,get item name,2,0,0       # (string, item) - puts the name of item(item) in string(string)
 
207,get map name,2,0,0       # (string, map) - puts the name of map(map) in string(string)
 
208,get attack name,2,0,0   # (string, attack) - puts the name of attack(attack) in string(string)
 
209,get global string,2,0,0 # (string, global) - puts the global string (global) in string(string)
 
210,showstring,1,0            #shows string on the bottom(stringID)
 
211,clearstring,1,0           #deletes the data from string(stringID)
 
212,appendascii,2,0,0         #adds ascii to string(stringID,ascii)
 
213,appendnumber,2,0,0        #adds number to string(stringID,number)
 
214,copystring,2,0,0          #copies string from one to another(sourceID,destinationID)
 
215,concatenatestrings,2,0,0  #adds two strings(sourceID,destinationID)
 
216,stringlength,1,0          #returns the length of string(stringID)
 
217,deletechar,2,0,1          #deletes character from string(stringID,position)
 
218,replacechar,3,0,1,0       #replaces character in the specified string(stringID,position,ascii)
 
219,asciifromstring,2,0,1     #returns the ascii in the string(ascii number)(stringID,position)
 
220,positionstring,3,0,0,0    #move a string to a position on the screen(stringID,x,y)
 
221,setstringbit,3,0,0,0      #set a string bit, such as: visibility, style(stringID,bit,value)
 
222,getstringbit,2,0,0        #return a string bit, such as: visibility, style(stringID,bit)
 
223,stringcolor,3,0,15,0      #set a string's color,also optional background color(stringID,fColor,bColor)
 
224,stringx,1,0               #return a string's X position(stringID)
 
225,stringy,1,0               #return a string's Y position(stringID)
 
226,systemday,0               #returns system day
 
227,systemmonth,0             #returns system month
 
228,systemyear,0              #returns system year
 
229,stringcompare,2,0,0         #returns whether two strings are the same(stringID1, stringID2)
 
230,readenemydata,2,0,0       #reads enemy data(enemy,dataposition)
 
231,writeenemydata,3,0,0,0    #writes enemy data(enemy,dataposition,value)
 
232,trace,1,0                 #writes the provided string to G_DEBUG.txt
 
233,getsongname,2,0,0         #get song name and store in string
 
234,loadmenu,1,-1             #show loadmenu (really load/quit?)
 
235,keyispressed,2,0,0        #check key by scancode, returns a bool
 
236,soundisplaying,1,0        #checks to see if a sound is playing (soundID)
 
#237,soundslots,0              #returns the number of slots available
 
238,searchstring,3,0,0,1      #Search string, (ID1,ID2,start)
 
239,trimstring,3,0,-1,1       #Trims the specified string, (ID, start,length)
 
240,stringfromtextbox,4,0,0,0,0 #loads string with whatever line in whatever textbox you specify
 
241,expandstring,1,0          #expand ${Hxx}, etc in a string(ID)
 
242,joystickbutton,2,0,0      #returns whether a given button is pressed (button, joystick)
 
243,joystickaxis,3,0,100,0    #returns the axis position (axis,multiplier,joystick)
 
244,waitforscancode,1,0       #waits for a specific scancode
 
245,savemapstate,2,255,255    #save map data to a temp file (savebits, customid)
 
246,loadmapstate,2,255,255    #load map data from a temp file (loadbits, customid)
 
247,resetmapstate,1,255       #reload original map data (loadbits)
 
248,deletemapstate,1,255      #delete temp map state files (deletebits)
 
249,partymoney,0              #retrieves amount of gold
 
250,setmoney,1,0              #sets amount of gold
 
251,setstringfromtable,2,0,0  #string support function
 
252,appendstringfromtable,2,0,0      #string support function
 
253,settileanimationoffset,3,0,0,0   #set offset from starting tile (animation pattern 0/1, offset, layer)
 
254,gettileanimationoffset,2,0,0     #get offset from starting tile (animation pattern 0/1, layer)
 
255,animationstarttile,2,0,0  #tile number which this tile starts its animation pattern off as (id of a tile, layer)
 
256,suspendmapmusic,0         #prevent ambient music from playing on entering a map
 
257,resumemapmusic,0          #reverse above
 
258,checkherowall,2,0,0       #check passability in a direction relative to a hero
 
259,checknpcwall,2,0,0        #check passability in a direction relative to an NPC
 
260,settimer,6,0,-1,-1,-1,-1,-1#start (or modify) a timer(id, count, speed, trigger, string, flags)
 
261,stoptimer,1,0             #convenience for settimer(id,-1,0)
 
262,readtimer,1,0             #returns the count of a timer(id)
 
263,getcolor,1,0           #returns a 32-bit color from the master palette(index)
 
264,setcolor,2,0,0           #writes a 32-bit color to the master palette(index,val)
 
265,rgb,3,0,0,0              #mixes red, green and blue into a 32-bit color(r, g, b)
 
266,extractcolor,2,0,0        #extracts an RGB component from a 32-bit color(color, component)
 
267,mainmenu,0                #opens the main menu
 
268,loadpalette,1,0           #load master palette
 
269,totalexperience,1,0       #experience gained by a hero
 
270,experiencetolevel,1,0     #total experience to reach a level
 
271,experiencetonextlevel,1,0 #experience to level up
 
272,setexperience,3,0,0,1     #set total experience (who,amount,allow spell forgetting)
 
273,milliseconds,0            #uptime in milliseconds
 
274,openmenu,2,0,0            #openmenu(menuID)
 
275,readmenuint,2,0,0         #read menu int(menuhandle,intid)
 
276,writemenuint,3,0,0,0      #write menu int(menuhandle,intid,n)
 
277,readmenuitemint,2,0,0     #read menu item int(menuitemhandle,intid)
 
278,writemenuitemint,3,0,0,0  #write menu item int(menuitemhandle,intid,n)
 
279,createmenu,0              #create a blank menu
 
280,closemenu,1,0             #close menu(handle)
 
281,topmenu,0                 #return a handle to the topmost menu
 
282,bringmenuforward,1,0      #bring menu forward(menu handle)
 
283,addmenuitem,1,0           #add menu item(menuhandle) appends, returns menuitemhandle
 
284,deletemenuitem,1,0        #delete menu item(menuitemhandle)
 
285,getmenuitemcaption,2,0,0  #get menu item caption(menuitemhandle, string ID)
 
286,setmenuitemcaption,2,0,0  #set menu item caption(menuitemhandle, string ID)
 
287,getlevelmp,2,0,0          #get level mp(hero party slot, mp level)
 
288,setlevelmp,3,0,0,0        #set level mp(hero party slot, mp level, new value)
 
289,bottommenu,0              #return a handle to the bottommost menu
 
290,previousmenu,1,0          #given a menu handle, return a handle to the menu beneath it
 
291,nextmenu,1,0              #given a menu handle, return a handle to the menu on top of it
 
292,menuitembyslot,3,0,0,true #menu item by slot(menu handle, slotnum, visible only) returns menuitemhandle
 
293,previousmenuitem,2,0,true #given a menuitemhandle return handle to the menu item before it
 
294,nextmenuitem,2,0,true     #given a menuitemhandle return handle to the menu item after it
 
295,selectedmenuitem,1,0      #selected menu item(menu handle) returns menuitemhandle
 
296,selectmenuitem,1,0        #select menu item(menu item handle) moves the cursor
 
297,parentmenu,1,0            #parent menu(menu item handle) returns menu handle
 
298,getmenuid,1,0             #menu ID(menu handle) returns the ID of the menu
 
299,swapmenuitems,2,0,0       #swap menu items(handle1, handle2)
 
300,findmenuitemcaption,4,0,0,0,1 #find menu item caption(menu handle, string ID, search after handle=false, visible only=true)
 
301,findmenuid,1,0            #find menu(menu ID) search open menus for menu ID and return menu handle
 
302,menuisopen,1,0            #menu is open(menu handle) # return true as long as the handle is still valid
 
303,menuitemslot,1,0          #menu item slot(menu item handle) returns a menu slot number
 
304,outsidebattlecure,3,0,0,-1 #out of battle cure(attack ID, target, attacker)
 
305,changetileset,2,-1,-1     #similar to loadtileset. (tileset,layer)
 
306,layertileset,1,0          #layer tileset(layer) returns tileset number in use
 
307,getformationsong,1,0      #returns the song associated with a given formation
 
308,addenemytoformation,5,0,0,85,95,-1 #add enemy to formation(formation, enemy id, x, y, slot = -1) returns slot or -1
 
309,findenemyinformation,3,0,0,0       #find enemy in formation(formation, enemy id, number) returns slot or -1 
 
310,deleteenemyfromformation,2,0,0     #delete enemy from formation(formation, slot)
 
311,formationslotenemy,2,0,0  #formation slot enemy (formation, slot) returns enemy in slot
 
312,formationslotx,2,0,0      #formation slot x(formation, slot) returns x of enemy in slot
 
313,formationsloty,2,0,0      #formation slot y(formation, slot) returns y of enemy in slot
 
314,setformationbackground,4,0,0,1,0   #set formation background(formation, background, animation frames, animation ticks)
 
315,getformationbackground,1,0 #get formation background(formation) returns background number
 
316,lastformation,0           #last formation fought
 
317,randomformation,1,0       #pick a formation from a formation set
 
318,formationsetfrequency,1,0 #returns (as percentage) set frequency
 
319,formationprobability,2,0,0 #returns (as percentage) formation being picked from formation set probability
 
320,currenttextbox,0          #currently displayed textbox or -1
 
321,getherospeed,1,0          #hero walk speed (hero)
 
322,loadherosprite,2,0,-1     #load hero sprite (number, palette)
 
323,freesprite,1,0            #frees a sprite (id)
 
324,placesprite,3,0,0,0       #move a sprite(id, x, y)
 
325,setspritevisible,2,0,0    #alias for set slice visible
 
326,setspritepalette,2,0,0    #set sprite palette(id, pal)
 
327,replaceherosprite,3,0,0,-1 #replaces the sprite with a hero sprite (id, num, pal)
 
328,setspriteframe,2,0,0      #what it says on the tin(id, num)
 
329,loadwalkaboutsprite,2,0,-1 #load walkabout sprite (number, palette)
 
330,replacewalkaboutsprite,3,0,0,-1 #replaces the sprite with a walkabout sprite (id, num, pal)
 
331,loadweaponsprite,2,0,-1   #load weapon sprite (number, palette)
 
332,replaceweaponsprite,3,0,0,-1 #replaces the sprite with a weapon sprite (id, num, pal)
 
333,loadsmallenemysprite,2,0,-1  #load enemy sprite (number, palette)
 
334,replacesmallenemysprite,3,0,0,-1 #replaces the sprite with an enemy sprite (id, num, pal)
 
335,loadmediumenemysprite,2,0,-1  #load enemy sprite (number, palette)
 
336,replacemediumenemysprite,3,0,0,-1 #replaces the sprite with an enemy sprite (id, num, pal)
 
337,loadlargeenemysprite,2,0,-1  #load enemy sprite (number, palette)
 
338,replacelargeenemysprite,3,0,0,-1 #replaces the sprite with an enemy sprite (id, num, pal)
 
339,loadattacksprite,2,0,-1   #load attack sprite (number, palette)
 
340,replaceattacksprite,3,0,0,-1 #replaces the sprite with an attack sprite (id, num, pal)
 
341,loadbordersprite,2,0,-1   #load a textbox border (number, palette)
 
342,replacebordersprite,3,0,0,-1 #replaces the sprite with a textbox border (id, num, pal)
 
343,loadportraitsprite,2,0,-1 #load a character portrait (number, palette)
 
344,replaceportraitsprite,3,0,0,-1 #replaces the sprite with a character portrait (id, num, pal)
 
345,clonesprite,2,0, 0        #returns a copy of the given sprite(ID, pal)
 
346,getspriteframe,1,0        #returns the current frame number of a sprite
 
347,spriteframecount,1,0      #returns the number of frames a sprite has
 
348,slicex,1,0                #returns the x position of a slice relative to its parent
 
349,slicey,1,0                #returns the y position of a slice relative to its parent
 
350,setslicex,2,0,0           #set the x position of a slice relative to its parent
 
351,setslicey,2,0,0           #set the y position of a slice relative to its parent
 
352,slicewidth,1,0            #returns the width of a slice
 
353,sliceheight,1,0           #returns the height of a slice
 
354,sethorizalign,2,0,0       #changes the horizontal alignment of a slice to its parent
 
355,setvertalign,2,0,0        #changes the vertical alignment of a slice to its parent
 
356,sethorizanchor,2,0,0      #changes the horizontal anchor of a slice
 
357,setvertanchor,2,0,0       #changes the vertical anchor of a slice
 
358,numberfromstring,2,0,0    #look in a string for a number and return it
 
359,sliceissprite,1,0         #return true if the provided slice handle points to a sprite
 
360,spritelayer,0             #return a handle to the plotsprite layer
 
361,freeslice,1,0             #free a slice and all its children
 
362,firstchild,1,0            #return the first child of a slice or 0 if none
 
363,nextsibling,1,0           #return the next sibling of a slice or 0 if none
 
364,createcontainer,2,0,0     #create a container slice (width, height)
 
365,setparent,2,0,0           #move a slice to a new parent
 
366,checkparentage,2,0,0      #check to see if a slice is a child (or grandchild) of another
 
367,slicescreenx,1,0          #return a slice's x position relative to the screen
 
368,slicescreeny,1,0          #return a slice's y position relative to the screen
 
369,sliceiscontainer,1,0      #return true if a slice is a container
 
370,createrect,3,0,0,0        #create a rect slice (width, height, style)
 
371,sliceisrect,1,0           #return true if a slice is a rect
 
372,setslicewidth,2,0,0       #change the width of a resizeable slice
 
373,setsliceheight,2,0,0      #change the height of a resizeable slice
 
374,getrectstyle,1,0          #return the style of a rect slice
 
375,setrectstyle,2,0,0        #change the style of a rect slice
 
376,getrectfgcol,1,0          #return the fgcol of a rect slice
 
377,setrectfgcol,2,0,0        #change the fgcol of a rect slice
 
378,getrectbgcol,1,0          #return the bgcol of a rect slice
 
379,setrectbgcol,2,0,0        #change the bgcol of a rect slice
 
380,getrectborder,1,0         #return the border of a rect slice
 
381,setrectborder,2,0,0       #change the border of a rect slice
 
382,getrecttrans,1,0          #return the translucency of a rect slice
 
383,setrecttrans,2,0,0        #change the translucency of a rect slice
 
384,slicecollidepoint,3,0,0,0 #check a point for collision with a slice
 
385,slicecollide,2,0,0        #check a pair of slices for collision
 
386,slicecontains,2,0,0       #check if slice2 is completely inside slice1
 
387,clampslice,2,0,0          #move slice1 so that it is inside slice2
 
388,horizflipsprite,2,0,1     #flip a sprite horizontally
 
389,vertflipsprite,2,0,1      #flip a sprite vertically
 
390,spriteishorizflipped,1,0  #return true if a sprite is flipped horiz.
 
391,spriteisvertflipped,1,0   #return true if a sprite is flipped vert.
 
392,settoppadding,2,0,0       #change a slice's top-padding
 
393,gettoppadding,1,0         #return a slice's top-padding
 
394,setleftpadding,2,0,0      #change a slice's left-padding
 
395,getleftpadding,1,0        #return a slice's left-padding
 
396,setbottompadding,2,0,0    #change a slice's bottom-padding
 
397,getbottompadding,1,0      #return a slice's bottom-padding
 
398,setrightpadding,2,0,0     #change a slice's right-padding
 
399,getrightpadding,1,0       #return a slice's right-padding
 
400,fillparent,2,0,1          #make a slice fill its parent
 
401,isfillingparent,1,0       #returns true if a slice is set to fill
 
402,slicetofront,1,0          #move a slice in front of its siblings
 
403,slicetoback,1,0           #move a slice behind its siblings
 
404,lastchild,1,0             #find the last child of a parent slice
 
405,ysortchildren,1,0         #sort the children of a slice by Y value
 
406,setsortorder,2,0,0        #set sort value on a slice for sortchildren
 
407,sortchildren,2,0,1        #sort siblings by their setsortorder value
 
408,previoussibling,1,0       #return the previous sibling of a slice or 0 if none
 
409,getsortorder,1,0          #get sort value for sortchildren for a slice
 
410,getsliceextra,2,0,0       #get slice extra (0-2) data (slice, extra)
 
411,setsliceextra,3,0,0,0     #set slice extra (0-2) data (slice, extra, value)
 
412,getspritetype,1,0         #get type of a sprite slice or -1 if not
 
413,getspritesetnumber,1,0    #get record number of a sprite slice
 
414,getspritepalette,1,0      #get palette number of a sprite slice
 
415,suspendtimers,0           #stop all timers without resetting them
 
416,resumetimers,0            #makes timers paused with "suspend timers" continue
 
417,setslicevisible,2,0,0     #change sprite visibilty(id, vis)
 
418,getslicevisible,1,0       #return a slice's visibility bit
 
419,sliceedgex,2,0,0          #return the x pos of a given edge of a slice
 
420,sliceedgey,2,0,0          #return the y pos of a given edge of a slice
 
421,createtext,0              #create a new text slice
 
422,setslicetext,2,0,0        #copy a string into a text slice
 
423,gettextcolor,1,0          #return a text strings color
 
424,settextcolor,2,0,0        #change a text strings color
 
425,getwrap,1,0               #return true if a text slice wraps
 
426,setwrap,2,0,1             #change the wrapping state of a text slice
 
427,sliceistext,1,0           #return true if the given slice handle is a text slice
 
428,gettextbg,1,0             #return text background color
 
429,settextbg,2,0,0           #change text background color
 
430,getoutline,1,0            #return true if text uses outline
 
431,setoutline,2,0,1          #change text's outline mode
 
432,usemenuitem,1,0           #given a menu item handle, activate it
 
433,sliceatpixel,5,0,0,0,0,1  #find descendant or child slices containing a screen position
 
434,findcollidingslice,4,0,0,0,1 #find descendant or child slices colliding with a slice
 
435,parentslice,1,0           #return a slice's parent
 
436,childcount,1,0            #return number of children of a slice
 
437,lookupslice,2,0,0         #find a slice using a lookup code constant
 
end
 
 
#--------------------------------------------------------------------------
 
# soft coded functions
 
 
script,walkherotoX,who,n,begin
 
if (n<<heroX(who)) then(walk hero(who,west,heroX(who)--n))
 
if (n>>heroX(who)) then(walk hero(who,east,n--heroX(who)))
 
end
 
 
script,walkherotoY,who,n,begin
 
if (n<<heroY(who)) then(walk hero(who,north,heroY(who)--n))
 
if (n>>heroY(who)) then(walk hero(who,south,n--heroY(who)))
 
end
 
 
script,walkNPCtoX,who,n,begin
 
if (n<<NPCX(who)) then(walk NPC(who,west,NPCX(who)--n))
 
if (n>>NPCX(who)) then(walk NPC(who,east,n--NPCX(who)))
 
end
 
 
script,walkNPCtoY,who,n,begin
 
if (n<<NPCY(who)) then(walk NPC(who,north,NPCY(who)--n))
 
if (n>>NPCY(who)) then(walk NPC(who,south,n--NPCY(who)))
 
end
 
 
script,setNPCspeed,who,newspeed=4,begin
 
alterNPC(who,NPCstat:movespeed,newspeed)
 
end
 
 
script,swapbyname,hero1,hero2,begin
 
 hero1:=findhero(hero1)
 
 hero2:=findhero(hero2)
 
 if (hero1==-1,or,hero2==-1)
 
  then (return(false))
 
  else (return(true),swapbyposition(hero1,hero2))
 
end
 
 
script,renamehero,who=0,begin
 
  variable(slot)
 
  slot:=findhero(who)
 
  if(slot>=0)
 
    then(renameherobyslot(slot),return(true))
 
    else(return(false))
 
end
 
 
# this exploits an undocumented feature of getherostat. Don't use the
 
# same method to set the hero level (use setherolevel instead)
 
script,getherolevel,who=0,begin
 
  return(getherostat(who,12,currentstat))
 
end
 
 
script,autosave,begin
 
if (lastsaveslot==0)
 
  then(return(savemenu))
 
  else(saveinslot(lastsaveslot),return(lastsaveslot))
 
end
 
 
script,stringtoglobals,stringID,start,length,begin
 
  variable(temp,padding)
 
  if (stringID>=0,and,stringID<=31) then(
 
    if (length>=1) then(
 
      if (length+start>>1025) then(length:=1025--start)
 
      padding:=length--stringlength(stringID)
 
      length:=stringlength(stringID)
 
      for (temp,1,length) do(
 
        writeglobal(start,asciifromstring(stringid,temp))
 
        start+=1
 
      )
 
      for (temp,start,start+padding--1) do(
 
        writeglobal(temp,256)
 
      )
 
    )
 
  )
 
end
 
 
script,globalstostring,stringID,start,length,begin
 
  variable(temp)
 
  variable(temp2)
 
  if (stringID>=0,and,stringID<=31) then(
 
    clearstring(stringid)
 
    if (length>=1) then(
 
      if (length+start>>1025) then(length:=1025--start)
 
      for (temp,1,length) do(
 
        temp2:=readglobal(start+(temp--1))
 
        if (temp2>=0,and,temp2<=255) then(appendascii(stringid,temp2))
 
      )
 
    )
 
  )
 
end
 
 
script,showstringat,stringID=0,x=0,y=0,begin
 
  setstringbit(stringID,0,1)
 
  positionstring(stringID,x,y)
 
end
 
 
script,centerstringat,stringID=0,x=160,y=100,begin
 
  setstringbit(stringID,0,1)
 
  positionstring(stringID,x--(stringlength(stringID)*4),y)
 
end
 
 
script,hidestring,stringID=0,begin
 
  setstringbit(stringID,0,0)
 
end
 
 
script,stringstyle,stringID=0,style=0,begin
 
  setstringbit(stringID,1,style)
 
end
 
 
script,stringisvisible,stringID=0,begin
 
  return(getstringbit(stringID,0))
 
end
 
 
script, last ascii, begin
 
   variable(code, shift)
 
 
   shift := keyispressed(42) || keyispressed(54)
 
 
   if(keyval(30) >> 1) then (code := 65) #A...
 
   if(keyval(48) >> 1) then (code := 66)
 
   if(keyval(46) >> 1) then (code := 67)
 
   if(keyval(32) >> 1) then (code := 68)
 
   if(keyval(18) >> 1) then (code := 69)
 
   if(keyval(33) >> 1) then (code := 70)
 
   if(keyval(34) >> 1) then (code := 71)
 
   if(keyval(35) >> 1) then (code := 72)
 
   if(keyval(23) >> 1) then (code := 73)
 
   if(keyval(36) >> 1) then (code := 74)
 
   if(keyval(37) >> 1) then (code := 75)
 
   if(keyval(38) >> 1) then (code := 76)
 
   if(keyval(50) >> 1) then (code := 77)
 
   if(keyval(49) >> 1) then (code := 78)
 
   if(keyval(24) >> 1) then (code := 79)
 
   if(keyval(25) >> 1) then (code := 80)
 
   if(keyval(16) >> 1) then (code := 81)
 
   if(keyval(19) >> 1) then (code := 82)
 
   if(keyval(31) >> 1) then (code := 83)
 
   if(keyval(20) >> 1) then (code := 84)
 
   if(keyval(22) >> 1) then (code := 85)
 
   if(keyval(47) >> 1) then (code := 86)
 
   if(keyval(17) >> 1) then (code := 87)
 
   if(keyval(45) >> 1) then (code := 88)
 
   if(keyval(21) >> 1) then (code := 89)
 
   if(keyval(44) >> 1) then (code := 90)#...Z
 
   if(keyval(2) >> 1) then (if(shift) then (code :=33) else (code :=49)) # 1...
 
   if(keyval(3) >> 1) then (if(shift) then (code :=64) else (code :=50))
 
   if(keyval(4) >> 1) then (if(shift) then (code :=35) else (code :=51))
 
   if(keyval(5) >> 1) then (if(shift) then (code :=36) else (code :=52))
 
   if(keyval(6) >> 1) then (if(shift) then (code :=37) else (code :=53))
 
   if(keyval(7) >> 1) then (if(shift) then (code :=94) else (code :=54))
 
   if(keyval(8) >> 1) then (if(shift) then (code :=38) else (code :=55))
 
   if(keyval(9) >> 1) then (if(shift) then (code :=42) else (code :=56))
 
   if(keyval(10) >> 1) then (if(shift) then (code :=40) else (code :=57))
 
   if(keyval(11) >> 1) then (if(shift) then (code :=41) else (code :=48)) # ...0
 
   if(keyval(41) >> 1) then (if(shift) then (code :=126) else (code :=96)) # ` ~
 
   if(keyval(12) >> 1) then (if(shift) then (code :=95) else (code :=45)) # - _
 
   if(keyval(13) >> 1) then (if(shift) then (code := 43) else (code := 61)) # = +
 
   if(keyval(26) >> 1) then (if(shift) then (code := 123) else (code := 91)) # [ {
 
   if(keyval(27) >> 1) then (if(shift) then (code := 125) else (code := 93)) # ] }
 
   if(keyval(39) >> 1) then (if(shift) then (code := 58) else (code := 59)) # ; :
 
   if(keyval(40) >> 1) then (if(shift) then (code := 34) else (code := 39)) # ' "
 
   if(keyval(51) >> 1) then (if(shift) then (code := 60) else (code := 44)) # , <
 
   if(keyval(52) >> 1) then (if(shift) then (code := 62) else (code := 46)) # . >
 
   if(keyval(53) >> 1) then (if(shift) then (code := 63) else (code := 47)) # / ?
 
   if(keyval(43) >> 1) then (if(shift) then (code := 124) else (code := 92)) # \ |
 
   #if(keyval(40) >> 1) then (code := 47) # Num / WTF? What's the code for the other "/"?
 
   if(keyval(55) >> 1) then (code := 42) # Num *
 
   if(keyval(71) >> 1) then (code := 55) # Num 7
 
   if(keyval(72) >> 1) then (code := 56) # Num 8
 
   if(keyval(73) >> 1) then (code := 57) # Num 9
 
   if(keyval(74) >> 1) then (code := 45) # Num -
 
   if(keyval(75) >> 1) then (code := 52) # Num 4
 
   if(keyval(76) >> 1) then (code := 53) # Num 5
 
   if(keyval(77) >> 1) then (code := 54) # Num 6
 
   if(keyval(78) >> 1) then (code := 43) # Num +
 
   if(keyval(79) >> 1) then (code := 49) # Num 1
 
   if(keyval(80) >> 1) then (code := 50) # Num 2
 
   if(keyval(81) >> 1) then (code := 51) # Num 3
 
   if(keyval(82) >> 1) then (code := 48) # Num 0
 
   if(keyval(83) >> 1) then (code := 46) # Num .
 
   if(keyval(57) >> 1) then (code := 32) #Space
 
 
 
   if(code <= 90 && code >= 65) then, begin
 
      if(shift == false) then (code += 32)
 
   end
 
 
   return (code)
 
 
end
 
 
script, input string, str=0, max len=40, useexist=0, center=-654321, positionx=160, positiony=110, begin
 
  variable(done, key, show)
 
  if(useexist) else(clear string(str))
 
  trim string(str,1,maxlen)
 
  show:=getstringbit(str,0)==0
 
  if(center==0) then(show string at(str,positionx,positiony)) else(
 
    if(center<>-654321||show) then(
 
      center string at(str,positionx,positiony)
 
    )
 
  )
 
  while(not(done)) do, begin
 
    if(center||(show&¢er<>0)) then(center string at(str,positionx,positiony))
 
    wait for key
 
    if(key is pressed(28)) then(done:=true, return(true)) else(
 
      if(keyval(14)>>1) then(delete char(str,string length(str)))
 
      key:=last ascii
 
      if(key&&string length(str)<<max len) then(append ascii(str,key)) else(
 
        while(key is pressed(1)) do, begin
 
          done:=true
 
          return(false)
 
          if(read general(44),and,2)
 
            then(wait)
 
            else(suspendplayer, wait, resumeplayer)
 
        end
 
      )
 
    )
 
  end
 
  if(show) then(hide string)
 
end
 
 
script,currentdisplaytile,tile,layernumber=0,begin
 
  if(tile>=160) then(
 
    return(animationstarttile(tile,layernumber)+gettileanimationoffset((tile--160)/48,layernumber))
 
  ) else(return(tile))
 
end
 
 
#--------------------------------------------------------------------------
 
#read/write enemy wrappers
 
 
script,getenemyname,enemyID,stringID=0,begin
 
variable(t)
 
  for (t,1,readenemydata(enemyID,0))do(
 
    appendascii(stringID,readenemydata(enemyid,t))
 
  end
 
end
 
 
script,getenemystat,enemyid,stat,begin
 
  return(readenemydata(enemyid,stat+62))
 
end
 
 
script,setenemystat,enemyid,stat,value,begin
 
  writeenemydata(enemyid,stat+62,value)
 
end
 
 
script,setenemyname,enemyid,stringid=0,begin
 
variable(t,t2)
 
if(stringlength(stringid)>=16)then(t2:=16)else(t2:=stringlength(stringid))
 
 writeenemydata(enemyid,0,t2)
 
 for(t,1,t2)do(
 
  writeenemydata(enemyid,t,asciifromstring(stringid,t))
 
  )
 
end
 
 
#get/set enemy appearance are now simply wrappers. too much confusion to remove them now
 
script,getenemyappearance,enemyid,appearance,begin
 
  return(readenemydata(enemyid,appearance))
 
end
 
 
script,setenemyappearance,enemyid,appearance,value,begin
 
  writeenemydata(enemyid,appearance,value)
 
end
 
 
#--------------------------------------------------------------------------
 
# read/write general wrappers
 
 
script,set victory music,song,begin
 
  write general(3,song+1)
 
end
 
 
script,get victory music,begin
 
  return(read general(3)--1)
 
end
 
 
script,get death script,begin
 
  return(read general(42))
 
end
 
 
script,get load script,begin
 
  return(read general(57))
 
end
 
 
script,set load script,ID=0,begin
 
  write general(57,ID)
 
end
 
 
script,set battle wait mode,bit=1,begin
 
  if(bit) then(bit:=1)
 
  write general(101,(read general(101),and,32766)+bit)
 
end
 
 
script,set caterpillar mode,bit=1,begin
 
  if(bit) then(bit:=2)
 
  write general(101,(read general(101),and,32765)+bit)
 
end
 
 
script,set no HP level up restore,bit=1,begin
 
  if(bit) then(bit:=4)
 
  write general(101,(read general(101),and,32763)+bit)
 
end
 
 
script,set no MP level up restore,bit=1,begin
 
  if(bit) then(bit:=8)
 
  write general(101,(read general(101),and,32759)+bit)
 
end
 
 
script,set inn no revive mode,bit=1,begin
 
  if(bit) then(bit:=16)
 
  write general(101,(read general(101),and,32751)+bit)
 
end
 
 
script,set full hero swap mode,bit=1,begin
 
  if(bit) then(bit:=32)
 
  write general(101,(read general(101),and,32735)+bit)
 
end
 
 
script,hide battle ready meter,bit=1,begin
 
  if(bit) then(bit:=64)
 
  write general(101,(read general(101),and,32703)+bit)
 
end
 
 
script,hide battle health meter,bit=1,begin
 
  if(bit) then(bit:=128)
 
  write general(101,(read general(101),and,32639)+bit)
 
end
 
 
script,set debug keys disable,bit=1,begin
 
  if(bit) then(bit:=256)
 
  write general(101,(read general(101),and,32511)+bit)
 
end
 
 
script,set dead heroes gain experience,bit=1,begin
 
  if(bit) then(bit:=8)
 
  write general(177,(read general(177),and,32759)+bit)
 
end
 
 
script, get hero stat cap, stat, begin
 
 read general(65+stat)
 
end
 
 
script,set capped hero stat,who,stat,value,cur or max=0,begin
 
 variable(cap)
 
 cap := get hero stat cap(stat)
 
 if(cap>>0, and, cap<<value) then(value:=cap)
 
 set hero stat(who,stat,cur or max,value)
 
end
 
 
script,get damage cap,begin
 
  return(readgeneral(63))
 
end
 
 
script,set damage cap,c=0,begin
 
  writegeneral(63,c)
 
end
 
 
script, get inventory size, begin
 
  if(read general(85) == 0) then(exit returning(600))
 
  exit returning (read general(85) / 3 * 3 + 3)
 
end
 
 
script, set inventory size, newsize, begin
 
  if(newsize << 0) then(exit script)
 
  if(newsize == inv:max || newsize >> 600)
 
  then(write general(85, 0))
 
  else(write general(85, (newsize + 2) / 3 * 3 -- 1))
 
end
 
 
#--------------------------------------------------------------------------
 
# read/write gmap wrappers
 
 
script,get map tileset,begin
 
  return(read gmap(0))
 
end
 
 
script, get ambient music, begin
 
  return (read gmap(1) -- 1)
 
end
 
 
script, set ambient music, song=-1, begin
 
  write gmap(1,song + 1)
 
  if (song >= 0) then (play song (song))
 
  else (if (song == -1) then (stop song))
 
end
 
 
script,allow minimap,setting=1,begin
 
  write gmap(2,setting)
 
end
 
 
script,allow save anywhere,setting=1,begin
 
  write gmap(3,setting)
 
end
 
 
script,cancel map name display,begin
 
  write gmap(4,0)
 
end
 
 
script,set map edge mode,mode=0,tile=0,begin
 
  write gmap(5,mode)
 
  write gmap(6,tile)
 
end
 
 
script,get map edge mode,begin
 
  return(read gmap(5))
 
end
 
 
script,set harm tile damage,damage=0,begin
 
  write gmap(9,damage)
 
end
 
 
script,set harm tile flash,colour=0,begin
 
  write gmap(10,colour)
 
end
 
 
script,get footoffset,begin
 
  return(read gmap(11))
 
end
 
 
script,set footoffset,offset=0,begin
 
  write gmap(11,offset)
 
end
 
 
script,get instead of battle script,begin
 
  return (read gmap(13))
 
end
 
 
script,set instead of battle script,ID=0,begin
 
  write gmap(13,ID)
 
end
 
 
script,get each step script,begin
 
  return (read gmap(14))
 
end
 
 
script,set each step script,ID=0,begin
 
  write gmap(14,ID)
 
end
 
 
script,get on keypress script,begin
 
  return (read gmap(15))
 
end
 
 
script,set on keypress script,ID=0,begin
 
  write gmap(15,ID)
 
end
 
 
script,draw npcs above heroes,setting=1,begin
 
  write gmap(16,setting)
 
end
 
 
#--------------------------------------------------------------------------
 
# new wrappers/re-inventing of the wheel commands
 
 
script, days of play, begin
 
   return(read general(51))
 
end
 
 
script, hours of play, begin
 
   return(read general(52))
 
end
 
 
script, minutes  of play, begin
 
   return(read general(53))
 
end
 
 
script, seconds of play, begin
 
   return(read general(54))
 
end
 
 
script,set days of play,d=0, begin
 
   if(d >= 0) then (write general(51,d))
 
end
 
 
script,set hours of play,h=0, begin
 
   if(h >= 0, and, h << 24) then (write general(52,h))
 
end
 
 
script,set minutes  of play,m=0, begin
 
   if(m >= 0, and, m << 60) then (write general(53,m))
 
end
 
 
script,set seconds of play,s=0, begin
 
   if(s >= 0, and, s << 60) then (write general(54,s))
 
end
 
 
#--------------------------------------------------------------------------
 
# menu wrappers
 
 
script, first menu item, menuhandle=0, begin
 
  exit returning(menu item by slot(menuhandle, 0))
 
end
 
 
script, wait for menu, menuhandle=0, begin
 
  while(menu is open(menuhandle)) do(wait(1))
 
end
 
 
#--------------------------------------------------------------------------
 
# menu data wrappers
 
 
script, get menu boxstyle, menuhandle=0, begin
 
  exit returning(read menu int(menuhandle, 12))
 
end
 
 
script, set menu boxstyle, menuhandle=0, n=0, begin
 
  write menu int(menuhandle, 12, n)
 
end
 
 
script, get menu textcolor, menuhandle=0, begin
 
  exit returning(read menu int(menuhandle, 13))
 
end
 
 
script, set menu textcolor, menuhandle=0, n=0, begin
 
  write menu int(menuhandle, 13, n)
 
end
 
 
script, get menu max rows, menuhandle=0, begin
 
  exit returning(read menu int(menuhandle, 14))
 
end
 
 
script, set menu max rows, menuhandle=0, n=0, begin
 
  write menu int(menuhandle, 14, n)
 
end
 
 
script, get menu offset x, menuhandle=0, begin
 
  exit returning(read menu int(menuhandle, 16))
 
end
 
 
script, set menu offset x, menuhandle=0, n=0, begin
 
  write menu int(menuhandle, 16, n)
 
end
 
 
script, get menu offset y, menuhandle=0, begin
 
  exit returning(read menu int(menuhandle, 17))
 
end
 
 
script, set menu offset y, menuhandle=0, n=0, begin
 
  write menu int(menuhandle, 17, n)
 
end
 
 
script, get menu anchor x, menuhandle=0, begin
 
  exit returning(read menu int(menuhandle, 18))
 
end
 
 
script, set menu anchor x, menuhandle=0, n=0, begin
 
  write menu int(menuhandle, 18, n)
 
end
 
 
script, get menu anchor y, menuhandle=0, begin
 
  exit returning(read menu int(menuhandle, 19))
 
end
 
 
script, set menu anchor y, menuhandle=0, n=0, begin
 
  write menu int(menuhandle, 19, n)
 
end
 
 
script, get menu text align, menuhandle=0, begin
 
  exit returning(read menu int(menuhandle, 20))
 
end
 
 
script, set menu text align, menuhandle=0, n=0, begin
 
  write menu int(menuhandle, 20, n)
 
end
 
 
script, get menu min chars, menuhandle=0, begin
 
  exit returning(read menu int(menuhandle, 21))
 
end
 
 
script, set menu min chars, menuhandle=0, n=0, begin
 
  write menu int(menuhandle, 21, n)
 
end
 
 
script, get menu max chars, menuhandle=0, begin
 
  exit returning(read menu int(menuhandle, 22))
 
end
 
 
script, set menu max chars, menuhandle=0, n=0, begin
 
  write menu int(menuhandle, 22, n)
 
end
 
 
script, get menu border, menuhandle=0, begin
 
  exit returning(read menu int(menuhandle, 23))
 
end
 
 
script, set menu border, menuhandle=0, n=0, begin
 
  write menu int(menuhandle, 24, n)
 
end
 
 
script, get menu bit, handle, bit, begin
 
  variable(n)
 
  n := read menu int(handle, 15)
 
  if(n,and,2^bit) then(exit returning(true))
 
  exit returning(false)
 
end
 
 
script, set menu bit, handle, bit, value=1, begin
 
  variable(n)
 
  n := read menu int(handle, 15)
 
  if(value) then(n := n, or, 2^bit)
 
    else(n := n, and, (-1, xor, 2^bit))
 
  write menu int(handle, 15, n)
 
end
 
 
#--------------------------------------------------------------------------
 
# menu item data wrappers
 
 
script, set menu item, handle=0, type=0, subtype=0, tag1=0, tag2=0, stag=0, togtag=0, begin
 
  write menu item int(handle, 22, type)
 
  write menu item int(handle, 23, subtype)
 
  write menu item int(handle, 24, tag1)
 
  write menu item int(handle, 25, tag2)
 
  write menu item int(handle, 26, stag)
 
  write menu item int(handle, 27, togtag)
 
end
 
 
script, set menu item type, handle=0, n=0, begin
 
  write menu item int(handle, 22, n)
 
end
 
 
script, get menu item type, handle=0, begin
 
  exit returning(read menu item int(handle, 22))
 
end
 
 
script, set menu item subtype, handle=0, n=0, begin
 
  write menu item int(handle, 23, n)
 
end
 
 
script, get menu item subtype, handle=0, begin
 
  exit returning(read menu item int(handle, 23))
 
end
 
 
script, set menu item tag, handle=0, n=0, whichtag=1, begin
 
  if(whichtag == 1) then(write menu item int(handle, 24, n))
 
  if(whichtag == 2) then(write menu item int(handle, 25, n))
 
end
 
 
script, get menu item tag, handle=0, whichtag=1, begin
 
  if(whichtag == 1) then(exit returning(read menu item int(handle, 24)))
 
  if(whichtag == 2) then(exit returning(read menu item int(handle, 25)))
 
end
 
 
script, set menu item settag, handle=0, n=0, begin
 
  write menu item int(handle, 26, n)
 
end
 
 
script, get menu item settag, handle=0, begin
 
  exit returning(read menu item int(handle, 26))
 
end
 
 
script, set menu item togtag, handle=0, n=0, begin
 
  write menu item int(handle, 27, n)
 
end
 
 
script, get menu item togtag, handle=0, begin
 
  exit returning(read menu item int(handle, 27))
 
end
 
 
script, get menu item bit, handle, bit, begin
 
  variable(n)
 
  n := read menu item int(handle, 28)
 
  if(n,and,2^bit) then(exit returning(true))
 
  exit returning(false)
 
end
 
 
script, set menu item bit, handle, bit, value=1, begin
 
  variable(n)
 
  n := read menu item int(handle, 28)
 
  if(value) then(n := n, or, 2^bit)
 
    else(n := n, and, (-1, xor, 2^bit))
 
  write menu item int(handle, 28, n)
 
end
 
 
script, set menu item extra, handle=0, extra=0, n=0, begin
 
  if(extra >= 0 && extra <= 2) then, begin
 
    write menu item int(handle, 29+extra, n)
 
  end
 
end
 
 
script, get menu item extra, handle=0, extra=0, begin
 
  if(extra >= 0 && extra <= 2) then, begin
 
    exit returning(read menu item int(handle, 29+extra))
 
  end
 
end
 
 
script, load enemy sprite, size, number, pal = -1, begin
 
  if(size == EnemySize:small) then(return(load small enemy sprite(number, pal)))
 
  if(size == EnemySize:medium) then(return(load medium enemy sprite(number, pal)))
 
  if(size == EnemySize:large) then(return(load large enemy sprite(number, pal)))
 
end
 
 
script, replace enemy sprite, ID, size, number, pal = -1, begin
 
  if(size == EnemySize:small) then(return(replace small enemy sprite(ID, number, pal)))
 
  if(size == EnemySize:medium) then(return(replace medium enemy sprite(ID, number, pal)))
 
  if(size == EnemySize:large) then(return(replace large enemy sprite(ID, number, pal)))
 
end
 
 
#--------------------------------------------------------------------------
 
# slice commands
 
 
script, first sprite child, parent, begin
 
  variable(sl)
 
  sl := first child(parent)
 
  if(sl==0) then(exit returning(0))
 
  if(slice is sprite(sl)) then(exit returning(sl))
 
  exit returning(next sprite sibling(sl))
 
end
 
 
script, next sprite sibling, sib, begin
 
  variable(sl)
 
  sl := next sibling(sib)
 
  if(sl==0) then(exit returning(0))
 
  if(slice is sprite(sl)) then(exit returning(sl))
 
  exit returning(next sprite sibling(sl))
 
end
 
 
script, first container child, parent, begin
 
  variable(sl)
 
  sl := first child(parent)
 
  if(sl==0) then(exit returning(0))
 
  if(slice is container(sl)) then(exit returning(sl))
 
  exit returning(next container sibling(sl))
 
end
 
 
script, next container sibling, sib, begin
 
  variable(sl)
 
  sl := next sibling(sib)
 
  if(sl==0) then(exit returning(0))
 
  if(slice is container(sl)) then(exit returning(sl))
 
  exit returning(next container sibling(sl))
 
end
 
 
script, first rect child, parent, begin
 
  variable(sl)
 
  sl := first child(parent)
 
  if(sl==0) then(exit returning(0))
 
  if(slice is rect(sl)) then(exit returning(sl))
 
  exit returning(next rect sibling(sl))
 
end
 
 
script, next rect sibling, sib, begin
 
  variable(sl)
 
  sl := next sibling(sib)
 
  if(sl==0) then(exit returning(0))
 
  if(slice is rect(sl)) then(exit returning(sl))
 
  exit returning(next rect sibling(sl))
 
end
 
 
script, free slice children, parent, begin
 
  variable(sl, next)
 
  sl := first child(parent)
 
  while(sl) do(
 
    next := next sibling(sl)
 
    free slice(sl)
 
    sl := next
 
  )
 
end
 
 
script, realign slice, sl, halign, valign, hanchor=-1, vanchor=-1, begin
 
  set horiz align(sl, halign)
 
  set vert align(sl, valign)
 
  if(hanchor <> -1) then(set horiz anchor(sl, hanchor))
 
  if(vanchor <> -1) then(set vert anchor(sl, vanchor))
 
end
 
 
script, center slice, sl, begin
 
  realign slice(sl, 1, 1, 1, 1)
 
end
 
 
script, set slice screen x, sl, newx, begin
 
  variable(oldx, diff)
 
  oldx := slice screen x(sl)
 
  diff := newx -- oldx
 
  set slice x(sl, slice x(sl) + diff)
 
end
 
 
script, set slice screen y, sl, newy, begin
 
  variable(oldy, diff)
 
  oldy := slice screen y(sl)
 
  diff := newy -- oldy
 
  set slice y(sl, slice y(sl) + diff)
 
end
 
 
script, set padding, sl, newpadding, begin
 
  set left padding  (sl, newpadding)
 
  set right padding (sl, newpadding)
 
  set top padding   (sl, newpadding)
 
  set bottom padding(sl, newpadding)
 
end
 
 
#--------------------------------------------------------------------------
 
# script triggers
 
 
define trigger,begin
 
0, script
 
1, plotscript
 
end
 
 
#--------------------------------------------------------------------------
 
# betweenable operators
 
 
define operator,begin
 
20 ^   exponent
 
30,mod,modulus
 
30 /   divide
 
30 *   multiply
 
40 --  subtract
 
40 +   add
 
50 ==  equal
 
50 <>  notequal
 
50 <<  lessthan
 
50 >>  greaterthan
 
50 <=  lessthanorequalto
 
50 >=  greaterthanorequalto
 
60,xor,xor
 
60,and,and
 
60,or, or
 
65 &&  logand
 
70 ||  logor
 
70 ^^  logxor
 
80 :=  setvariable
 
80 +=  increment
 
80 -=  decrement
 
80 $+  concatenatestrings
 
80 $=  copystring
 
end
 
 | 	 
  _________________ Calehay | 
			 
		  | 
	 
	
		| Back to top | 
		 | 
	 
	
		  | 
	 
	
		Calehay ...yeah. Class B Minstrel
 
  
  Joined: 07 Jul 2004 Posts: 549
 
  | 
		
			
				 Posted: Mon Oct 19, 2009 6:27 am    Post subject:  | 
				     | 
			 
			
				
  | 
			 
			
				Part II:
 
 
 	  | Code: | 	 		  #--------------------------------------------------------------------------
 
# global constants
 
 
define constant, begin
 
0,zero
 
1,one
 
2,two
 
3,three
 
4,four
 
5,five
 
6,six
 
7,seven
 
8,eight
 
9,nine
 
10,ten
 
0,false
 
1,true
 
0,off
 
1,on
 
0,north
 
1,east
 
2,south
 
3,west
 
0,up
 
2,down
 
3,left
 
1,right
 
0,upkey
 
1,downkey
 
2,leftkey
 
3,rightkey
 
4,usekey
 
5,cancelkey
 
5,menukey
 
99,anykey
 
0,me
 
0,none
 
-1,autonumber
 
0,currentstat
 
1,maximumstat
 
1,northwall
 
2,eastwall
 
4,southwall
 
8,westwall
 
16,vehicleA
 
32,vehicleB
 
64,harmtile
 
128,overheadtile
 
0,inside battle
 
1,outside battle
 
0,NPCstat:picture
 
1,NPCstat:palette
 
2,NPCstat:movetype
 
  0,NPCmovetype:standstill
 
  1,NPCmovetype:wander
 
  2,NPCmovetype:pace
 
  3,NPCmovetype:rightturns
 
  4,NPCmovetype:leftturns
 
  5,NPCmovetype:randomturns
 
  6,NPCmovetype:chaseyou
 
  7,NPCmovetype:avoidyou
 
  8,NPCmovetype:walkinplace
 
3,NPCstat:movespeed
 
4,NPCstat:displaytext
 
5,NPCstat:whenactivated
 
  0,NPCwhenactivated:changedirection
 
  1,NPCwhenactivated:faceplayer
 
  2,NPCwhenactivated:donotfaceplayer
 
6,NPCstat:giveitem
 
7,NPCstat:pushability
 
  0,NPCpush:off
 
  1,NPCpush:full
 
  2,NPCpush:horizontal
 
  3,NPCpush:vertical
 
  4,NPCpush:uponly
 
  5,NPCpush:rightonly
 
  6,NPCpush:downonly
 
  7,NPCpush:leftonly
 
8,NPCstat:activation
 
  0,NPCactivation:use
 
  1,NPCactivation:touch
 
  2,NPCactivation:stepon
 
12,NPCstat:script
 
13,NPCstat:scriptargument
 
14,NPCstat:vehicle
 
0,color:red
 
1,color:green
 
2,color:blue
 
0,leftbutton
 
1,rightbutton
 
-1,getcount
 
0,string:outline
 
1,string:flat
 
53,Enemy:Picture
 
54,Enemy:Palette
 
55,Enemy:PictureSize
 
  0, EnemySize:small
 
  1, EnemySize:medium
 
  2, EnemySize:large
 
56,Enemy:Gold
 
57,Enemy:Experience
 
58,Enemy:Item
 
59,Enemy:ItemPercent
 
60,Enemy:RareItem
 
61,Enemy:RareItemPercent
 
17,Stealability
 
   -1, IsNotStealable
 
    0, StealableOnce
 
    1, StealableInfinity
 
18, StealableItem
 
19, StealableItemChance
 
20, StealableRareItem
 
21, StealableRareItemchance
 
0, Crop
 
1, Wrap
 
2, Defaulttile
 
-1,party
 
0, extra 0
 
1, extra 1
 
2, extra 2
 
0, x axis
 
1, y axis
 
1,mapstate:mapsettings
 
2,mapstate:npclocations
 
4,mapstate:npcdefinitions
 
8,mapstate:tilemap
 
16,mapstate:passmap
 
#32,mapstate:foemap
 
6,mapstate:npcs
 
24,mapstate:tiles
 
255,mapstate:all
 
0,timer:stop #use in speed
 
-1,timer:default #use in any
 
-2,timer:gameover#use in trigger
 
1,timerflag:critical
 
2,timerflag:battle
 
4,timerflag:menu
 
0,menutype:label
 
1,menutype:special
 
2,menutype:menu
 
3,menutype:textbox
 
4,menutype:script
 
0,menuspecial:items
 
1,menuspecial:spells
 
2,menuspecial:status
 
3,menuspecial:equip
 
4,menuspecial:order
 
5,menuspecial:team
 
6,menuspecial:orderteam
 
7,menuspecial:map
 
8,menuspecial:save
 
9,menuspecial:load
 
10,menuspecial:quit
 
11,menuspecial:volume
 
0,menuitembit:Hide when disabled
 
1,menuitembit:Close menu when selected
 
0,menubit:translucent box
 
1,menubit:never show scrollbar
 
2,menubit:allow gameplay
 
3,menubit:suspend player even if gameplay allowed
 
4,menubit:no box
 
5,menubit:no close
 
6,menubit:no controls
 
7,menubit:prevent main menu
 
0,align:center
 
-1,align:left
 
1,align:right
 
-1,align:top
 
1,align:bottom
 
-1,tileset:default
 
-1,song:silence
 
-2,song:same as map
 
-2,song:same as last map
 
-1,any enemy
 
0,inv:max
 
0,edge:left
 
1,edge:center
 
2,edge:right
 
0,edge:top
 
1,edge:middle
 
2,edge:bottom
 
0,spritetype:hero
 
1,spritetype:smallenemy
 
2,spritetype:mediumenemy
 
3,spritetype:largeenemy
 
4,spritetype:walkabout
 
5,spritetype:weapon
 
6,spritetype:attack
 
7,spritetype:border
 
8,spritetype:portrait
 
-1,border:line
 
-2,border:none
 
0,trans:solid
 
1,trans:fuzzy
 
2,trans:hollow
 
end
 
 
#<SLICE LOOKUP CODES>
 
define constant, begin
 
-100001, sl:textbox text
 
-100002, sl:textbox portrait
 
-100003, sl:textbox choice0
 
-100004, sl:textbox choice1
 
-101000, sl:map layer0
 
-101001, sl:map layer1
 
-101002, sl:map layer2
 
end
 
#</SLICE LOOKUP CODES>
 
 | 	 
  _________________ Calehay | 
			 
		  | 
	 
	
		| Back to top | 
		 | 
	 
	
		  | 
	 
	
		binoal
 
 
  
  Joined: 20 Jun 2009 Posts: 123 Location: My Own Little World
  | 
		 | 
	 
	
		| Back to top | 
		 | 
	 
	
		  | 
	 
	
		 | 
	 
 
  
	 
	    
	   | 
	
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
  | 
   
 
  
Powered by phpBB © 2001, 2005 phpBB Group
 
  
		 |