I feel like a moron

Posted by WRTIII on Tue 21 Jan 2003 08:14 AM — 7 posts, 23,792 views.

Canada #0
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
USA #1
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
Canada #2
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
Canada #3
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
Australia Forum Administrator #4
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).
Canada #5
Ok I see then I can use any of the three names to call up that info, right?

Thanks
Australia Forum Administrator #6
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