!---------------------------------------------------------------------------- !Usage: Printer centered text in the window. !Format: PrintCenter("String",LineNumber,0,wrapyesno) ! or ! PrintCenter(Array,LineNumber,1,wrapyesno) ! routine PrintCenter(t,y,isarray,wrap) { local x, l, a l = display.linelength if (not isarray) a = string(centerbuf,t,100) else a = StringLength(t) x = (l - a) / 2 locate x, y if (not isarray) { if (wrap) print t else print t; } else StringPrint(t) } !---------------------------------------------------------------------------- !Usage: Take two strings, and combine them into a single array string. !Format: StringConcat("String1", "String2", DestArray) ! routine StringConcat(s1, s2, s3) { local i, len1, len2, tlen len1 = string(tempbuf1,s1,100) len2 = string(tempbuf2,s2,100) tlen = 0 for (i=0; i 0) { !** Check for INSIDE or OUTSIDE area movement if (which=1) { if (location is interior) { if (rm is interior) { ret=1 } } else { if (rm is not interior) { ret=1 } } } !** Check for ENTRANCES here. if (which=2) { if (location is not interior) { if (rm is interior) { ret=1 } } } !** Check for EXITS here. if (which=3) { if (location is interior) { if (rm is not interior) { ret=1 } } } } if (ret=1) { print "["; label; "] "; } return ret } !---------------------------------------------------------------------------- routine PrintExits { local loop, tot for (loop=1; loop<=3; loop++) { tot=0 select loop case 1 : "\B\IDirs: \i\b"; case 2 : "\B\IIns: \i\b"; case 3 : "\B\IOuts: \i\b"; tot=tot+WatchScanDir(n_obj,"N",loop) tot=tot+WatchScanDir(ne_obj,"NE",loop) tot=tot+WatchScanDir(e_obj,"E",loop) tot=tot+WatchScanDir(se_obj,"SE",loop) tot=tot+WatchScanDir(s_obj,"S",loop) tot=tot+WatchScanDir(sw_obj,"SW",loop) tot=tot+WatchScanDir(w_obj,"W",loop) tot=tot+WatchScanDir(nw_obj,"NW",loop) if (tot=0) { "[none] "; } } } !---------------------------------------------------------------------------- !Pass in 1 through 8 and return with the matching directional object. routine GetDirection(dir,opposite) { if (opposite) { if (dir=1,n_obj) { return s_obj } if (dir=2,s_obj) { return n_obj } if (dir=3,e_obj) { return w_obj } if (dir=4,w_obj) { return e_obj } if (dir=5,ne_obj) { return sw_obj } if (dir=6,se_obj) { return nw_obj } if (dir=7,sw_obj) { return ne_obj } if (dir=8,nw_obj) { return se_obj } } else { if (dir=1) { return n_obj } if (dir=2) { return s_obj } if (dir=3) { return e_obj } if (dir=4) { return w_obj } if (dir=5) { return ne_obj } if (dir=6) { return se_obj } if (dir=7) { return sw_obj } if (dir=8) { return nw_obj } } return 0 !Invalid Direction } !---------------------------------------------------------------------------- routine CheckForGraphics { if (display.hasgraphics) { if (allow_image) { LoadPicture("TRADGFX","tradgfx") if (system_status = 0) { player.misc #11 = "TRADGFX" } else { LoadPicture("TRADALT","tradgfx") if (system_status = 0) { player.misc #11 = "TRADALT" } else { allow_image = false } } } } else { allow_image = false } } !---------------------------------------------------------------------------- routine CheckForMusic { if (allow_music) { PlayMusic("TRADMUS","tradmus", 0, false) if (system_status = 0) { player.misc #12 = "TRADMUS" } else { PlayMusic("TRADALT","tradmus", 0, false) if (system_status = 0) { player.misc #12 = "TRADALT" } else { allow_music = false } } } } !---------------------------------------------------------------------------- routine PlaySong(songname) { player.misc #13 = songname if (allow_music) { !PlayMusic(MUSIC_STOP) PlayMusic(player.misc #12, songname, 100, true, false) } } !---------------------------------------------------------------------------- !Basically, if we've seen the room description, run a single indent. If we !did NOT see it on this turn, we print a blank line and an indent, to give !our message (whatever it is) further spacing... unless we just changed !rooms and didn't see the room description, in which case it's still only !an indent, so as not to do a strange blank line. ! routine PrintParaIndent { if (roomdesc_seen) or (prev_location ~= location) or \ (verbroutine = &DoWait) { indent } else { print "" : indent } } !---------------------------------------------------------------------------- !Pass in a target string and up to 5 to compare against, to check for match. routine IsEqual(s1,c1,c2,c3,c4,c5) { string(tempbuf1,s1,100) !Is there some way we can loop for # of parameters instead??? if (c1 ~= 0) { string(tempbuf2,c1,100) if StringEqual(tempbuf1,tempbuf2) { return true } } if (c2 ~= 0) { string(tempbuf2,c2,100) if StringEqual(tempbuf1,tempbuf2) { return true } } if (c3 ~= 0) { string(tempbuf2,c3,100) if StringEqual(tempbuf1,tempbuf2) { return true } } if (c4 ~= 0) { string(tempbuf2,c4,100) if StringEqual(tempbuf1,tempbuf2) { return true } } if (c5 ~= 0) { string(tempbuf2,c5,100) if StringEqual(tempbuf1,tempbuf2) { return true } } return false } !---------------------------------------------------------------------------- routine PauseForEnter { local key=0, okct=0, chap=0, didkey while (key ~= 13, 32, MOUSE_CLICK) { pause : key = word[0] if (skipchapter) { didkey = false if (key = 67,99) { okct=1 : didkey=true } elseif (okct = 1) { if (key = 49) { chap=1 : okct=2 : didkey=true } if (key = 50) { chap=2 : okct=2 : didkey=true } if (key = 51) { chap=3 : okct=2 : didkey=true } if (key = 52) { chap=4 : okct=2 : didkey=true } } elseif (okct = 2) { if (key = 49) { Chapter=chap : Section=1 : key=13 : didkey=true } if (key = 50) { Chapter=chap : Section=2 : key=13 : didkey=true } } if (didkey=false) { okct=0 } } } } !---------------------------------------------------------------------------- replace PrintEndGame(end_type) { Font(BOLD_ON) print "\n*** THE END ***" Font(BOLD_OFF) COLOR BRIGHT_WHITE, BGCOLOR print "\n[ENTER] or [CLICK] to continue"; : PauseForEnter print "\n" ! To give a blank line COLOR TEXTCOLOR, BGCOLOR Font(PROP_OFF) "Trading Punches SoundTrack (accessible with \"playsong\")" "----------------------------------------------------------------------" "Skipping Stones (Title Theme) - playsong \"skipping_stones\"" "In A Moment (One World Will End) - playsong \"in_a_moment\"" "Party at the Pavilion - playsong \"party_at_the_pavilion\"" "Losing the Flame (Elora's Theme) - playsong \"losing_the_flame\"" "Braving the Storm (Ruhne's Theme) - playsong \"braving_the_storm\"" "Sinister Motives (Thyras's Theme) - playsong \"sinister_motives\"" "Darediving, My Way (Gavenn's Theme) - playsong \"darediving_my_way\"" "Encounter With Fate - playsong \"encounter_with_fate\"" "----------------------------------------------------------------------" Font(PROP_ON) PrintScore(true) }