Author |
Message |
magicman
|
Posted: Wed Jun 29, 2005 4:13 pm Post subject: moving back... |
|
|
Im making a text base game, and im asking if something is ok, and of corse its in an if statement, something like..
code: |
if ans="y"|ans="Y" then
%it will continue the game.
end if
if ans="n"|ans="N" then
%it will go to the begining.
end if
|
so what do i do? |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Cervantes
|
Posted: Wed Jun 29, 2005 4:16 pm Post subject: (No subject) |
|
|
Good thing you posted that code, or I would have had NO idea what you were asking about.
Put your program in a loop. If no, then exit. Otherwise, you continue. |
|
|
|
|
|
magicman
|
Posted: Wed Jun 29, 2005 4:22 pm Post subject: (No subject) |
|
|
all right, thanks |
|
|
|
|
|
Delos
|
Posted: Wed Jun 29, 2005 5:28 pm Post subject: (No subject) |
|
|
I did not know one could use pipe as an or operator. Interseting... |
|
|
|
|
|
magicman
|
Posted: Wed Jun 29, 2005 6:18 pm Post subject: (No subject) |
|
|
what are you talking about "pipe"?? are you talking about this thing "|" |
|
|
|
|
|
magicman
|
Posted: Wed Jun 29, 2005 6:57 pm Post subject: (No subject) |
|
|
i also have another delema,
code: |
put "There is a,"
put "Equipment Shop (N)"
put "Bar (E)"
put "Galactic Police (S)"
put "Apartments (W)"
put "Jedi Academy (NE)"
get ans
delay (500)
cls
if ans = "n"| ans = "N" then
put "What do you want you ", race, "??"
put "(B)uy"
put "(E)xit"
get ans
if ans = "b"| ans = "B" then
elsif ans = "e"| ans = "E" then
exit
end if
end if
|
i want it to, when ans="e", that it will go back to the
code: |
put "There is a,"
put "Equipment Shop (N)"
put "Bar (E)"
put "Galactic Police (S)"
put "Apartments (W)"
put "Jedi Academy (NE)"
get ans
|
part. how can i do that? |
|
|
|
|
|
Bacchus
|
Posted: Wed Jun 29, 2005 7:45 pm Post subject: (No subject) |
|
|
Stick that part in a loop.
As for the pipe -->|, yes it can be used as 'or' the same as & can be used as 'and'. I'm surprised you didn't know that... |
|
|
|
|
|
Delos
|
Posted: Wed Jun 29, 2005 8:21 pm Post subject: (No subject) |
|
|
I'm not omniscient you know .
As for your dilema, magicman, I would highly recommend looking into procedures. You will find that once you're able to box up bits of your code, everything will flow a lot smoother. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Cervantes
|
Posted: Wed Jun 29, 2005 8:36 pm Post subject: (No subject) |
|
|
Delos wrote:
I'm not omniscient you know .
Well, you were a newbe God at one point. Maybe you shouldn't have given that up!
The other way to look at this is to have a variable store the player's location. This way, you just have one loop and one if .. elsif .... end if statement.
code: |
loop %main loop
if player.location = "weapon shop " then
%options. Would be good to proceduralize this
%buy, sell, talk
elsif player.location = "bar" then
%buy drinks, talk
elsif player.location = "live8" then
player.fun = "very yes"
end if
end loop
|
|
|
|
|
|
|
Delos
|
Posted: Wed Jun 29, 2005 11:03 pm Post subject: (No subject) |
|
|
And of course that construct itself can be boxed up as well! You might even want to make a dynamic construct that is similar to that! It would be rather challenging though - making a procedure that gives a variable number of options to choose from and reacts differently depending on the chosen response...
It's possible though, using the all-powerful flexiblie array!
Newbe God. Keep that ?! Umm...no thanks. I like my current rank much better . |
|
|
|
|
|
magicman
|
Posted: Thu Jun 30, 2005 8:02 am Post subject: (No subject) |
|
|
its been awhile, what are procedures... i never realy got them, when i got taught them... |
|
|
|
|
|
Cervantes
|
Posted: Thu Jun 30, 2005 8:21 am Post subject: (No subject) |
|
|
Click! |
|
|
|
|
|
MysticVegeta
|
Posted: Thu Jun 30, 2005 1:35 pm Post subject: (No subject) |
|
|
Bacchus wrote: Stick that part in a loop.
As for the pipe -->|, yes it can be used as 'or' the same as & can be used as 'and'. I'm surprised you didn't know that...
I didnt know that either, i thought it worked only for C++, by the way, just for my stupidity, which key types the "pipe"? |
|
|
|
|
|
Cervantes
|
Posted: Thu Jun 30, 2005 1:58 pm Post subject: (No subject) |
|
|
Shift + \. In and around the backspace and enter/return buttons.
It's also in Java. |
|
|
|
|
|
magicman
|
Posted: Tue Jul 05, 2005 4:28 pm Post subject: (No subject) |
|
|
so will procedures work for the monsters also?? on what my friends say, is that i might not, but i dont know. |
|
|
|
|
|
|