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

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Lua
. . -> [Subject]  Can you help me figure this error out?

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?
(New message)
Subject: Can you help me figure this error out?
Name:
Your forum user name.
Register forum user name
Password:
Your forum password.
Forgotten password?
Message:
Message to be posted (in English, please)
Maximum of 6000 characters. Text only please, no HTML.
Forum codes:
Check this if your message uses 'forum codes' or templates (auto-detected for new posts).
Forum codes Templates

Save this message ...


Subject review (reverse sequence)

Posted by Twisol   USA  (2,229 posts)  [Biography] bio
Date Fri 17 Dec 2010 12:16 AM (UTC)  quote  ]
Message
The trick is that it's not anything until the script runs. :)

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

Posted by Rivius   (93 posts)  [Biography] bio
Date Thu 16 Dec 2010 11:59 PM (UTC)  quote  ]
Message
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.
[Go to top] top

Posted by Twisol   USA  (2,229 posts)  [Biography] bio
Date Thu 16 Dec 2010 11:45 PM (UTC)  quote  ]

Amended on Thu 16 Dec 2010 11:46 PM (UTC) by Twisol

Message
"%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.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

Posted by Rivius   (93 posts)  [Biography] bio
Date Thu 16 Dec 2010 11:28 PM (UTC)  quote  ]
Message

<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'
[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.


1,179 views.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]