BBC basic variables
问题的背景信息:我正在写一个文本冒险游戏,玩家在每个交叉点/问题有多条路径可供选择。
问题:我正试图使用另一个路径中的变量,这可能无法调用。是否仍要在代码行之前调用此变量或跳过代码行?
这是我要说的代码的一部分
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | 38 input"What do you do? 'A' to continue, 'B' to run away" , BAB$ 39 if BAB$ =="A" then 40 if BCP$ =="B" then 41 print"The hunters see you return" 42 print"When they ask if you found the prisoner, you respond by saying that you havent seen him" 43 print"The hunters decide that this venture isnt worth it, and decide to leave, taking you with them" 44 wait 30 45 print"You escape shortly after the rest of the group leaves the area" 46 print"You are now a free man" 47 wait 200 48 clear 49 cls 50 goto 100 51 else 52 goto 55 53 endif |
对我的措辞有什么疑问吗?问问吧!
这个问题最简单的答案是在程序开始时初始化变量:
1 2 | BAB$ ="" BCP$ ="" |
这样,当您到达第40行时,bcp$的值将为"或具有其他值"。