Cmud trigger oddity

by Moiraine

Back to Mechanic's Corner.

Moiraine2008-07-10 03:14:27
I am in the beginning stages of writing my first system, from scratch, and I'm seeing something I don't know how to explain. Hopefully the mighty forums can shed some light on this.

(System is Cmud, btw)

First I wrote a trigger to capture prompt information, displayed below.

QUOTE
&%d{CurrentHealth}h, &%d{CurrentMana}m, &%d{CurrentEgo}e, &%d{CurrentPower}p, &%d{CurrentEndurance}en, &%d{CurrentWillpower}w &{PromptStatus}-$
This works fine. The variables named update instantly and perfectly, without any problems I can detect. The oddity starts when I added an action to this trigger.

QUOTE
#if (@RegSip=0 and @CurrentEgo<2400) {drink bromides;RegSip=1} {}


This was just a quick write-up to get myself sipping bromides while I empowered angels in Celest, so it's very simple..but I eventually noticed that while it does work, while I do sip bromides when my ego drops under 2400, it doesn't send the command immediately upon the conditions proving true. Nor at any time I can predict afterwards. It will sip, but somewhere between two and six seconds after the IF statement proves true.

So...why might this be happening?
Unknown2008-07-10 03:20:56
Make sure your trigger has Prompt checked, Newline unchecked, remove the $, and if you added the linebreak in the game, remove it.

Or, you can do the opposite instead. Either way, you need to ensure that your prompt trigger fires correctly.
Moiraine2008-07-10 06:37:44
Don't suppose you'd want to explain what exactly doing these various things accomplishes in this situation? Just trying to understand more about the system.

Also..opposite? Of what?
Unknown2008-07-10 06:43:37
First of all I would suggest looking at Catarin's System for an example CMUD system. I can understand wanting to build your own for fun, but even if you choose to do that having an example of what already works will save you a ton of time.

QUOTE(Moiraine @ Jul 9 2008, 11:37 PM) 530886
Don't suppose you'd want to explain what exactly doing these various things accomplishes in this situation? Just trying to understand more about the system.



QUOTE(Zarquan @ Jul 9 2008, 08:20 PM) 530788
Make sure your trigger has Prompt checked, Newline unchecked, remove the $, and if you added the linebreak in the game, remove it.


The prompt check means the trigger will fire when it sees the prompt, not just on a newline. The prompt does not actually have a newline character after it so you need to ensure your trigger is set to fire on the prompt not a newline. This is also why you should remove the $ from your prompt trigger, as it might not always fire and the pattern matching of the trigger is enough to ensure you will only be catching the prompt anyhow.

A better way to do this though (and you can see an example in Catarin's system) is to use something called ATCP. This data is sent behind the scenes so to speak and it is a cleaner way to collect information like current stats and max stats. You can use the prompt if you wish, but I think ATCP is a cleaner method.

Hope that helped.
Moiraine2008-07-10 08:14:02
Mucho gracias!