Code Issues

This forum is meant for posting anything related to Adventure Maker that doesn't fit in the other forums.Please post technical questions in the Technical Support Forum!

Moderators: time-killer-games, Vengeance66, Candle, reneuend, GM-Support

Code Issues

Postby time-killer-games » Sat Jan 01, 2011 3:33 am

Here's my code:

cmd = InputBox ("my question", "my title")
If cmd = "my input 1" Then MsgBox "my message"
If cmd = "my input 2" Then cmd = InputBox ("my question", "my title")
If cmd = "my input 3" Then MsgBox "my message"

Ok so when my input is entered it takes me to another InputBox or MsgBox, but when I use the wrong input I'd like it to repeat the most previous InputBox, instead of closing the VBS entirely.

Is there a way to do this? If so, how?
Thanks!
TKG

Btw- thanks guys for all the help lately and happy new year!
User avatar
time-killer-games
Expert Member
 
Posts: 400
Joined: Fri Dec 24, 2010 6:10 pm
Location: Virginia Beach, VA

Postby reneuend » Sat Jan 01, 2011 4:04 am

Is this what you are trying to do?

Code: Select all
while not cmd = "my input 2"
  cmd = InputBox("my question", "my title")
  If cmd = "my input 1" Then
    MsgBox "my message"
  elseif cmd = "my input 3" Then
    MsgBox "my message"
  end if
wend

'cmd = "my input 2
cmd = InputBox ("my question", "my title")
Last edited by reneuend on Sat Jan 01, 2011 6:48 am, edited 1 time in total.
---


Image
Image
User avatar
reneuend
Administrator
 
Posts: 2762
Joined: Sat Nov 22, 2008 8:37 pm
Location: Midwest Cornfield, USA

Postby time-killer-games » Sat Jan 01, 2011 4:54 am

Not exactly. I mean whenever my input box has the wrong input it re-opens the same input box instead of closing the inputbox.

sorry if I'm saying this it in a confusing way, this is some confusing code XD
User avatar
time-killer-games
Expert Member
 
Posts: 400
Joined: Fri Dec 24, 2010 6:10 pm
Location: Virginia Beach, VA

Postby reneuend » Sat Jan 01, 2011 6:37 am

I put in the following and it goes through just fine in all cases including if I put in junk that doesn't fit any condition.

Code: Select all
Dim cmd
cmd = InputBox ("Enter Your Name", "Test InputBox")
If cmd = "Bob" Then MsgBox "Hi Bob"
If cmd = "Jim" Then cmd = InputBox ("What is your last name Jim?", "second question")
If cmd = "Tom" Then MsgBox "Hi Tom"



Is there any other code on this? Maybe you should test it on a blank frame with nothing else that might change your variables.
---


Image
Image
User avatar
reneuend
Administrator
 
Posts: 2762
Joined: Sat Nov 22, 2008 8:37 pm
Location: Midwest Cornfield, USA


Return to Adventure Maker General Discussion

Who is online

Users browsing this forum: No registered users and 0 guests

cron