Ahh... Heh heh. These three lines:
Alias: pick *
Label: Select_Answer
Script: Act_on_Answer
...I did not expect you to paste that in as a part of your script file. They were intended as instructions to you, to make that alias manually. Delete those three line.
You can copy this code below into the windows clipboard, then click your alias icon to bring up the alias menu, and click the "paste" button on the right side to add this alias:
<aliases>
<alias
name="Select_Answer"
script="Act_on_Answer"
match="pick *"
enabled="y"
ignore_case="y"
>
</alias>
</aliases>
Ok?
Incidentally, I just guessed at what your "flee" commands might be (moving in a direction)... and I put multiple commands seperated by a "," . This would probably not work on any MUD. If you wanted to put multiple commands you would do it like this:
arrAnswers(1) = "south" & vbNewline & "south" & vbNewLine & "south"
"vbNewline" is a special variable (A CONSTANT), which is built into Visual Basic. In this case, it represents hitting the 'Enter/Return' key. That's what you would use the send multiple commands for an answer.
Also, the script is not completely fool-proof. You could use "pick 0" in the mud, and it would send "3" to the mud (in this example). If you type "pick -1", it would probably cause a runtime error. (Because I forgot to check to make sure the number you answer isn't < 1).
Sub Act_on_Answer (AliasName, AliasLine, arrWildcards)
Dim x
If Not IsNumeric(ArrWildcards(1)) Then
World.Note "Invalid answer: You must pick a number."
Else
If CInt(arrWildcards(1)) > arrAnswers(0) Then
World.Note "Invalid answer: Not one of the choices."
ElseIf NOT CInt(arrWildcards(1)) < 1 Then
World.Send arrAnswers(CInt(ArrWildcards(1)))
Else
World.Note "Question ignored and reset."
End If
End If
'Clear the answers using a For-Next loop:
For x = LBound(arrAnswers) to UBound(arrAnswers)
arrAnswers(x) = Empty
Next
arrAnswers(0) = 0
End Sub
That new code above checks to see if the answer is a number less than 1, and if so, it sends nothing to the mud, but still clears the answers. (And wouldn't cause a runtime error). ...So, to be tidy, if you didn't want to pick one of the given answers, you could use "pick 0" to reset the question. |