Dialogue Question

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

Dialogue Question

Postby time-killer-games » Sat Jan 08, 2011 11:18 pm

Is there a some sort of vbscript code that actives a brand new dialogue?

For example, I have a Dialogue asking a question that when you click on it, it should open an inputbox.

I'd like the inputbox to not go to another frame. Instead, depending on what I type in, I'd like it to stay at the same frame while generating a new question to ask with the Dialogue.

This is a nonsence code but it shows what I'd like to do...

Code: Select all
cmd = InputBox ("Submit your answer in the following textbox:")

If cmd = "answer1" Then NewDialogue "This is the Dialogue text responding to answer1"

If cmd = "answer2" Then NewDialogue "This is the Dialogue text responding to answer2"



Is this possible?
Thanks!
TKG
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 08, 2011 11:26 pm

Are you wanting to do all this within vbscript? or do you have the option to do it from AM's dialogue tool?
---


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

Postby time-killer-games » Sat Jan 08, 2011 11:37 pm

I meant all in vbscript.
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 08, 2011 11:52 pm

I've never tried that one! 8)

How does it work now? I mean, how does it know what frame to go to after a specific dialogue? Could you just reopen the same frame? If so, you could use variables to make sure it doesn't repeat itself.

Sounds like something I'll have to try out someday!
---


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

Postby time-killer-games » Sat Jan 08, 2011 11:55 pm

I don't know that's why I'm asking
User avatar
time-killer-games
Expert Member
 
Posts: 400
Joined: Fri Dec 24, 2010 6:10 pm
Location: Virginia Beach, VA

Postby Mystery » Sun Jan 09, 2011 12:45 am

I'm confident that this is possible.

You want to create sort of a dialogue tree on the same screen, that depends on the user input?
And do you want to use an Input Box or a Text Box for the user input?
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Postby time-killer-games » Sun Jan 09, 2011 1:24 am

^exactly

Edit: an inputbox would be less complicated code-wise than a textbox by istelf. So an input box is what I'd like to use.
User avatar
time-killer-games
Expert Member
 
Posts: 400
Joined: Fri Dec 24, 2010 6:10 pm
Location: Virginia Beach, VA

Postby Mystery » Sun Jan 09, 2011 3:08 am

Some hints that might get you started. But maybe there are better ways, I'm not good with VBScript :P

Create some text on the screen by right clicking on it. Enter something (doesn't matter what, I entered question)

Create a hotspot where you have entered the text before, but over the whole width of the screen (since the question will be longer than the word question)

Go to the Frame Properties and add
Code: Select all
Text(1).caption= "Hello Human. Would you like to drink"+vblf+ "coffee or drink water?"


Go to VBS Procedures, and create subroutines for the answers.
Working example:
Code: Select all
Sub Question1
answer1 = "drink coffee"
answer2 = "drink water"
Do
  returnvalue = InputBox("Please enter your answer.","Answer")
  Select Case returnvalue

     Case ""
       MsgBox "Okay, think again."
       Exit Do

     Case answer1
       Text(1).caption= "I see, you're a coffee addict." +vblf+ "Sugar or no sugar? "
       question1_ok=1
       Exit Do
     Case answer2
       Text(1).caption= "Well, water is healthy."+vblf+ "Do you agree? "
       question1_ok=2
       Exit Do
     Case Else
       Text(1).caption= "Sorry, I don't understand what you are saying." +vblf+ "Drink coffee or drink water? "
  End Select
Loop
End Sub


Sub Question2
answer1 = "sugar"
answer2 = "no sugar"
Do
  returnvalue = InputBox("Please enter your answer.","Answer")
  Select Case returnvalue

     Case ""
       MsgBox "Okay, think again."
       Exit Do

     Case answer1
       Text(1).caption= "I like coffee with sugar, too."  +vblf+ "Do you prefer dog or cat?"
       question2_ok=1
       Exit Do
     Case answer2
       Text(1).caption= "Ugh, I hate coffee without sugar." +vblf+ "Do you prefer cookie or cake?"
       question2_ok=2
       Exit Do
     Case Else
       Text(1).caption= "Sorry, I don't understand what you are saying. Try again "
  End Select
Loop
End Sub


Sub Question3
answer1 = "yes"
answer2 = "no"
Do
  returnvalue = InputBox("Please enter your answer.","Answer")
  Select Case returnvalue

     Case ""
       MsgBox "Okay, think again."
       Exit Do

     Case answer1
       Text(1).caption= "Great!"
       question3_ok=1
       Exit Do
     Case answer2
       Text(1).caption= "I think you're wrong."
       question3_ok=2
       Exit Do
     Case Else
       Text(1).caption= "Sorry, I don't understand what you are saying. Try again "
  End Select
Loop
End Sub


Sub Question4
answer1 = "dog"
answer2 = "cat"
Do
  returnvalue = InputBox("Please enter your answer.","Answer")
  Select Case returnvalue

     Case ""
       MsgBox "Okay, think again."
       Exit Do

     Case answer1
       Text(1).caption= "Dogs are wonderful!"
       question4_ok=1
       Exit Do
     Case answer2
       Text(1).caption= "Cats are very nice!"
       question4_ok=2
       Exit Do
     Case Else
       Text(1).caption= "Sorry, I don't understand what you are saying. Try again "
  End Select
Loop
End Sub

Sub Question5
answer1 = "cookie"
answer2 = "cake"
Do
  returnvalue = InputBox("Please enter your answer.","Answer")
  Select Case returnvalue

     Case ""
       MsgBox "Okay, think again."
       Exit Do

     Case answer1
       Text(1).caption= "Yummy cookies!"
       question4_ok=1
       Exit Do
     Case answer2
       Text(1).caption= "Me, too!"
       question4_ok=2
       Exit Do
     Case Else
       Text(1).caption= "Sorry, I don't understand what you are saying. Try again "
  End Select
Loop
End Sub



Go to the Hotspot Properties on the screen, and enter
Code: Select all
If question1_ok=0 Then Question1
If question1_ok=1 Then Question2
If question1_ok=2 Then Question3
If question2_ok=1 Then Question4
If question2_ok=2 Then Question5


Now create the integer variables
question1_ok
question2_ok
question3_ok
question4_ok


I've found it pretty difficult to keep track of the questions and answers and variables :lol:
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Postby reneuend » Sun Jan 09, 2011 5:42 am

Its very well written, Mystery. The only thing I would comment on is that subroutines should be generic. I would pass in a comma delimited string of questions and answers and parse them inside the subroutine.

(edit) It's late here, but I'll show you a different way later. I like Mystery's answer as it is simple. But, if you have to do this for several frames and have lots of choices, I think there is a better solution. You may not need it, but it has triggered my interest in custom dialoguing! :)
---


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

Postby time-killer-games » Sun Jan 09, 2011 1:48 pm

This is perfect. Thanks mystery!
User avatar
time-killer-games
Expert Member
 
Posts: 400
Joined: Fri Dec 24, 2010 6:10 pm
Location: Virginia Beach, VA

Postby Mystery » Sun Jan 09, 2011 4:22 pm

Thanks reneuend :)
I just had this basic idea right away how it could work, and you all are invited to tweak and turn it, and work out an easier and better solution :)

You're welcome time-killer-games :)
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland


Return to Adventure Maker General Discussion

Who is online

Users browsing this forum: No registered users and 5 guests

cron