Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Grish
Beginner


Joined: 26 Jan 2003
Posts: 22

PostPosted: Sun Apr 27, 2003 6:35 am   

Capturing the next message from the MUD
 
I've been searching in the help files and in the forums but I couldn't find anything. I hope someone can help me out.

I'm making a script for a friend who is using Zmud 6.16. I want to know if after a certain message, the next message that comes from the mud is my prompt and a blank line or a certian message. I know this might be confusing but here's an example:

If the message I trigger is: You eat a piece of kelp.

I want to know what the next message the MUD will send me; a blank line/no message or a confirmation that my eating of kelp has actually cured my affliction.

I hope that clears things. If more information is needed let me know. Thanks in advance for the help!
Reply with quote
Grish
Beginner


Joined: 26 Jan 2003
Posts: 22

PostPosted: Sun Apr 27, 2003 6:37 am   
 
I apologize for the redundant posts. I have no idea how that happened. I think there is something wrong with my browser.
Reply with quote
Dumas
Enchanter


Joined: 11 Feb 2003
Posts: 511
Location: USA

PostPosted: Sun Apr 27, 2003 7:52 am   
 
I would think that you would have to test it on the MUD. I know in Achaea, if you eat the herb and were afflicted, the next line says something related to the curing of the affliction. If you were not afflicted at the time, then the next line is a prompt. So it is best just to test things out.
Reply with quote
Grish
Beginner


Joined: 26 Jan 2003
Posts: 22

PostPosted: Sun Apr 27, 2003 1:02 pm   
 
Thanks for the reply Dumas!

Actually that is what I want to do. See if there was a message or if all the MUD returned was the prompt. Is there a method or function that I can use to capture the next line from the mud?
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sun Apr 27, 2003 6:36 pm   
 
Tell your friend to upgrade to the latest PUBLIC version (currently 6.40). This will allow you to use multi-state triggers.

#TR {You eat a piece of kelp.}
#COND {(*)} {#IF ("%1" <> "Your affliction is cured") {#VAR eatmorekelp 1} {#VAR eatmorekelp 0}} {Within|Param=1}
#COND {You may eat another herb} {#IF (@eatmorekelp) {eat kelp}}

NOTE: Will NOT work in version 6.16

LightBulb
Advanced Member
Reply with quote
Grish
Beginner


Joined: 26 Jan 2003
Posts: 22

PostPosted: Mon Apr 28, 2003 1:21 pm   
 
Thanks Lightbulb that helped and I learned something new! I tried it out and it gave me more or less what I wanted. I have a few questions though:

Since kelp cures alot of different afflictions, is it better to match the parameter to a blank line/message. I figured that would be better than having a condition for each cured affliciton message. Or maybe I'm wrong.

Also other people also want a piece of the script I'm working on but they are also using 6.16. Is there another approach I can use to accommodate the others? Heh at least it works for me!

Thanks again for all the help, I really appreciate it!
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Mon Apr 28, 2003 1:56 pm   
 
Healing scripts for Achaea have been done frequently. Use the Search link, with keywords such as "achaea", "cures", "curing", "healing", "afflictions", "herbs", "outb", etc. It's best to limit the search to one forum at a time (General or Finished). Most of the posts you will find were written while 6.16 was the public version and should work with it.

LightBulb
Advanced Member
Reply with quote
Grish
Beginner


Joined: 26 Jan 2003
Posts: 22

PostPosted: Tue Apr 29, 2003 1:39 pm   
 
Well I've done a thorough search and came up with nothing I could really use.

I have no problems with healing. I've set up already a fully automatic system that will properly queue and pioritize afflictions and apply the proper cures with consideration of the balance issues (herb balance, salve balance, etc.)

But the problem is illusions. There is a skill that allows players to casts illusions and think you are afflicted; by displaying the affliction message and triggering the system. Currently what the system does is check every message if it's an illusions or not by performing some checks. But some illusions are well made and well timed and the system will accept these afflictions in its queue. This limitation is alright at the moment. I will try to address this in the future when I see a pattern with illusions that I can take advantage of.

Now the system removes afflictions from the queue when it sees the proper healing message for that affliction. The problem with illusions is that there will be no cured affliction message when I apply the appropriate cure. So what happens is the affliction stays in the queue and the system keeps trying to cure the affliction.

