!                            SAMPLE SCRIPT FOR OUTDOOR
! The following is a script which can be used with Virtual BBS version 7.0
! to call the game, then upon exiting, check for the OUTDOOR file, and if
! it exists, read it and award the extra time or credits to the player. This
! is for VBBS, however, the format would be similar for other BBS scripting
! languages.

ACTION "Chain Reaction"
$outdoor = "c:\bbs\doors\chreact\outdoor.1"

! This reads the extra variable number 7 to see if the game has been played
! If game already played, it jumps to check the outdoor file
testval $extra7 = 1 played

! This set the extra variable number 7 to 1. Means game has been played.
SETEXTRA 7 1

testval $port = 0 local
testval $port = 1 node1
testval $port = 2 node2

# local
RETURNSCRIPT chain
door "c:\bbs\doors\chreact\chreact c:\bbs\temp\n0\door.sys"

# node1
RETURNSCRIPT chain
door "c:\bbs\doors\chreact\chreact c:\bbs\temp\n1\door.sys/5"

# node2
RETURNSCRIPT chain
door "c:\bbs\doors\chreact\chreact c:\bbs\temp\n2\door.sys"


# played
! Resets the extra variable 7 to 0, or finished.
SETEXTRA 7 0
checkfile $exist $outdoor
testval $exist <> 0 filethere 
go end

# filethere
open $outdoor input
read $who
read $awardtm
read $awardcr
read $addtm
read $addcred
close
$tottime = $awardtm + $addtm
$totcred = $awardcr + $addcred
ifval $tottime > 0 then
        ADDTIME $tottime
endif
ifval $totcred > 0 then
        ADDCREDITS $totcred
endif
kill $outdoor
# end
exit rdoor
