From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Need Help on Text Adventure Class Project.

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!

Screenshot (1).png

0 Kudos
Message 1 of 7
(2,354 Views)

Hello Vomtidude,

 

Have you read about state machine? If not yet, you can read this tutorial about state machine : http://www.ni.com/tutorial/7595/en/ or find the example on LabVIEW -> Help -> Find Examples.. -> then type state machine and search -> then choose State Machine Fundamentals.

 

 

Day@


Day@
Certified LabVIEW Associate Developer
0 Kudos
Message 2 of 7
(2,341 Views)

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

0 Kudos
Message 3 of 7
(2,321 Views)

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. 

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
Message 4 of 7
(2,271 Views)

@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.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 5 of 7
(2,255 Views)

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.

0 Kudos
Message 6 of 7
(2,248 Views)

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

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 7 of 7
(2,231 Views)