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


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  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] Refresh page


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

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

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

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

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] 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
[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.


15,382 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 HostDash]