Can you help me figure this error out?

Posted by Rivius on Thu 16 Dec 2010 11:28 PM — 4 posts, 19,543 views.

#0

<triggers>
  <trigger
   enabled="y"
   group="Test"
   keep_evaluating="y"
   match="^You step up to (an energy collector|a battle turret)\, locking yourself into the module and linking your mind to the controls of the ship\. After a moment\, you begin to sense your command of the module in your own brain\.$"
   name="Link_up"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>

aethership_module= %1

if aethership_module=="an energy collector" then
	if (GetVariable("treant_auto_Siphoning")=="true") then 
	--If siphoning is already on, it'll let us know.
	Execute("AUTO Siphoning ON")
	else
	Execute("AUTO Siphoning OFF")
	end
elseif %1=="a battle turret" then
	EnableTriggerGroup("Aethership Gunning",true)
	SetVariable("treant_auto_Siphoning", "false")
else SetVariable("treant_auto_Siphoning", "false")
end
</send>
  </trigger>
</triggers>

I'm confused! And I just can't see what's wrong. Here;s the error message:

Compile error
World: Treant
Immediate execution
[string "Trigger: Link_up"]:1: '=' expected near 'collector'
USA #1
"%1", not %1. Quotes are important. %1 isn't part of Lua itself: MUSHclient pre-processes the contents of the Send box each time the trigger fires, replacing %1 with the associated data. So if %1 is an energy collector, your code will look like this before Lua can run it:
aethership_module= an energy collector

Lua has no idea what this is supposed to mean. But if you use "%1", it looks like:
aethership_module= "an energy collector"

And then Lua knows that "an energy collector" contains data.

EDIT: Same goes for every other place you're using %1.
Amended on Thu 16 Dec 2010 11:46 PM by Twisol
#2
Oh! Such an simple stupid mistake. Thanks a bunch, I was under the impression that it didn't need to be quoted since it was already a string.
USA #3
The trick is that it's not anything until the script runs. :)