[Home] [Downloads] [Search] [Help/forum]

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  VBscript
. . -> [Subject]  Trigger on login to set name variable
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Trigger on login to set name variable

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


Posted by Jcet   USA  (25 posts)  [Biography] 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!
[Go to top] top

Posted by Vaejor   (120 posts)  [Biography] 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)
[Go to top] top

Posted by Jcet   USA  (25 posts)  [Biography] 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!
[Go to top] top

Posted by Vaejor   (120 posts)  [Biography] 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
[Go to top] top

Posted by Nick Gammon   Australia  (21,652 posts)  [Biography] 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
[Go to top] 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.


4,794 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]