Okay, CMUD gots me stumped.

by Unknown

Back to Mechanic's Corner.

Unknown2009-04-03 20:19:24
Okay the essentials that I have is an alias, triggers, prompt and an event in CMUD

Alias:
siphealth
sip health
sipBalance = 0.5

Triggers:
^The potion heals and soothes you\\.$
#if (@sipBalance = 0.5) {sipBalance = 0}
#echo Sip balance used!

^You may drink another health, mana, or bromide potion\\.$
sipBalance = 1
#echo Sip balance returned!

^Your mind feels stronger and more alert\\.$
#if (@sipBalance = 0.5) {sipBalance = 0}
#echo Sip balance used!

Atcp Prompts:
NL:(\\d+)/100 H:(\\d+)/(\\d+) M:(\\d+)/(\\d+) E:(\\d+)/(\\d+) P:(\\d+)/10
oldHealth = @health
health = %2
#if (%3 <> @maxHealth) {
maxHealth = %3
healthSipLimit = (%3-%round( (%3*0.15+100)*1.2*1.3))
healthSparkleberryLimit = %round( %3-(%3*0.1)-(%3*0.15+100)*1.2)
}
oldMana = @mana
mana = %4
#if (%5 <> @maxMana) {
maxMana = %5
manaSipLimit = (%5-%round( (%5*0.15+100)*1.2*1.3))
manaSparkleberryLimit = %round( %5-(%5*0.1)-(%5*0.15+100)*1.2)
}
oldEgo = @ego
ego = %6
maxEgo = %7
#if (%7 <> @maxEgo) {
maxEgo = %5
egoSipLimit = (%7-%round( (%7*0.15+100)*1.2*1.3))
egoSparkleberryLimit = %round( %7-(%7*0.1)-(%7*0.15+100)*1.2)
}
power = %8
levelPercent = %1

normal prompt:
^(\\d+)h, (\\d+)m, (\\d+)e, (\\d+)p(?:, (\\d+)mo)? (*)-$
#if (%6 <> @promptString) {
#if (%pos( "e", %6) > 0) {balMind = 1} {balMind = 0}
#if (%pos( "l", %6) > 0) {balBodyLeftArm = 1} {balBodyLeftArm = 0}
#if (%pos( "r", %6) > 0) {balBodyRightArm = 1} {balBodyRightArm = 0}
#if (%pos( "x", %6) > 0) {balBody = 1} {balBody = 0}
promptString = %6
}
#if (%null( %5)) {momentum = 0} {momentum = %5}
#raiseevent onPrompt

finally, event:
onPrompt
IF (@sipBalance) {#IF (@health < @healthSipLimit) {
siphealth
sipBalance = 0
}}

I checked and tested like a mad cat, there were no errors in the scripting, but the damn thing doesnt fire! Halp? The sipBalance Variable is also there. All the needed Variables are also recorded. :/ I'm stuck here.
Vathael2009-04-03 20:24:22
Is your prompt trigger working? Have regex enabled since that's apparently what you're using?
Unknown2009-04-03 20:32:53
Aye, its all regex checked.
Unknown2009-04-04 01:21:43
if you copy and paste the prompt into the testing part of the prompt trigger, does it work?
Unknown2009-04-04 02:23:58
The prompt matches. I've isolated the problem to the normal prompt trigger. Since I dont know why it isn't working and that's because why OnPrompt wouldnt fire and it wouldn't sip, but I dont know how to fix it cause it seem to have no errors in it at all.
Vathael2009-04-04 02:26:15
Hm, looking over the code in onPrompt, the first if statement is missing the #. Not sure if that's just a typo here and it's correct in your system or what.
Unknown2009-04-04 04:10:19
Do you have Fire on Prompt checked, instead of Fire on new line?

Edit: Helps to fully review the code before I post sad.gif
Unknown2009-04-04 12:00:14
Alright, I've done all possible checks that it will fire. No errors at all. Everything is fine. I sent the codes to a friend of mine and it DID FIRE. However for mine, the thing didn't even do anything automated at all. Why? I need someone to tell me that, please. Its making my head hurt. sleep.gif
Unknown2009-04-04 12:07:14
My response is simple but not helpful: that's CMUD for you! I fought with that thing for over a year and just gave up because it wouldn't do what I wanted it to do.
Unknown2009-04-04 12:10:33
I'll put in XML, to make it easier to read.

Event Trigger

CODE

  #if (@sipBalance) {#IF (@health < @healthSipLimit) {
    siphealth
    sipBalance = 0
    }}
    #echo test



NormalPrompt
CODE

  ^(\\d+)h, (\\d+)m, (\\d+)e, (\\d+)p(?:, (\\d+)mo)? (*)-$
  


Its either these two that are making my brain hurt or there is something wrong with my CMUD client. I'm on a Vista Enterprise OS, a laptop. Dont ask me why, my tertiary school demands it. Helps?
Esano2009-04-04 12:16:59

^(\\d+)h, (\\d+)m, (\\d+)e, (\\d+)p(?:, (\\d+)mo)? (*)-$

it goes kdb not bdk, for one thing. Not sure if that's all of it, though.
Unknown2009-04-04 12:30:13
The pattern matches what my prompt looks like. So I dont think that its my prompt problem, but I could not be seeing something amiss here. :/

Okay, I tried executing the script and it did echo the test that I put in the Event OnPrompt, but only when I executed the script. Now, what have I done wrong?
Unknown2009-04-04 14:24:17
CONFIG PROMPT ADD LINEBREAK?
Unknown2009-04-04 15:03:19
Did the Config prompt add linebreak.

Alright, I tested it again. The prompt with the #raiseevent did not fire automatically. When I reached below my health limit, it did nothing until I went to manually execute the script. So now I can conclude that the problem is that my prompt is not recording or something is a mistake there. So now, I still cant see what's wrong with it, so I dont know how to fix it cause, it looks all good. :/
Unknown2009-04-04 15:38:58
Okay. Fixed. biggrin.gif lol...
Vathael2009-04-04 15:43:56
If you did CONFIG PROMPT ADD LINEBREAK and you have a prompt trigger firing off the prompt line.. well that's not going to work.
Unknown2009-04-04 17:03:10
And, if you want it to fire on a prompt without a linebreak, you need to remove the $ at the end. That's what clued me in.
Unknown2009-04-05 05:13:59
Its alright now, i just had to remove the linebreak in config. And it runs fine even with the $ at the end. I thinks its because I forgot that I did that linebreak when I was using Treant.

It's all well's now. So I've done prompt tracking and an autosipper. What's going to be next? Afflictions tracking? I also realized that Lusternia's prompt 'p' means functionally prone for like entangled, prone, asleep etc etc. I was wondering how do I track it. I got an idea using the function and for the prone making trigger lines to like have a variable or a $local variable.

Maybe in the function..

#if (@writhe) {writhe}
#if (@prone) {stand} ?

Okay, I need suggestions cause I cant quite get what my head is thinking about. I've just gotten a little into coding in CMUD, I did some coding in ZMUD before but it was too much work. CMUD makes it a little more easier with all the new features and stuffs. smile.gif

Some guidance please!
Unknown2009-04-18 09:25:06
Alright, now I have a new question. The Stand and Writhe it's working for me already but now I want my @target variable to be a red or certain brighter color so that I can easily read it on the screen.

e.g
Zmud was:
Pattern: @target
Value: #CO red

Does anyone know how to highlight a variable in CMUD?

Thanks.
Unknown2009-04-18 10:54:06
CODE
#REGEX {\\b(@target)\\b} {#CW red}
(I think. It's been a while.)