include, plotscr.hsd include, scancode.hsi include, test.hsi define script(1,testing,none) define script(2,doortest,none) define script(3,mapautorun,none) define script(4,makesuseofretvals,none) define script(5,loader,none) define script(6,random battle,2,0,0) define script(7,each step,3,0,0,0) define script(8,key trigger,none) define script(9,reference dance,none) define script(10,use NPC test,none) define script(autonumber,sum of some stuff,none) define script(11,backdrop displayer,none) define script(12,swap def wep,none) define script(13,death stalks you at every turn,none) define script(14,box within script,none) define script(15,script within box,none) define script(16,another map while backdroped,none) define script(17,empty onkey,none) define script(18,keywaiter,none) define script(19,teachspelltest,none) define script(20,forgetspelltest,none) define script(21,writespelltest,none) define script(22,erasespelltest,none) define script(23,readspelltest,none) define script(24,canlearnspelltest,none) define script(25,heropositiontest,none) define script(26,scriptmenutest,none) define script(27,referencetest,none) define script(28,mapchangerkeylistener,none) # globals 0 to 4 are used global variable (1024,highval) global variable (5, mylayer) global variable (6, tileset) script,makesuseofretvals,begin show value (sum of some stuff) end script,sum of some stuff,begin variable(a,b,c) set variable(a,hero X(me)) set variable(b,hero direction(3)) set variable(c,minutes of play) return(a+b+c) end script,testing,begin variable (timer) show text box (9) # Oh no! Its sinking! set hero picture(0,1) set hero palette(0,1) set variable(timer,15) set tag(6,ON) while(timer>>0, and, check tag(6)) do, begin show value (timer) wait (18) # roughly 18 tics in a second decrement(timer) end if (timer<=0) then,begin show text box(10)#ah! Its crumbling! we are dead! wait for text box game over end show no value set hero picture(0,0) set hero palette(0,0) show text box(11)# yipee! end #of script testing #----------------------------------------------------------------------- script,doortest,begin fight formation(1) usedoor(3) end #----------------------------------------------------------------------- script,map autorun,begin highval:=random(4,6) set hero palette(0,highval) set hero palette(0,highval,inside battle) show value(highval) end #----------------------------------------------------------------------- script,loader,begin suspend NPCs show value(random(-32000,32000)) show text box (13) wait for text box resume NPCs get hero name (1,find hero(hero by rank(leader))) string color (1,12,240) string style (1,string:flat) center string at (1,160,40) clear string (2) append number(2,string length(1)) show string at (2,0,0) end #----------------------------------------------------------------------- script,random battle,form,set,begin show value(set) show value(form) wait for key(any key) greyscale palette fight formation(form) reset palette end #----------------------------------------------------------------------- script,each step,x,y,d,begin show value(x*100+y) variable(i) for (i,1,3) do( set hero direction(i,d) ) end #----------------------------------------------------------------------- script,key trigger,begin if (key is pressed(key:S)) then (suspend overlay,show text box(14)) if (key is pressed(key:R)) then (resume overlay,show text box(15)) if (key is pressed(key:N)) then (rename hero by slot(pick hero)) if (key is pressed(key:1)) then (play sound(0)) if (key is pressed(key:2)) then (pause sound(0)) if (key is pressed(key:3)) then (stop sound(0)) show string at(5,50,10) show string at(6,50,58) show string at(7,50,66) if (not(hero direction(me)==north)) then($5="not north") else($5="north") clear string(6) append number(6,hero direction(me)) clear string(7) append number(7,not(hero direction(me)==north)) end #----------------------------------------------------------------------- script,reference dance,begin variable(i,j) for(i,0,4) do( create NPC(1,6+i,1,random(0,3)) wait (1) ) wait (5) for(i,0,4) do( write global(i,NPC reference(1,i)) ) for(i,0,4) do( walk NPC(read global(i),south,2) wait(3) ) wait for all for(j,1,20) do( for(i,0,4) do( set NPC direction(read global(i),(j,mod,4)) wait(1) ) ) end #----------------------------------------------------------------------- script,use NPC test,begin use NPC (0) show value(get hero level(0)) end #----------------------------------------------------------------------- script, backdrop displayer, begin show backdrop (random(0,4)) end #----------------------------------------------------------------------- script, swap def wep, begin if (get default weapon(0)==4),then( set default weapon(0,6) )else( set default weapon(0,4) ) end #----------------------------------------------------------------------- script, death stalks you at every turn, begin show text box(18) wait for text box game over end #----------------------------------------------------------------------- script,box within script,begin walk hero(me,hero direction(me)+2,1) show backdrop(5) wait for key show text box(19) wait for text box wait for key show map end #----------------------------------------------------------------------- script,script within box,begin walk hero(me,hero direction(me)+2,1) suspend box advance show text box(19) wait for key show backdrop(5) wait for key show map resume box advance wait for text box end #----------------------------------------------------------------------- script,another map while backdroped,begin walk hero(me,hero direction(me)+2,1) show backdrop(5) wait for key teleport to map (0,0,0) wait for key show map end #----------------------------------------------------------------------- script,empty onkey,begin show value(2000) end #----------------------------------------------------------------------- script,keywaiter,begin show value (1000) wait for key show value (1001) wait for key show value (1002) wait for key show value (1003) wait for key show value (1004) wait for key end #----------------------------------------------------------------------- script,teachspelltest,begin show text box (20) show value(teach spell(3,atk:learnable)) end script,forgetspelltest,begin show text box (21) show value(forget spell(3,atk:learnable)) end script,writespelltest,begin show text box (22) show value(write spell(3,1,2,atk:unlearnab)) end script,erasespelltest,begin show text box (23) show value(write spell(3,1,2,none)) end script,readspelltest,begin if (read spell(3,1,2)==atk:unlearnab) then( show text box(24) )else( show text box(25) ) show no value end script,canlearnspelltest,begin if (can learn spell(3,atk:learnable)) then( show text box(26) )else( if (knows spell(3,atk:learnable)) then( show text box(28) )else( show text box(27) ) ) show no value end #----------------------------------------------------------------------- script, heropositiontest, begin show text box(29) show value(hero by slot(0)) wait for text box show no value show text box(30) show value(hero by rank(0)) wait for text box show no value show text box(31) show value(hero by slot(1)) wait for text box show no value show text box(32) show value(hero by rank(1)) wait for text box show no value end #----------------------------------------------------------------------- script, script menu test, begin variable(slot) slot := save menu (false) if (slot) then ( save in slot (slot) ) wait(2) # make sure exit-keypress will not be re-read end #----------------------------------------------------------------------- script, reference test, begin run script by ID(@empty onkey) # empty onkey show value(read global(@highval)) # highval end #----------------------------------------------------------------------- #not used anywhere script, map changer key listener, begin if (key is pressed(key:s)) then ( $15=" write map block" trace(15) write map block (hero x, hero y, read map block (hero x, hero y) xor, 3) ) if (key is pressed(key:a)) then ( $15=" save map state" trace(15) save map state ) if (key is pressed(key:g)) then ( $15=" save map state (mapstate:mapsettings)" trace(15) save map state (mapstate:mapsettings) ) if (key is pressed(key:minus)) then ( $15=" save map state (mapstate:npcs, 3)" trace(15) save map state(mapstate:npcs, 3) ) if (key is pressed(key:plus)) then ( $15=" load map state(mapstate:all, 3)" trace(15) load map state(mapstate:all, 3) ) if (key is pressed(key:l)) then ( $15=" load map state" trace(15) load map state ) if (key is pressed(key:r)) then ( $15=" reset map state" trace(15) reset map state ) if (key is pressed(key:d)) then ( $15=" reset map state (mapstate:all)" trace(15) reset map state (mapstate:all) ) if (key is pressed(key:numpad0)) then (mylayer := -1) if (key is pressed(key:numpad1)) then (mylayer := 0) if (key is pressed(key:numpad2)) then (mylayer := 1) if (key is pressed(key:numpad3)) then (mylayer := 2) #Nb: TEST.RPG comes with only 1 tileset if (key is pressed(key:tilde)) then (tileset := tileset:default) if (key is pressed(key:0)) then (tileset := 0) if (key is pressed(key:1)) then (tileset := 1) if (key is pressed(key:2)) then (tileset := 2) if (key is pressed(key:3)) then (tileset := 3) if (key is pressed(key:4)) then (tileset := 4) $31 = "layer: " append number (31, mylayer) $31 + " tileset: " append number (31, tileset) show string (31) if (key is pressed(key:c)) then ( change tileset (tileset, mylayer) ) if (key is pressed(key:t)) then ( load tileset (tileset, mylayer) ) if (key is pressed(key:z)) then ( $31 = "layer " append number (31, mylayer) $31 + " using tileset " if (mylayer == -1) then ( append number (31, get map tileset) ) else ( append number (31, layer tileset (mylayer)) ) show string (31) ) end