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 ➜ General ➜ alias calls 2 subs and sets var

alias calls 2 subs and sets var

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


Pages: 1  2  3 

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #30 on Thu 13 Jul 2006 10:43 PM (UTC)
Message
Just noticed you are doing an alias and not a trigger, but the technique is the same:

http://www.gammon.com.au/scripts/doc.php?function=GetAliasInfo

http://www.gammon.com.au/scripts/doc.php?function=GetAliasWildcard

- Nick Gammon

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

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #31 on Thu 13 Jul 2006 10:55 PM (UTC)
Message
Quote:

I wonder if that could be looked at in some future release though (if it's feasible) to be able to just write an alias (not a trigger) of, for example,


  <alias
   match="my * has * so back off."
   send_to="12"
  >
   <send>
   sub1 %1
   sub2 %1
   sub3 %2
   </send>
  </alias>




Sure, you can do that now but you are missing quotes. Think about how this will be expanded by substituting the words you gave:


   sub1 girlfriend
   sub2 girlfriend
   sub3 rabies


You are calling subs with variable names (which will probably be empty) so that won't work. You want:


  <alias
   match="my * has * so back off."
   send_to="12"
  >
   <send>
   sub1 "%1"
   sub2 "%1"
   sub3 "%2"
   </send>
  </alias>


Now that will expand to:


   sub1 "girlfriend"
   sub2 "girlfriend"
   sub3 "rabies"


... which is what you want.

- Nick Gammon

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

Posted by Guest1   USA  (256 posts)
Date Reply #32 on Thu 13 Jul 2006 11:32 PM (UTC)
Message
GOT IT :)

sub sub2 (thewildcards)
  if world.GetAliasWildcard ("my_alias", 1) = "girlfriend" then
      World.send "scream"
  else
      World.send "cheer"
  end if
end sub

happy happy joy joy. Thanks heap for your help everyone :)
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.


86,939 views.

This is page 3, subject is 3 pages long:  [Previous page]  1  2  3 

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.