? old style textual adventure (Page 1) ● SmileBASIC Source Forums

Sign In

Register
*Usernames are case-sensitive
Forgot my password

old style textual adventure

  • #1 ✎ 3 Jollynero74 Hi to everyone, sorry for my bad English. I write from Italy I want create a simply old style textual adventure. Someone can tell me how made a program line in smilebasic like this example: "you arrive at the door, do you want open or go away?" You open the door=press A You go away=press B Thank you Posted
  • #2 ✎ 73 seggiepants Are you looking to make a "Choose your own Adventure" style branching story (see www.cyoa.com) , or something more like Zork (see https://en.m.wikipedia.org/wiki/Zork) where you type in commands like say go north or get lamp? The first is far simpler to implement. Posted
  • #3 ✎ 3 Jollynero74 Thank you! I already write the first part of the story, it's a simple mystery story with textual crossroads(no animation, only text) . My problem now is connect with buttons a part of the story to another.(if you open the door press button A, if go away press button B) Following tutoriasl of smilebasic i made the menu of adventure. Now I can't know how to make the part of program that when I pressing A button the program go to another page with the first part of text of the story and after make a crossroad to another 2 pages I try the command: A=button() goto @firstpage But it is not exact. :-( Posted
  • #4 ✎ 3 Jollynero74 The code of my menu title is :N3H323ZD Posted
  • #5 ✎ 24 Eternity_Games here i can help. you are typing the command wrong. what you want is : IF BUTTON() AND #A THEN GOTO @WHEREVER. this will only send you to @WHEREVER when the button A is pressed. change the button name to say #B or #X to make different input registers. and dont forget a GOTO @WHEREVER after the IF THEN statement so it doesnt pass the imput register. and one last thing, you will want to make the button part BUTTON(3) because then it will only activate when the button is released so you dont go zipping through the game. i hope this helped. check back here if you get it working. Posted
  • #6 ✎ 24 Eternity_Games example: LOCATE X,Y: PRINT " DOOR TO YOUR LEFT, HALLWAY TO YOUR RIGHT" LOCATE X,Y: PRINT" PRESS A FOR HALLWAY,AND Y FOR DOOR" @START IF BUTTON(3) AND #A THEN GOTO @HALLWAY IF BUTTON(3) AND #Y THEN GOTO @DOOR VSYNC GOTO @START @HALLWAY "NONSENSE CODE FOLLOWING THE RULES FROM BEFORE" GOTO @HALLWAY @DOOR "NONSENSE CODE FOLLOWING THE RULES FROM BEFORE" GOTO @DOOR Posted Edited by Eternity_Games
  • #7 ✎ 33 Plancake Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Video Games I like to play video games! Hobbies Reading I like to read books! Hobbies It would be much easier to use data. It's not that hard to learn, honestly. ACLS DIM AREA$[5] LB$="@AREA1" WHILE TRUE CLS RESTORE LB$ FOR I=0 T 4 READ AREA$[I] NEXT PRINT "You can see:" + AREA$[0] PRINT "A:" + AREA$[1] PRINT "B:" + AREA$[2] REPEAT IF BUTTON(3) AND #A THEN LB$=AREA$[3] IF BUTTON(3) AND #B THEN LB$=AREA$[4] UNTIL BUTTON(3) PRINT "You move on to the next area..." WAIT 60 WEND @AREA1 DATA "a door to your left, hallway to your right","Enter hallway","Enter door","@AREA2","@AREA3" @AREA2 DATA "(Blank)","(Blank)","(Blank)","","" @AREA3 DATA "(Blank)","(Blank)","(Blank)","","" I am unable to test it right now, but it should work. If you need any more help, I'll be here. :) Posted
  • #8 ✎ 73 seggiepants Please, please use functions instead of GOTO and GOSUB. You don't want spaghetti code; you want something you can maintain and edit. I also agree with plancake. There is no reason you couldn't make this completely data driven. You could simply have each choice refer to a text file, then open that and print it out. Anyway if you wanted something more like Zork, you could look at my program LOSTMYBALL the key is BDWE58AV but that is overkill for something like a branching text story. If you are new to coding I suggest reading through my number guessing game NUMBERGUESS the key is 8E7Y33G4 You could also try the exercism.io coding challenges (EXERCISM) I translated to SmileBasic the key is 5RDXV3CJ Posted
  • #9 ✎ 31 Mr_Mo Reading I like to read books! Hobbies Video Games I like to play video games! Hobbies Zelda Is Awesome! I love The Legend Of Zelda! Express Yourself I made a text adventure game engine called Tension that will do all of this for you. here, try it out: http://smilebasicsource.com/page?pid=833 If you want anything added to the program, any features, etc. tell me, and I will either tell you how to do that, or give you a key with the changes Posted Edited by Mr_Mo