help with an alias/trigger

Posted by Perrin on Sun 03 Feb 2008 03:51 AM — 6 posts, 25,304 views.

USA #0
any help you could give would be helpful i cant seem to get this to work i keep getting this error
____________________________________________________________
Execution of line 2 column 113
Immediate execution
Expected end of statement
____________________________________________________________
<aliases>
<alias
match="^(add trigger(s|)|addtrigger(s|))$"
enabled="y"
regexp="y"
send_to="12"
sequence="100"
>
<send>world.addtrigger ""&amp;getvariable ("asv1")&amp;"3", ""&amp;getvariable ("asv4")&amp;"", "world.enabletrigger \""&amp;getvariable ("asv1")&amp;"1", 1", 1, -1, 0, " ", " ", 12, 100

world.addtrigger ""&amp;getvariable ("asv1")&amp;"2", ""&amp;getvariable ("asv3")&amp;"", "world.enabletrigger ""&amp;getvariable ("asv1")&amp;"1", 0 ", 1, -1, 0, " ", " " , 12, 100

world.addtrigger ""&amp;getvariable ("asv1")&amp;"1", "^You flex your muscles proudly\!$", "c "&amp;getvariable ("asv2")&amp;"", 33, -1, 0, "", "", 12, 100</send>
</alias>
</aliases>
Amended on Sun 03 Feb 2008 05:48 AM by Perrin
Australia Forum Administrator #1
Expanding out the XML, your script reads:


world.addtrigger ""&getvariable ("asv1")&"3", ""&getvariable ("asv4")&"", "world.enabletrigger \""&getvariable ("asv1")&"1", 1", 1, -1, 0, " ", " ", 12, 100

world.addtrigger ""&getvariable ("asv1")&"2", ""&getvariable ("asv3")&"", "world.enabletrigger ""&getvariable ("asv1")&"1", 0 ", 1, -1, 0, " ", " " , 12, 100

world.addtrigger ""&getvariable ("asv1")&"1", "^You flex your muscles proudly\!$", "c "&getvariable ("asv2")&"", 33, -1, 0, "", "", 12, 100


I don't understand what you are trying to do here. For example:


""&getvariable ("asv4")&""


This is concatenating an empty string with the contents of variable asv4 and then adding another empty string to the end. Why are you doing this? Why not just say:


getvariable ("asv4")


If you look at the help for AddTrigger:

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

The various arguments are:

  • TriggerName
  • MatchText
  • ResponseText
  • Flags
  • Colour
  • Wildcard
  • SoundFileName
  • ScriptName


I don't see what you are supplying is supposed to do - there seems to be too many quotes there or something.

As far as I can make out, you are doing:

  • TriggerName --> ""&getvariable ("asv1")&"3"
  • MatchText --> ""&getvariable ("asv4")&""
  • ResponseText --> "world.enabletrigger \""&getvariable ("asv1")&"1", 1"
  • Flags --> 1
  • Colour --> -1
  • Wildcard --> 0
  • SoundFileName --> " "
  • ScriptName --> " "


Then you have 2 extra arguments:


12, 100


Did you mean to use AddTriggerEx?

http://www.gammon.com.au/scripts/doc.php?function=AddTriggerEx
Amended on Sun 03 Feb 2008 08:56 AM by Nick Gammon
Australia Forum Administrator #2
You are not consistent with your use of world.something. The "world." part is not required, so either use it everywhere, or nowhere. Using it partly is confusing.

For example you use world.addtrigger but not world.getvariable .
USA #3
yes i did mean addtriggerex i already changed it in my alias but didn't edit it here
and i was under the impression the " " were needed

what im tring to do is my first alias capture var1 var2
and send commands causing triggers to capture var3 var4

and this alias to create a set of triggers out of them
USA #4
ok my only question is this why does this function
addtriggerex ""&amp;getvariable ("asv1")&amp;"3", ""&amp;getvariable ("asv4")&amp;"", "enabletrigger &amp;quot;"&amp;getvariable("asv")&amp;"1&amp;quot;, 1", 1, -1, 0, "", "", 12, 100

create this trigger?
<triggers>
<trigger
enabled="y"
match="The gold in your pocket disappears."
name="detg3"
send_to="12"
sequence="100"
variable="detg3"
>
<send>enabletrigger &amp;quot;1&amp;quot;, 1</send>
</trigger>
</triggers>
____________________________________________________________
and now for some reason my scripting is disabled and in can't turn it back on i keep getting the same error msg
Script error
World: aardwolf
Execution of line 1 column 1
Immediate execution
Expected statement
Line in error:
<?xml version="1.0" encoding="UTF-8"?>
Amended on Sun 03 Feb 2008 10:01 AM by Perrin
USA #5
nevermind i feel like an idiot i was calling "asv" as my variable instead of "asv1"