Now here's one thing I noticed: If I eat an herb for a certain affliction and it turns out that it was an illusion, after eating the herb I get no message/a blank line with my prompt. So what I attend to do is everytime I eat an herb I will check if I just get a blank line from the MUD. If so I will call this method called OhNoIllusion which properly removes the fake affliction from the system's queue.

So my only problem is getting the OhNoIllusion method to run everytime I eat an herb and nothing happens.

Hope someone can help me out!

Once again thanks for the people that helped. I greatly appreciate this!
Reply with quote
Grish
Beginner


Joined: 26 Jan 2003
Posts: 22

PostPosted: Wed Apr 30, 2003 11:07 am   
 
Well I made another attempt (a pathetic one as you will see) to solve my problem. I tried using the #WAIT command with a trigger thinking that since it waits for the next line from the MUD, I could use the %line to get the last message from the MUD which would be the next line due to the #WAIT command. Hope I wasn't confusing with that explanation. To my dismay it didn't really work, and maybe it's because I haven't fully understood the concept of #WAIT.

So scratch that idea, is there any other method I can use to trigger a method when a blank line appears after a certain text?

Hope someone can help me on this. Thanks for the help and regards!
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Wed Apr 30, 2003 4:07 pm   
 
quote:
Now the system removes afflictions from the queue when it sees the proper healing message for that affliction. The problem with illusions is that there will be no cured affliction message when I apply the appropriate cure. So what happens is the affliction stays in the queue and the system keeps trying to cure the affliction.

It appears there are two possibilities:
1. It was a real affliction, you ate the kelp, you got the cure
2. It was an illusion, you ate the kelp, nothing happened
Either way, that affliction is gone.

Change your triggers to remove the affliction when you eat the kelp, regardless of whether you receive a healing message or not.

Of course, there might be a third possibility that you didn't mention:
3. It was a real affliction, you ate the kelp, you DIDN'T get the cure, but got some message that indicates it failed
Make a new trigger, patterned after the failure message, to put the affliction back in the queue.

LightBulb
Advanced Member
Reply with quote
Tarn
GURU


Joined: 10 Oct 2000
Posts: 873
Location: USA

PostPosted: Wed Apr 30, 2003 6:02 pm   
 
quote:

Since kelp cures alot of different afflictions, is it better to match the parameter to a blank line/message. I figured that would be better than having a condition for each cured affliciton message. Or maybe I'm wrong.



First: For 6.16, aside from the obvious advice to use the latest public version , you could adapt Lightbulb's solution to use three separate triggers that turn each other on and off. The eating kelp line turns on the (two or more) possible result triggers, and any result turns off all result triggers after updating the healing queue. The trigger text/response would be the same as Lightbulb describes. Group everything in a class to make it easy.

Also:

Kelp cures more than one affliction. You probably want to trigger on each possible cure rather that just checking to see if anything was cured.

I know about the curing order, but suppose that you think you have affliction A and affliction B, with affliction A being higher in the curing order (gets cured first by kelp).

When you eat kelp, if you see that affliction B was cured, you immediately know that A was an illusion and you can remove that too.

-Tarn
Reply with quote
Grish
Beginner


Joined: 26 Jan 2003
Posts: 22

PostPosted: Thu May 01, 2003 4:29 am   
 
Hi,

Thanks for the reply Lightbulub and Tarn!

What I first did for the system was not rely on the curing message and let the system figure out what affliction should be removed from the queue. This countered the illusion problem. Even if I was afflicted with 2 afflicitons addressed by kelp it would remove the appropriate one based on a curing order.

But recently I found out there is no curing order (Confirmed too from higher ranked guildmates and secretaries). If I'm afflicted with 2 afflictions addressed by kelp, any of the one can be cured whenever I eat kelp. It's random. So that threw my whole approach down the drain and I resorted to use the curing message to remove the affliction from the queue.

I watch for all the curing message. So if I eat kelp and I'm afflicted with 2 afflictions addressed by kelp I remove the proper affliction from the queue. No more problem with the random curing for stacked afflictions. But without seeing the curing message, the system will never remove a fake affliction from an illusion. The only pattern for an illusion is when I eat something and nothing happens I know it's an illusion and can remove the affliction from the queue.

So my to sum it all up:
There is no curing order. If I eat kelp and I'm afflictied with 2 affliction addressed by kelp, any of the 2 can go. It's random
(I will test this again later and let you know). This throws away the curing order approach for removing affliction from the queue.

