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
➜ General
➜ How to write trigger for text without newline?
How to write trigger for text without newline?
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Pages: 1 2
Posted by
| Tianxz
(30 posts) Bio
|
Date
| Sun 23 May 2010 12:36 AM (UTC) |
Message
| In the mud. The server ask me to choose 1 or 2. I want to input by robot. I use the code in PHP:
$world->Execute(2);
But It can't run correct. It need a 'enter'. How can I do it? | Top |
|
Posted by
| David Haley
USA (3,881 posts) Bio
|
Date
| Reply #1 on Sun 23 May 2010 12:45 AM (UTC) |
Message
| Is your question about how to send a newline to the world?
Try using "\n". |
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
http://david.the-haleys.org | Top |
|
Posted by
| Twisol
USA (2,257 posts) Bio
|
Date
| Reply #2 on Sun 23 May 2010 01:29 AM (UTC) |
Message
| You might want to try just using Send, because I don't think you're planning on having a 2 alias (are you?)
$world->Send("2"); |
'Soludra' on Achaea
Blog: http://jonathan.com/
GitHub: http://github.com/Twisol | Top |
|
Posted by
| Tianxz
(30 posts) Bio
|
Date
| Reply #3 on Sun 23 May 2010 02:13 AM (UTC) |
Message
| what is the different between the execute and send? | Top |
|
Posted by
| Twisol
USA (2,257 posts) Bio
|
Date
| Reply #4 on Sun 23 May 2010 02:16 AM (UTC) |
Message
| Execute checks aliases first, Send doesn't.
Though, neither of them needs a newline at the end, they both add one automatically. Perhaps you should try quoting the number, that is, "2" instead of 2. $world->Execute("2") should work fine. |
'Soludra' on Achaea
Blog: http://jonathan.com/
GitHub: http://github.com/Twisol | Top |
|
Posted by
| Tianxz
(30 posts) Bio
|
Date
| Reply #5 on Sun 23 May 2010 02:34 AM (UTC) |
Message
| Not only send("2") but also execute('2') can't work correctly. | Top |
|
Posted by
| Twisol
USA (2,257 posts) Bio
|
Date
| Reply #6 on Sun 23 May 2010 02:40 AM (UTC) |
Message
| Please make sure you're using Execute, not execute, and Send, not send. Other than that... well, please explain exactly what you mean by "can't work correctly". |
'Soludra' on Achaea
Blog: http://jonathan.com/
GitHub: http://github.com/Twisol | Top |
|
Posted by
| Tianxz
(30 posts) Bio
|
Date
| Reply #7 on Sun 23 May 2010 03:00 AM (UTC) Amended on Sun 23 May 2010 03:11 AM (UTC) by Tianxz
|
Message
| I use the Send and Execute to try it. But both can't work correctly.
The problem is
The mud ask me a Question A. Then the trigger will answer this question with 2. I use the command:/$world.Send('2');
Then the mud continue ask me another Question.
I trace it and find the trigger doesn't work before I input the "Enter". The trigger on question A only work after I input "enter". So I think the regular expression is good. It can't work after I input "enter" if it is wrong. I find when I input the "enter" just send the answer to question 2. But I don't know where is the problem.
Thank you. | Top |
|
Posted by
| Twisol
USA (2,257 posts) Bio
|
Date
| Reply #8 on Sun 23 May 2010 03:10 AM (UTC) |
Message
| What's the "Send to" box set to? It should be set to "Script", and make sure there's no slash on that line.
In this case, you could also set "Send to" to "World", and just have 2 in the send box. That would do the exact same thing. |
'Soludra' on Achaea
Blog: http://jonathan.com/
GitHub: http://github.com/Twisol | Top |
|
Posted by
| Tianxz
(30 posts) Bio
|
Date
| Reply #9 on Sun 23 May 2010 03:24 AM (UTC) |
Message
| Yes,I send to script.
There are four question and one by one.
First, Mud send the question A to me. I make a trigger on question A and send $world->Send('2'); to script. But The mud can't send the question B to me. It Send the question B and C to me after I input the "enter" in command window. It only ask me answer the question C.
If I send the $world->Send('2');$world->Send('1'); to the script. It still can't display next question. Only after I inut the "enter", it send the the question B,C and Dto me and ask me answer the question D.
If I don't input the "enter", it can't trigger the trigger and send answer to server even I choice send it to world immediate with 2.
| Top |
|
Posted by
| Tianxz
(30 posts) Bio
|
Date
| Reply #10 on Sun 23 May 2010 03:26 AM (UTC) |
Message
| Additional: The first trigger work on input the "enter". I don't why? | Top |
|
Posted by
| Tianxz
(30 posts) Bio
|
Date
| Reply #11 on Sun 23 May 2010 03:32 AM (UTC) |
Message
| Oh. I found the problem prehaps is the question a doesn't send the \n to mushclient. So the trigger can't be triggered. How can I do it? | Top |
|
Posted by
| Twisol
USA (2,257 posts) Bio
|
Date
| Reply #12 on Sun 23 May 2010 03:35 AM (UTC) |
Message
| Ahh, that explains a lot. Hmm... You might want to try enabling "Convert IAC EOR/GA to newline". It's in Game -> Configure -> Output, at the bottom of the list on the right.
If that doesn't work, there's not much more you can do. If all of these questions come in the same order every time, you can try triggering on a line right before the first question, and sending your answers all at once. It's a little hacky, but under the circumstances... |
'Soludra' on Achaea
Blog: http://jonathan.com/
GitHub: http://github.com/Twisol | Top |
|
Posted by
| David Haley
USA (3,881 posts) Bio
|
Date
| Reply #13 on Sun 23 May 2010 06:09 AM (UTC) |
Message
| Can't multiline triggers be convinced to process this? At worse, there's always looking at packets received... |
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
http://david.the-haleys.org | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #14 on Sun 23 May 2010 06:17 AM (UTC) |
Message
| |
- 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.
53,997 views.
This is page 1, subject is 2 pages long: 1 2
It is now over 60 days since the last post. This thread is closed.
Refresh page
top