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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
NssOne
Newbie


Joined: 24 Sep 2009
Posts: 1

PostPosted: Fri Sep 25, 2009 7:26 pm   

A little newbie help devising some script/bot reponses
 
OK, I just recently started getting into Alter Aeon and so, I have a customized prompt that looks like this:
Code:
[HP=118/118 MA=210/210 MV=162/162 sleeping]


I have the left numbers being my curent state and the numbers on the right being my max. Now I'm looking for the best way I could possibly write out something like if X<=.35maxX (i.e. if my HP is less than 35%) to rest my character. And when finished, to execute the stand command.

Also, if anybody have any similar scripts for MUDs they would be willing to share to help give me ideas, that would be cool. It's been a while since I've done any real scripting like this, but this would help me out a lot. Thanks in advance.
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Fri Sep 25, 2009 8:34 pm   
 
There are two possible ways of doing this. The first is to write a single Prompt trigger for the pattern, which does all the work of checking values and executing rest or stand commands.

The other way is to break it into several triggers. The first would be a Prompt trigger for that pattern capturing all of the values. This trigger will store all the values in variables. As a bonus, you could have the trigger raise an onPrompt event, so that you can use that event other places. Next, have an Expression trigger whose pattern is "@currentX <= 0.35 * @maxX" which executes the rest command. Finally, you make another Expression trigger whose pattern is "@currentX == @maxX" which executes the stand command if you are resting. You may need a variable which records whether you are resting.

The advantage of doing breaking it into several triggers is that you can later write other triggers and onPrompt events that do things involving the prompt without having to write a new prompt trigger. A single prompt trigger and several onPrompt events will be faster than several prompt triggers, because the prompt will only have to be parsed once. If you are sure you won't need any further prompt triggers, a single trigger may be the easiest to maintain.

I am afraid I don't have time at the moment to give actual examples of how to write these triggers. If you need help writing them, I will try to help again later.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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