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
➜ Problem getting a variable from trigger
Problem getting a variable from trigger
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Orogan
(23 posts) Bio
|
Date
| Sat 20 Mar 2010 08:45 PM (UTC) |
Message
| Hello all
My triger is
<trigger
name="AuctLine"
group="auction"
enabled="y"
match="^Auction: (?P<sell_name>.*?) is auctioning.*$"
regexp="y"
ignore_case="y"
expand_variables="n"
script="auction_to_gt"
send_to="12"
sequence="10"
>
</trigger>
It triggers on something like:
Auction: Seller is auctioning an item (Level lvl 10, Num 111). Current bid is 100.
the trigger fires but when I try to use the variable it say's its a nil value.
the function I use :
function auction_to_gt (name,line,wildcards,styles)
if name == "AuctLine" then
SellName = (GetAliasWildcard ("AuctLine", "sell_name"))
Send ("gt " .. SellName)
return
end -- if
end --auction_to_gt
the error msg I get:
attempt to concatenate global 'SellName' (a nil value)
I can't seem to find what's wrong with it, so any help greatly appreciated.
And if I'm going all wrong with this please say so.
Cheers
Orogan | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #1 on Sat 20 Mar 2010 09:25 PM (UTC) |
Message
|
Orogan said:
function auction_to_gt (name,line,wildcards,styles)
if name == "AuctLine" then
SellName = (GetAliasWildcard ("AuctLine", "sell_name"))
Send ("gt " .. SellName)
return
end -- if
end --auction_to_gt
This is a trigger, and you are calling GetAliasWildcard. That gets alias wildcards. You meant GetTriggerWildcard.
You can simplify it anyway, like this:
function auction_to_gt (name,line,wildcards,styles)
if name == "AuctLine" then
Send ("gt " .. wildcards.sell_name)
return
end -- if
end --auction_to_gt
The wildcards array, passed to this function will have the named wildcard there, you don't need to use GetAliasWildcard or GetTriggerWildcard.
And if this function is only ever called by that one trigger, just do this:
function auction_to_gt (name,line,wildcards,styles)
Send ("gt " .. wildcards.sell_name)
end --auction_to_gt
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Orogan
(23 posts) Bio
|
Date
| Reply #2 on Sat 20 Mar 2010 09:41 PM (UTC) |
Message
| Ha ...
Thanks a lot.
That's what you get, when you use copy and past.
I'll use the simplified version makes it less complex.
The function won't be called only by that trigger, but thanks for the hint.
On a side note:Great program Nick,more support,improvement and so on then you could expect from a free program.
orogan
| Top |
|
Posted by
| AaronM86
(42 posts) Bio
|
Date
| Reply #3 on Wed 31 Mar 2010 07:27 PM (UTC) |
Message
| Beyond great, I would say! :P lol Blows any other client out of the water, if you want my honest opinion. :D | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #4 on Thu 01 Apr 2010 05:04 AM (UTC) |
Message
| Thanks, both of you. :) |
- 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.
17,311 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top