Tutorials    Freebies    Links    Feedback    Thank me
Agent Store   Agent Games   Legal notice    History
Home

Intro»»Part 1»»Part 2»»Part 3»»Part 4»»Part 5

Multiple requests

What if you want more than one request? You declare them as usual, then in the RequestComplete event, put code like this:

If Request Is FirstRequest Then
Add code here
ElseIf Request Is SecondRequest Then
Add code here
ElseIf Request Is ThirdRequest Then
Add code here
End If

Lets have an example. Suppose we want the picture to come back when Merlin says "Yes, it worked!".

First you need to declare another request. Call it reqSpeak.
Then you need to add this code to the RequestComplete event, below where the picture.visible property has been set to false:

Set reqSpeak = Merlin.Speak("Yes, it worked!")

Now we need to use the If...Then statements to get the picture to come back:

If Request Is reqDisappear Then
picPicture.Visible = False
Set reqSpeak = Merlin.Speak("Yes, it worked!")
ElseIf Request Is reqSpeak Then
picPicture.Visible = True
Merlin.Play "surprised"
Merlin.Play "RestPose"
Merlin.Speak "Oh, no. I will have to work" _
& " on my magic."
Merlin.Play "process"
Merlin.Speak "This calls for some work, I will" _
& " have to consult the Grand Wizard!"
Merlin.Hide
End If

Some extra code has been added to make the sequence a bit more interesting.

Intro»»Part 1»»Part 2»»Part 3»»Part 4»»Part 5