11-30-2018 07:23 PM
Hello,
So, i'm making a small text adventure for a class project and I have to use either a FOR Loop or a While Loop. (Mandatory)
I used a Ring Menu for my "Hero Action" (0 = Look Around, 1 = Talk, 2 = Ask A Question, 3 = Action).
And I have a String Indicator as my "Game Log" where it displays the story.
I have the very first part down. If you choose to look around then it proceeds with the story. If you choose any other action, then it says that you cannot use that action at this time.
How do I make it so that my next action proceeds to the 2nd part of the adventure?
Here is a screen shot of what I have so far.
Any help is appreciated. Thanks!
11-30-2018
08:04 PM
- last edited on
07-18-2024
04:57 PM
by
Content Cleaner
Hello Vomtidude,
Have you read about state machine? If not yet, you can read this tutorial about state machine : https://www.ni.com/en/support/documentation/supplemental/16/simple-state-machine-template-documentat... or find the example on LabVIEW -> Help -> Find Examples.. -> then type state machine and search -> then choose State Machine Fundamentals.
Day@
11-30-2018 09:59 PM
Next time, attach your code (meaning files, preferably having the extension ".vi". It is very difficult to deal with pictures of parts of VIs.
Bob Schor
12-03-2018 10:47 AM
Your first plan of action should not involve LabVIEW at all. You have a lot of work to do before you place your first control. I would recommend that you start off with a pencil and paper and diagram the game from start to finish. OK, I admit, pencil and paper is a little bit archaic for this task. Excel would be much better.
For each step, what happens when you click one of the actions? Do you GOTO the next row? Do you output text? Do you GOTO the beginning? Or the end? How might you store this information in an application? What datatype?
After you work out the details in the above manner, LabVIEW will be the tool that you use to import, interpret, and step thru what you just wrote down.
12-03-2018 05:25 PM
@aputman wrote:
Your first plan of action should not involve LabVIEW at all. You have a lot of work to do before you place your first control. I would recommend that you start off with a pencil and paper and diagram the game from start to finish. OK, I admit, pencil and paper is a little bit archaic for this task. Excel would be much better.
For each step, what happens when you click one of the actions? Do you GOTO the next row? Do you output text? Do you GOTO the beginning? Or the end? How might you store this information in an application? What datatype?
After you work out the details in the above manner, LabVIEW will be the tool that you use to import, interpret, and step thru what you just wrote down.
This is definitely complicated enough to warrant a design document.
12-03-2018 06:45 PM
Is your class project to make a text adventure, or is it to create a program that uses a loop? This is a VERY ambitious project for a "how to use loops" level class.
12-04-2018 05:53 AM
I'd use separate buttons for all actions and an Event structure to react to it. I'd keep an array of clusters (in a file) where each row is the "room" number and "room" indexes for action results (-1 means it's not allowed).
The file would look something like this:
0 "You're in a dark room." 1 -1 -1 -1 (In this case, the only allowed action is "Look around" which'll take you to "room" 1, the next row)
1 "You manage to find a dry piece of wood, with some luck you can light it" 2 -1 -1 3
2 "It's too dark to see anything" 2 -1 -1 3
3 "You light the torch and can see the inside of a stone cellar. It's damp, dark and cold". -1 -1 -1 4
4 "You walk out into freedom. Congratulations!" (end game)
/Y