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

Gammon Forum

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

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Lua
. . -> [Subject]  New lines inside AddTimer()?
Home  |  Users  |  Search  |  FAQ
Register forum user name
Forgotten password?

New lines inside AddTimer()?

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Posted by Zolomon   (8 posts)  [Biography] bio
Date Mon 04 Jul 2011 06:55 PM (UTC)

When I try to execute the following lua code at http://pastebin.com/fNcnp7c7, the code I wish to pass forward to the script engine does not seem to get entered on separate lines - everything ends up in one line.

What am I doing wrong?

I just wish to add a timer, from within my script file, that executes something on the script engine.
[Go to top] top

Posted by Fiendish   USA  (1,775 posts)  [Biography] bio   Global Moderator
Date Reply #1 on Mon 04 Jul 2011 08:35 PM (UTC)
Use semicolons instead to indicate the end of lua statements.

[Go to top] top

Posted by Nick Gammon   Australia  (21,675 posts)  [Biography] bio   Forum Administrator
Date Reply #2 on Mon 04 Jul 2011 08:47 PM (UTC)

Amended on Mon 04 Jul 2011 08:49 PM (UTC) by Nick Gammon

Try using the square-bracket literals, eg.

"(You prepare to attack|moves aggressively towards you!|Noting the intentions)",
  isFighting = false
  AddTimer(\"timer_fighting\", 0, 0, 0.5 + math.random(3000)/10,
      timer_flag.Enabled + timer_flag.OneShot, \"\")",
      trigger_flag.Enabled, 0, 0, "", "", 12, 0)


You might be better off using AddXML:


But honestly, adding triggers on the fly that add timers on the fly tends to indicate you are not doing things the most efficient way.

You can just enable or disable existing triggers or timers (or groups of them) - you may find that much easier to work with.

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


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.


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 FutureQuest]