
-----------------------------------
magicman
Wed Jun 29, 2005 4:13 pm

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..


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?

-----------------------------------
Cervantes
Wed Jun 29, 2005 4:16 pm


-----------------------------------
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
Wed Jun 29, 2005 4:22 pm


-----------------------------------
all right, thanks  :D

-----------------------------------
Delos
Wed Jun 29, 2005 5:28 pm


-----------------------------------
I did not know one could use pipe as an or operator.  Interseting...

-----------------------------------
magicman
Wed Jun 29, 2005 6:18 pm


-----------------------------------
what are you talking about "pipe"?? are you talking about this thing "|"

-----------------------------------
magicman
Wed Jun 29, 2005 6:57 pm


-----------------------------------
i also have another delema,


 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

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
Wed Jun 29, 2005 7:45 pm


-----------------------------------
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
Wed Jun 29, 2005 8:21 pm


-----------------------------------
I'm not omniscient you know :lol:.

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.

-----------------------------------
Cervantes
Wed Jun 29, 2005 8:36 pm


-----------------------------------

I'm not omniscient you know :lol:. 

Well, you were a newbe God at one point.  Maybe you shouldn't have given that up! :D

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.


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
Wed Jun 29, 2005 11:03 pm


-----------------------------------
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 :D.

-----------------------------------
magicman
Thu Jun 30, 2005 8:02 am


-----------------------------------
its been awhile, what are procedures... i never realy got them, when i got taught them... :oops:

-----------------------------------
Cervantes
Thu Jun 30, 2005 8:21 am


-----------------------------------
[url=http://www.compsci.ca/v2/viewtopic.php?t=407]Click!

-----------------------------------
MysticVegeta
Thu Jun 30, 2005 1:35 pm


-----------------------------------
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
Thu Jun 30, 2005 1:58 pm


-----------------------------------
Shift + \.  In and around the backspace and enter/return buttons.

It's also in Java.

-----------------------------------
magicman
Tue Jul 05, 2005 4:28 pm


-----------------------------------
so will procedures work for the monsters also?? on what my friends say, is that i might not, but i dont know.

-----------------------------------
Delos
Tue Jul 05, 2005 5:12 pm


-----------------------------------
Procedures can be customized to work for practically anything.  I would really suggest playing around with parameters to see what they can do for you.  Take a look at Cervantes' update Str. module posted in the 'New Turing' commands thread.  It has some good examples of what paramter-usage can accomplish.

-----------------------------------
magicman
Tue Jul 05, 2005 6:02 pm


-----------------------------------
alright, any thing else?

-----------------------------------
Cervantes
Tue Jul 05, 2005 8:37 pm


-----------------------------------
I'm responding to very few details here, but here goes:
You're trying to use procedures to organize your program.  You intend to use procedures to do various things with the player.  Now you're looking at how to do things with the monsters.  You may want to make your procedures more general so they can correspond to both monster and player.  For example, you could have a procedure to attack in battle.  The parameters would be the attacker and the target.  If you build the player and the monsters out of the same  then you can interchange the target and the attacker.  

Just think about what you're trying to accomplish; then think about the tools at your disposal.  Think about generalizing your subroutines (procedures and functions).  
If you want some more specific help, post some more details. :)
You may also want to check out the Turing Source Code forum to get some ideas.
