Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Buttons
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Jonnu




PostPosted: Thu Mar 27, 2008 3:50 pm   Post subject: Buttons

hey i am trying to make a game and decided to use buttons.
My question is is it possible to use buttons so that a get stament isn't used but still can make a var have a value.
I tried but after then button screen went off the procedure stopped and the var didn't have a vaule
Sponsor
Sponsor
Sponsor
sponsor
Mackie




PostPosted: Thu Mar 27, 2008 3:52 pm   Post subject: RE:Buttons

Sorry, I don't know exactly what your asking about. Do you have any code so far?
darkangel




PostPosted: Thu Mar 27, 2008 5:00 pm   Post subject: Re: Buttons

.....I think your talking bout the getch() or the Input.KeyDown() commands, but not sure.
Can you be a little bit more specific or provide your code?
Jonnu




PostPosted: Thu Mar 27, 2008 6:18 pm   Post subject: Re: Buttons

umm ok i'll try and explain i don't have the code because i didn't save it due to the fact that it didn't work soo here it goes.

My game is a Text base RPG where the user is given a situation and has to decide what to do.

this is a situation in the beginning of the game where the user has to chose what there greatest strength will be which is Power Speed or Smart

this is the code

Quote:
put "What is your greatest strength"
put "Power,Speed or Smart"
get mainS
cls
if mainS= ('Power')
then put "Choose your weapon"
put "Fists, GiantHammer or Claymore"
get weapon
elsif mainS= ('Speed')
then put "Choose your weapon"
put "Legs, Claws or Bow"
get weapon
elsif mainS= ('Smart')
then put "Choose your weapon"
put "Hands, Wand or Staff"
get weapon
end if
cls


this lets the user choose which is there main stat then what weapon they want to use


if you look at it when the user is prompt to give and answer it has to be exactly right
for example if the user wants Power then they have to type Power not power and in the later game a simple mess up will cause and error and the user has to restart


now what i want is to make these choices as buttons instead on having to type them i and wondering if i can change

put "What is your greatest strength"
put "Power,Speed or Smart"
get mainS

i understand how to make the buttons just not how i can get an answer from the user so that when they click the button the variable is that for the rest of the game.

if you still don't understand i will try and get it to the version where i had the buttons. Very Happy
jinjin




PostPosted: Thu Mar 27, 2008 6:41 pm   Post subject: Re: Buttons

I'm not sure how to make buttons myself in Turing as I am still in Gr.10, which is year 1 programming. However, for this problem:

Quote:
if you look at it when the user is prompt to give and answer it has to be exactly right
for example if the user wants Power then they have to type Power not power


You can change that by adding an 'or' to the if statement. For example

code:

get (input)
if (input) = "Power" or (input) = "power" then (perform action)


Now the user can input "Power" or "power" to perform the next action.
Sean




PostPosted: Thu Mar 27, 2008 6:53 pm   Post subject: Re: Buttons

Your wanting those choices as buttons?

If so, Draw a box around the words which are coded with Draw.Text

Look up Mouse.Where if you are wanting to use your own buttons. You would need to check the between the boundaries of the Box and then have it do what you want, by using an if statement.
Mackie




PostPosted: Thu Mar 27, 2008 6:59 pm   Post subject: RE:Buttons

Check out my latest post, there is a really simple button in there, but I suggest learning it your self before you use it.

http://compsci.ca/v3/viewtopic.php?p=157366#157366
Jonnu




PostPosted: Thu Mar 27, 2008 7:27 pm   Post subject: Re: Buttons

jinjin @ Thu Mar 27, 2008 6:41 pm wrote:
I'm not sure how to make buttons myself in Turing as I am still in Gr.10, which is year 1 programming. However, for this problem:

Quote:
if you look at it when the user is prompt to give and answer it has to be exactly right
for example if the user wants Power then they have to type Power not power


You can change that by adding an 'or' to the if statement. For example

code:

get (input)
if (input) = "Power" or (input) = "power" then (perform action)


Now the user can input "Power" or "power" to perform the next action.



yea but also this won't work becuase they might spell it incorrect

and ty i will see with Draw.Text and everything else TY for your help and

jinjin fyi i am in Gr.10 too but since we are barly in school for march i decided to start a game for fun just to as you can say flex my muscles
Sponsor
Sponsor
Sponsor
sponsor
Sean




PostPosted: Fri Mar 28, 2008 6:28 am   Post subject: Re: Buttons

That's why you give them what the inputs should be in an put statement like you did above. Or, you can have it check to see if it is not correct, then loop back to the beginning. Meaning you will need a main loop for the entire game.

Turing:

loop

%Your Code Here

end loop
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 9 Posts ]
Jump to:   


Style:  
Search: