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
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. :-(
The code of my menu title is :N3H323ZD
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.
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