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 ➜ I feel like a moron

I feel like a moron

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


Posted by WRTIII   Canada  (76 posts)  Bio
Date Tue 21 Jan 2003 08:14 AM (UTC)
Message
I can't find it in helps files anywhere and I know I know how to do it but hell it won't come to me lol


I have an alias

Target *

which will call upon a script to put the wildcard into a varible

So that way I can quickly change who it is in my target varible...

Sub TargetSet
world.setvarible "Target", "???"

what do I put to call upon the WILDCARD?

Thanks, Bill
Top

Posted by Shadowfyr   USA  (1,792 posts)  Bio
Date Reply #1 on Tue 21 Jan 2003 08:24 AM (UTC)
Message
Well don't feel like a moron. The correct syntax for subs is listed someplace, but... I don't remember where. ;)

Basically the syntax for subs are like so though:

Timers>

sub Subname (TimerName)

Aliases and Triggers>

sub Subname (Alias/TriggerName, Output, Wildcards)

The act that aliases and triggers use the same exact design can prove useful sometimes. ;)

I usually use AName and TName for the Alias/TriggerName, since it is short and wilds for Wildcards for the same reason. Basically whether you call it wilds, Wildcards or just Somejunk it will contain an array (sort of) of all the info passed to the sub by the alias or trigger as Wildcards(0) - Wildcards(10). Note however that 0 and 10 both have special meanings, so the parts returned are only in 1-9. In your case you would do something like:

Sub TargetSet (Tname, output, Wilds)
  world.setvarible "Target", Wilds(1)
end sub


I think we are getting to the point where a lot of this stuff needs to be in a tutorial or FAQ (or both). lol
Top

Posted by WRTIII   Canada  (76 posts)  Bio
Date Reply #2 on Tue 21 Jan 2003 08:30 AM (UTC)
Message
Thanks :P I just need to constantly code :P and back what I do up :P I had all this code I am currently working on done to a T 6 months ago or something like that some time ago but then I quite working on any and lost all of it sometime later now I forget everything and don't have much for reference but the tidbits that I had asked help about before here :P

At any rate yea that's one part I never did and still don't really understand
the

Sub (A,B,C)

I know you can put anything you want in thoose three spots Tname Output wildcards whatever.. but I don't know what their use is I've never found where putting them in do anything usefull other than make the sub work :P
Top

Posted by WRTIII   Canada  (76 posts)  Bio
Date Reply #3 on Tue 21 Jan 2003 08:41 AM (UTC)
Message
Sub Target_Set (TargetSet, output, Wilds)
world.setvariable "Target", Wilds(1)
world.note "Your target is now, " & Wilds(1)
end sub

Alias --

Label: TargetSet
Script: Target_Set
X Enabled
X Ignore Case
X Regular Expression.....

Lol * don't work for wild with regular expression on :)

that's another thing I gotta learn is the true use of reg expression :P All I use it for is triggers.. Do I want the trigger to see ONLY this on a single line
or do I want the trigger to see the critera anywhere on a single line.

shrugs :P
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #4 on Tue 21 Jan 2003 09:01 AM (UTC)
Message
The three arguments, as Shadowfyr says are: name, output, wildcards. These are passed to the sub, you don't change them.


  • name - the name of the calling trigger/alias. That lets you share subs between multiple triggers/aliases.
  • output - the matching line in its entirety - so you can see what line matched
  • wildcards - the 9 matching wildcards (wildcards (1) through to wildcard (9)) plus the entire matching text in wildcards (10).

- Nick Gammon

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

Posted by WRTIII   Canada  (76 posts)  Bio
Date Reply #5 on Tue 21 Jan 2003 09:18 AM (UTC)
Message
Ok I see then I can use any of the three names to call up that info, right?

Thanks
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #6 on Tue 21 Jan 2003 10:04 AM (UTC)
Message
Not sure what you mean by that. Each name identifies a different piece of info. eg.

sub mytrigger (name, output, wildcards)

world.note "Trigger is named " & name
world.note "Matching line is " & output
world.note "Wildcard 1 is " & wildcards (1)

end sub

- 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.


22,521 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.