Basic Anti-illusion code design

by Nezha

Back to Mechanic's Corner.

Nezha2008-01-22 12:22:05
I'm having a hard time putting some anti-illusion lines in my system.. Particularly in the case of salves and purgatives..

Herbs are easy as the deafliction line does not come out even if i eat a herb.. for example:

True affliction
QUOTE
suffering from a severed artery in the left arm
1111h, 1111m, 1111e, 10p, 11111en, 11111w exk-

You eat a yarrow sprig.
The flow of blood recedes as your left arm
1111h, 1111m, 1111e, 10p, 11111en, 11111w exk-

Illusioned
QUOTE
suffering from a severed artery in the left arm
1111h, 1111m, 1111e, 10p, 11111en, 11111w exk-

You eat a yarrow sprig. <-- I ate the herb, but nothing happened. so trigger the eating bit and treat as illusion
1111h, 1111m, 1111e, 10p, 11111en, 11111w exk-
--0--0--

Now the problem i have as stated is with salves, mending, and health.. as they all give the same line
QUOTE
You take out some salve and quickly rub it on your arms.
The salve has no discernable effect. <-- I trigger this, but cant decide if what was rubbed was health or mending or something.
1111h, 1111m, 1111e, 10p, 11111en, 11111w exk-



How do you do it? How does one determine what is what? although, i think relying on a variable would be fine.. but im theorizing that it is entirely possible for the health and salve to be applied successively thus confusing the system.

or what is a different approach? any pointers will be greatly appreciated..

thanks
Unknown2008-01-22 12:28:25
A. You can ignore the "suffering from a severed artery in the left arm" illusion extremely easy by putting all your diagnose triggers in a class folder (or group) and only enabling the triggers when you actually send the diagnose command. Disabling it on a timer can be a good thing, too, just as an added failsafe.

B. When you apply health or some salve, you need to track that in a variable and use failsafes to reset your afflictions and a separate set of failsafes to reset the tracking variables. I recommend not applying more than one thing at the same time, just as you shouldn't sip more than one thing or smoke more than one thing at the same time, because you'll lose track of the action and might reset the wrong things.

C. Make sure you construct your trigger patterns carefully, so as to match on only exactly what you should. The most important thing is to anchor them at the beginning with ^ and at the end with $ (unless it's a trigger that cannot be properly anchored because of word wrapping).
Nezha2008-01-22 14:38:58
The trigger pattern is not the issue nor the illusion i provided therein actually.. they are just examples i cobbled together..

but this is a good idea:

QUOTE
When you apply health or some salve, you need to track that in a variable


I'll try this..

Thanks
Forren2008-01-22 14:50:28
Contact me in game, I have some code for you.
Unknown2008-01-22 14:51:04
Yeah, the way I do it is that I have a variable for every time that I actually try to do something, and another variable for when I actually do it. Then based on the lines that come out the variables are set accordingly.
Unknown2008-01-22 16:19:27
QUOTE(nezha @ Jan 22 2008, 09:38 AM) 479413
The trigger pattern is not the issue nor the illusion i provided therein actually.. they are just examples i cobbled together..


The idea of enabling groups of triggers on certain events is still a good general anti-illusion/failsafe practice, even if your provided examples are quickly cobbled together. wink.gif