Comparing Variables

Posted by Kurapiira on Fri 05 Mar 2010 05:30 AM — 10 posts, 33,296 views.

#0

Sorry, cant find info or figure this out...

trying to make a Master / Slave bot thing.

I want the bot to do actions only the Master says.

trigger:

^(.*?) says\, \"(.*?)\"$

Value:

if (%1) == @master then
Send ("%2")
else
Send ("scoff")
end

it does actions Anyone says...
not comparing %1 to the Master variable?

Thanks for any help...
K.
Australia Forum Administrator #1
It literally substitutes, so you are getting something like:


if (John) == Kurapiira then


That is comparing two variables. You need something like:


if "%1" == "@master" then

#2
Thanks for the help and quick response!

Now its bypassing the first part and just sending
"Scoffs"

I've tried quotes and brackets..is it spacing or something?...
checked regular expression, expand variables, keep evaluating...

dunno...kinda weird

K.
USA #3
What's the value of the messages variable? Make sure it's set.
Australia Forum Administrator #4
Template:what
Please help us by showing:
  • A copy of the trigger, alias or timer you were using (see Copying XML)
  • The error message, if any, that you got
#5

I did this...just to see if it's capturing right


Send ("' %1")
Send ("' %2")
if "%1" == "@master" then
Send ("%2")
else
Send ("scoff")
end

its capturing the name of the person
and its sending both the name and the command they say

ie: glinka says,"sit"

You say glinka
You say sit

just cant get the comparison ...
#6
<triggers>
<trigger
enabled="y"
expand_variables="y"
keep_evaluating="y"
match="^(.*?) says\, \&quot;(.*?)\&quot;$"
regexp="y"
send_to="12"
sequence="100"
>
<send>Send ("' %1")
Send ("' %2")
if "%1" == "@master" then
Send ("%2")
else
Send ("scoff")
end
</send>
</trigger>
</triggers>
#7
<variables>
<variable name="master">glinka</variable>
</variables>
#8
sorry to be so dense...the master variable wasn't capitalized..seems to work now

Thanks for the help folks !
USA #9
You can try string.lower() in your comparisons, too. :)

if string.lower("%1") == string.lower("@master") then