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
➜ DoAfterSpecial, AddTimer and AppendtoNotepad
DoAfterSpecial, AddTimer and AppendtoNotepad
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Halig
Portugal (123 posts) Bio
|
Date
| Sun 08 Mar 2015 09:35 PM (UTC) |
Message
| Hi to all.
I have a problem with his alias, i know that it is something on the syntax, but can't figure out where.
<aliases>
<alias
match="-reward (.*)"
enabled="y"
group="Newbie"
regexp="y"
send_to="12"
sequence="100"
>
<send>player = "%1"
Send("at " ..player.. " reward " ..player.. " 1500 nice")
DoAfterSpecial (3, AddTimer("Reward", 2, 17, 0, AppendtoNotepad("Notepad", "You can Reward again."\n), timer_flag.Enabled + timer_flag.OneShot, ""), sendto.script)</send>
</alias>
</aliases>
What i want this to do is as follow:
- It sends to the world, the line:
at player reward player 1500 nice.
- When i execute this alias, i can only execute it again after 2 hours and 15 minutes.
- What i was trying to do, is when i can the alias, create a timer that after that time passes it sends to one of the notepads that i have the message "You can Reward again.".
Thank you. | Top |
|
Posted by
| Nick Gammon
Australia (23,140 posts) Bio
Forum Administrator |
Date
| Reply #1 on Sun 08 Mar 2015 11:04 PM (UTC) |
Message
| You need to quote the thing you want done.
For example:
DoAfterSpecial (3 , 'print ("hello")' , sendto.script )
Use single quotes around the thing to be done, so you can use double quotes inside it. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Halig
Portugal (123 posts) Bio
|
Date
| Reply #2 on Mon 09 Mar 2015 07:05 AM (UTC) Amended on Mon 09 Mar 2015 07:10 AM (UTC) by Halig
|
Message
| Hello Nick. Thank you for your answer. I've tryied that, and it send to world this:
'AppendtoNotepad("Notepad", "You can Reward again.")'
Meaning, it doesn't change the send to world to send to script.
<aliases>
<alias
match="-reward (.*)"
enabled="y"
group="Newbie"
regexp="y"
send_to="12"
sequence="100"
>
<send>name = "%1"
Send("at " ..name.. " reward " ..name.. " 1500 nice")
DoAfterSpecial (3, AddTimer("Reward", 2, 17, 0, 'AppendtoNotepad("Notepad", "You can Reward again.")', timer_flag.Enabled + timer_flag.OneShot, ""), sendto.script)
</send>
</alias>
</aliases>
Then i've tryed to change to this:
<aliases>
<alias
match="-reward (.*)"
enabled="y"
group="Newbie"
regexp="y"
send_to="12"
sequence="100"
>
<send>name = "%1"
Send("at " ..name.. " reward " ..name.. " 1500 nice")
DoAfterSpecial (8220, 'AppendtoNotepad("Notepad", "You can Reward again.")', 12)</send>
</alias>
</aliases>
And i got this error:
Error number: 0
Event: Run-time error
Description: [string "Timer: "]:1: attempt to call global 'AppendtoNotepad' (a nil value)
stack traceback:
[string "Timer: "]:1: in main chunk
Called by: Immediate execution
Thank you. | Top |
|
Posted by
| Nick Gammon
Australia (23,140 posts) Bio
Forum Administrator |
Date
| Reply #3 on Mon 09 Mar 2015 08:38 AM (UTC) Amended on Mon 09 Mar 2015 08:39 AM (UTC) by Nick Gammon
|
Message
| |
Posted by
| Halig
Portugal (123 posts) Bio
|
Date
| Reply #4 on Mon 09 Mar 2015 08:45 AM (UTC) |
Message
| Hi Nick. Thank you for your answer. I've changed that, and same thing.
AppendToNotepad("Notepad", "You can Reward again.")
It sends this to the world and not to the script. | Top |
|
Posted by
| Nick Gammon
Australia (23,140 posts) Bio
Forum Administrator |
Date
| Reply #5 on Mon 09 Mar 2015 10:27 AM (UTC) |
Message
| |
Posted by
| Halig
Portugal (123 posts) Bio
|
Date
| Reply #6 on Mon 09 Mar 2015 10:31 AM (UTC) |
Message
| <aliases>
<alias
match="-reward (.*)"
enabled="y"
group="Newbie"
regexp="y"
send_to="12"
sequence="100"
>
<send>name = "%1"
Send("at " ..name.. " reward " ..name.. " 1500 nice")
DoAfterSpecial (3, AddTimer("Reward", 2, 17, 0, 'AppendToNotepad("Notepad", "You can Reward again.")', timer_flag.Enabled + timer_flag.OneShot, ""), sendto.script)
</send>
</alias>
</aliases> | Top |
|
Posted by
| Nick Gammon
Australia (23,140 posts) Bio
Forum Administrator |
Date
| Reply #7 on Mon 09 Mar 2015 09:40 PM (UTC) |
Message
|
DoAfterSpecial (3, AddTimer( ...
You didn't quote it. Why are you doing DoAfterSpecial (which adds a timer) to then add a timer? |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Halig
Portugal (123 posts) Bio
|
Date
| Reply #8 on Mon 09 Mar 2015 09:46 PM (UTC) |
Message
| LOL. I know Nick. I thought about that myself earlier the day.
The thing is that i dont know how to add the timer, and sending it to script, because of the command AppendToNotepad.
That is my only problem in here. If i manage to get it recognizing that it is to send to script, eveything will work, i think. | Top |
|
Posted by
| Nick Gammon
Australia (23,140 posts) Bio
Forum Administrator |
Date
| Reply #9 on Mon 09 Mar 2015 11:03 PM (UTC) |
Message
| Let's clarify what you are doing. After 2 hours and 15 minutes from the alias firing you want a note in the notepad (appended) that says: "You can Reward again."
Is that it? |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Nick Gammon
Australia (23,140 posts) Bio
Forum Administrator |
Date
| Reply #10 on Mon 09 Mar 2015 11:09 PM (UTC) |
Message
| Something like this would do it:
<aliases>
<alias
match="-reward (.*)"
enabled="y"
group="Newbie"
regexp="y"
send_to="12"
sequence="100"
>
<send>name = "%1"
Send("at " ..name.. " reward " ..name.. " 1500 nice")
DoAfterSpecial (10, 'AppendToNotepad("Notepad", "You can Reward again.\\\\r\\\\n")', sendto.script)
</send>
</alias>
</aliases>
 |
For advice on how to copy the above, and paste it into MUSHclient, please see Pasting XML.
|
I set the time limit there to 10 seconds for testing. For 2:15:00 you work out what that is in seconds, eg.
Thus you would want:
DoAfterSpecial (8100, 'AppendToNotepad("Notepad", "You can Reward again.\\\\r\\\\n")', sendto.script)
Or to make it clearer:
DoAfterSpecial (2*60*60 + 15*60, 'AppendToNotepad("Notepad", "You can Reward again.\\\\r\\\\n")', sendto.script)
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Halig
Portugal (123 posts) Bio
|
Date
| Reply #11 on Tue 10 Mar 2015 06:51 AM (UTC) |
Message
| Thank you Nick for all your help. That works extremely well. Exactly what i wanted. Thank you again for your help on all my doubts. | 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.
31,315 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top