Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ Lua
➜ New lines inside AddTimer()?
New lines inside AddTimer()?
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Zolomon
(8 posts) Bio
|
Date
| Mon 04 Jul 2011 06:55 PM (UTC) |
Message
| Hello!
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. | Top |
|
Posted by
| Fiendish
USA (2,535 posts) Bio
Global Moderator |
Date
| Reply #1 on Mon 04 Jul 2011 08:35 PM (UTC) |
Message
| Use semicolons instead to indicate the end of lua statements. |
https://github.com/fiendish/aardwolfclientpackage | Top |
|
Posted by
| Nick Gammon
Australia (23,140 posts) 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
|
Message
| Try using the square-bracket literals, eg.
AddTriggerEx(
"fighting",
"(You prepare to attack|moves aggressively towards you!|Noting the intentions)",
[[
isFighting = false
print(isFighting)
AddTimer(\"timer_fighting\", 0, 0, 0.5 + math.random(3000)/10,
\"print(\"FIGHTING!\")\",
timer_flag.Enabled + timer_flag.OneShot, \"\")",
]]
trigger_flag.Enabled, 0, 0, "", "", 12, 0)
(Untested)
You might be better off using AddXML:
http://www.gammon.com.au/forum/?id=7123
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 | 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.
11,958 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top