Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ VBscript ➜ Trigger on login to set name variable

Trigger on login to set name variable

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Jcet   USA  (25 posts)  Bio
Date Sun 12 May 2002 08:54 AM (UTC)
Message
Basicly, the trigger reads:
Name:
you type something and it sets it to a variable and also send it to the world... any ideas how I would go about this?

-Jcet
See no good, hear no good, be no good, kill all good!
Top

Posted by Vaejor   (120 posts)  Bio
Date Reply #1 on Sun 12 May 2002 03:24 PM (UTC)
Message
My first thought is to find a general statement on the mud during the login process that displays your name and capture it from there, but from your request, that doesn't seem to be a useful alternative right now.

Here's one way that I've thought of. I've done some minimal testing on it, and it seems to work fine:

Set up a trigger as follows:

Trigger: Name:
Enabled: <Checked>
Label: catch_name
Script: catch_name


Insert into your script file as follows:

Dim thename 'Note: You can put this inside the Sub if you will pull the variable from the MushClient variable each time using world.GetVariable().

Sub catch_name(ByVal strName, ByVal strLine, ByVal astrParam())
thename = InputBox(strLine)

world.Send thename
world.SetVariable("thename", thename)
End Sub


This will pull up an inputbox, where you can type in the information and it will be pushed to the mud(via the .Send) and stored in a MushClient variable(via the .SetVariable)
Top

Posted by Jcet   USA  (25 posts)  Bio
Date Reply #2 on Sun 12 May 2002 07:53 PM (UTC)
Message
I tried that but it says cannont use parentheses when calling a sub.

-Jcet
See no good, hear no good, be no good, kill all good!
Top

Posted by Vaejor   (120 posts)  Bio
Date Reply #3 on Sun 12 May 2002 07:59 PM (UTC)
Message
Ahh, my apologies, try the following VBScript instead:


 Dim thename 'Note: You can put this inside the Sub if you will pull the variable from the MushClient variable each time using world.GetVariable().

Sub catch_name(ByVal strName, ByVal strLine, ByVal astrParam())
  thename = InputBox(strLine)

  world.Send thename
  world.SetVariable "thename", thename
End Sub
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #4 on Sun 12 May 2002 09:42 PM (UTC)
Message
One problem with triggers is that they don't match until a newline. Thus, if the mud is waiting for you to type in a name, like this:

Name:

The trigger won't match (because no newline has been received).

What I would do here, guessing that you want to remember the name you entered automatically, is to enter the name the usual way, but catch when the MUD echoes it.


Please choose a name for your character:
Temyr
Did I get that right, Temyr (Y/N)?


In this case, you enter the name "Temyr" in the usual way, but make a trigger to catch it like this:


Trigger: Did I get that right, * (Y/N)?
Send: %1
Send to: Variable (label is name)
Label: character_name


Of course, the exact trigger text would depend on the MUD in question, but many of them will be similar as they are based on the same code.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


18,681 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.