If we are removing afflictions based on their curing message, we solve the random curing of stacked afflictions, but we are susceptible to illusions since there will be no curing message. If you eat herbs for fake afflctions nothing will happen.

If more information is needed please let me know. Sorry for my presistance and if this thread is getting too long. I know I keep saying it but I just want to let those who contributed know that I greatly appreciate this. Thanks to all!
Reply with quote
Dumas
Enchanter


Joined: 11 Feb 2003
Posts: 511
Location: USA

PostPosted: Thu May 01, 2003 4:39 am   
 
I'd go with Lightbulb's suggestion. You should change the triggers so that no matter what message is given(or not given) it removes from the queue.
Reply with quote
Grish
Beginner


Joined: 26 Jan 2003
Posts: 22

PostPosted: Thu May 01, 2003 6:05 am   
 
Hi Dumas thanks for the suggestion.

The problem is that the system does priority curing. If I just remove "kelp afflictions" rather than the afflictions themselves I won't get to keep the priority healing feature of the system. The system cures by affliction. If you are afflicted by 2 afflictions the one with higher priority will be cured first. Some afflictions have the same cure but diffrent priorities. That's why I need to know what afflictions are cured. If I just removed the afflictions then I won't be able to keep track with what I'm afflicted and what affliction I should prioritize.

That's why I'm in such a rut. Without illusions the system is perfect. It cures by priority and automatically cures all the afflictions you have. Now all I have to do is take advantage of the fact that when you eat/apply a cure and nothing happens then you know it was an illusion.

I will though try what Lightbulb has suggested, maybe there's another approach. But if I manage to properly run the OhNoIlllusion method when nothing happens whn I apply a cure then I'm solved.

Thaks again!
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Thu May 01, 2003 5:10 pm   
 
I try to avoid answering Achaea questions. I'm well aware that it has a complex system of afflictions and cures, and that developing a good autohealing system requires an indepth knowledge of them that can only be obtained through frequent play. That's why I referred you to the Search link rather than try to find solutions myself.

To find a non-matching line with a multi-state trigger:
#TR {You eat a piece of kelp}
#COND {(*)} {#IF (%ismember( {%1}, @KelpCureMessages)) {} {OhNoIllusion}} {Within|Param=1}
I'm not sure if that will work with a blank line, but it should catch any other non-matching ones.

For 6.16:
#TR {You eat a piece of kelp.} {#T+ KelpIllusions}
#TR "KelpIllusions" {(*)} {#IF ("%1" = "You eat a piece of kelp.") {} {#T- KelpIllusions;#IF (%ismember( {%1}, @KelpCureMessages)) {} {OhNoIllusion}}}

LightBulb
Advanced Member
Reply with quote
Grish
Beginner


Joined: 26 Jan 2003
Posts: 22

PostPosted: Sun May 04, 2003 6:34 am   
 
Hi,

Sorry for the late reply, I wasn't able to check the forums for the past few days.

Well I tried Lightbulb's approach for 6.40 on my own system with one affliction, and it worked fine! Thanks Lightbulb!

I tried Lightbulb's approach for version 6.16 on my friend's system and it also worked out fine. I only tested it on one affliction, but it should work for the rest. I tested by first trying to see if it will still cure true afflictions, then proceeded to strictly illusions, then finally to a mix of illusions and afflictions. So far it's all good. I plan to make the changes to all afflictions and give it a thorough test in the arena next week.

I tried doing something similar with what Lightbulb suggested for 6.16, using a trigger to fly on a blank message, but i was pattern matching on blank lines. So my if statement looked something like this:

with parameter 4 as the input line (the other 3 were used for my prompt)

#IF %4 = "" {OhNoIllusion}

but that didn't seem to work. Is it really possible to do pattern matching with blank lines? I'm guessing I'm doing it wrong and there's a proper way of doing it.

But either way I tried Lightbulb's approach with the %ismember and I prefer that approach. It seems alot safer to check on messages rather than triggering on the blank line. I don't think there will be any problems now, but I'll post if anything arises.

Thank you very much Lightbulb and Dumas for your input and help. I greatly appreciate it! Thank you for taking the time to help me with addressing this limitation with my system. I tried looking for the forums for posts similar to this (regarding countering illusions) but came up with nothing that would really help. I hope this would help others in future!
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net