More cmud weird issues

by Munsia

Back to Mechanic's Corner.

Munsia2009-05-07 03:29:18
Uh, Well since I'm coming back I transfered my system into a system so I've got half zmud coding going through my cmud system

Now I use to use Forren's old setup, and there was an ego checker...for some reason it's not working. The alias to fire off is not the problem, what's happening is it's not registering 50% at all....I'll post the codes, if anyone could correct me I'd be happy.
CODE
^(%w)'s ego stands at (%d)/(%d).

CODE
#if ((%2 < %3/2) AND (%1 = @target)) {
    #SAY MINDBURST MINDBURST MINDBURST MINDBURST MINDBURST
    #CO 1237
    #SAY MINDBURST MINDBURST MINDBURST MINDBURST MINDBURST
    #CO 1237
    #SAY MINDBURST MINDBURST MINDBURST MINDBURST MINDBURST
    #CO 1237
    #SAY MINDBURST MINDBURST MINDBURST MINDBURST MINDBURST
    #CO 1237
    #var canburst 1
    #var bursttarget %1
    } {#var canburst 0}


and
CODE
^The max/current ego strength of (%w): (%d)/(%d)

CODE
#if ((%3 < %2/2) AND (%1 = @target)) {
    #SAY MINDBURST MINDBURST MINDBURST MINDBURST MINDBURST
    #CO 1237
    #SAY MINDBURST MINDBURST MINDBURST MINDBURST MINDBURST
    #CO 1237
    #SAY MINDBURST MINDBURST MINDBURST MINDBURST MINDBURST
    #CO 1237
    #SAY MINDBURST MINDBURST MINDBURST MINDBURST MINDBURST
    #CO 1237
    #var bursttarget %1
    #var canburst 1
    } {
    #var canburst 0
    #SAY KEEP GOING KEEP GOING
    }
Vathael2009-05-07 05:14:00
Not sure if it works in cmud but you could try something like this instead:

#if ((%2 < %eval(%3/2)) AND (%1 = @target)) {

EDIT: had wrong function in, fixed.
Placeus2009-05-07 05:25:57
Here's what I use in CMUD for absolve. It shows the percentage, coloured yellow if >50% and coloured red if <=50%

Trigger: \\w+\\'s (health|mana|ego|power) stands at (\\d+)\\/(\\d+)\\.

Action: #if (%1 == mana) {#say 50,yellow,red)>%left(%eval(100*%float(%2)/%3),5)}


Edit: From what I remember, using %float() ensures that you're using float division instead of integer division thereby avoiding rounding of your result. The %float and %eval help pages spell out the difference.
Munsia2009-05-07 13:53:53
They work in zmud just fine by the way.
Unknown2009-05-07 16:15:07
QUOTE (munsia @ May 7 2009, 09:53 AM) <{POST_SNAPBACK}>
They work in zmud just fine by the way.


Yeah, that means nothing, really. The two are very similar, but zMUD has a lot of quirks in the scripting and interface. Well, I should say it has different quirks than CMUD has...
Munsia2009-05-07 17:21:51
QUOTE (Zarquan @ May 7 2009, 12:15 PM) <{POST_SNAPBACK}>
Yeah, that means nothing, really. The two are very similar, but zMUD has a lot of quirks in the scripting and interface. Well, I should say it has different quirks than CMUD has...

Right, so the solution would be what's the quirk in my coding that's different.
Desitrus2009-05-07 17:58:03
#TRIG {^* has a mana of (&enemycurrentmana) out of (&enemymaxmana).} {
#MATH enemycurrentmana @enemycurrentmana*1.0
#MATH enemymaxmana @enemymaxmana*1.0
#MATH absolvemana (@enemycurrentmana/@enemymaxmana)*100
#IF @absolvemana>49 {#ECHO %ansi( blue,white) NOT READY YET, ENEMY MANA PERCENT IS ~-~-~-%int(@absolvemana)~-~-~-}
#IF @absolvemana<50 {#ECHO %ansi( white,red) ABSOLVE NOW ENEMY MANA PERCENT IS ~-~-~-%int(@absolvemana)~-~-~-}}

That's a working CMUD percentage script, I'm sure you can figure out what to do with it. The key is what was said above, CMUD assumes integer and just does nothing when you try to do division with it. Adding a decimal to the number auto changes it to float or using %float. Then I just do %int to change it back to integer for the display since it cuts off the decimal without rounding.
Munsia2009-05-07 21:33:36
Heh......what?
Desitrus2009-05-07 21:48:36
QUOTE (munsia @ May 7 2009, 04:33 PM) <{POST_SNAPBACK}>
Heh......what?


???

A trigger that assigns variables from the matched pattern. When I resolve a target it says:

Bobbyd has a mana of 100 out of 200.

Thus, the trigger is:

#TRIG {^* has a mana of (&enemycurrentmana) out of (&enemymaxmana).}

The contents of the trigger is:

#MATH enemycurrentmana @enemycurrentmana*1.0
#MATH enemymaxmana @enemymaxmana*1.0

This step converts the variables to float instead of integer as a data type. Integer can not have decimal points, so if you do division with them in cmud, cmud flips out and tells you to go fly a kite. Actually, it just leaves the value of the variable at 0. %float(@variable) does the same thing.

#MATH absolvemana (@enemycurrentmana/@enemymaxmana)*100

This is just creating a readable number from the division. Instead of .483280324093 mana he will have 48.3280324093 mana.

#IF @absolvemana>49 {#ECHO %ansi( blue,white) NOT READY YET, ENEMY MANA PERCENT IS ~-~-~-%int(@absolvemana)~-~-~-}

This checks to see if the mana percent the enemy has is out of absolve range. The reaction is an echo that says their mana percent and not to absolve.

#IF @absolvemana<50 {#ECHO %ansi( white,red) ABSOLVE NOW ENEMY MANA PERCENT IS ~-~-~-%int(@absolvemana)~-~-~-}

This is the condition in absolve range. %int is used because it clips the decimal WITHOUT rounding, so 48.3280324093 becomes 48.

Get it?
Munsia2009-05-08 05:24:53
nope
Narsrim2009-05-08 06:44:46
I have something you can add, Munsia. It's a little different, but it works just fine.
Narsrim2009-05-08 06:49:56
This is my, "I don't know how to code to save my soul because I fail miserably at computers" version:

CODE
Pattern: ego stands at %1/%2.

#variable targetcurrentego {%1}
#variable targetmaxego {%2}
#math burstego (%2/2.0)
#if (@targetcurrentego <= @burstego) {psi super mindburst @target}
#if (@targetcurrentego > @burstego) {psi super @tpattack @target}
#sub {%ansi(26)EGO is %round( ((%float( @targetcurrentego) / %float( @targetmaxego))*100))%}


CODE
pattern: You tunnel into the identity of %1 and drink the psychic energies there.

psi sub @subaff @target
psi id @idaff @target


CODE
pattern: You blast the mind of %1 with a ferocious telepathic assault.

psi sub @subaff @target
psi id @idaff @target


CODE
#alias mblast {#echo {MINDBLAST IS ACTIVATED!};#variable tpattack {mindblast}}
#alias pvamp {#echo {PSYCHICVAMPIRISM IS ACTIVATED!};#variable tpattack {psychicvampirism}}


CODE
#key f1 {#show {TELEPATHY COMBO: DEADENING/PARALYSIS};#var subaff {deadening};#var idaff {paralyse}}

#key f2 {#show {TELEPATHY COMBO: STUPIDITY/PARALYSIS};#var subaff {stupidity};#var idaff {paralyse}}

#key f3 {#show {TELEPATHY COMBO: STUPIDITY/ADDICTION};#var subaff {stupidity};#var idaff {addiction}}

#key f4 {#show {TELEPATHY COMBO: PHOBIA/AMPLIFY};#var subaff {phobia};#var idaff {amplifyphobia}}

#key f5 {#show {TELEPATHY COMBO: PARALYSE/PEACE};#var subaff {paralyse};#var idaff {pacify}}

#key f6 {#show {TELEPATHY COMBO: HALLUCINATIONS/EPILEPSY};#var subaff {hallucinations};#var idaff {epilepsy}}

#key f7 {#show {TELEPATHY COMBO: RECKLESS/ADDICTION};#var subaff {recklessness};#var idaff {addiction}}



This works like a charm and has never failed me. This only works with discern though. I use something else for egoscan.
Narsrim2009-05-08 06:52:39
Speaking of which, how do you do less than or equals to in Cmud? Found it!
Desitrus2009-05-08 14:09:03
Yeah, that's essentially the same thing without finding a percentage. Notice the decimal to convert it to a float in the math statement.
Munsia2009-05-08 18:14:57
Nars sorta had the right idea, I can't code and I don't understand it all too well either.
Nars, yours is for discern I believe isn't it?
Egoscan one is what I really need, with a way to delay the mindburst or activate it....the way my attack system is set up it does that all for me already I just need to be able to make the math work.
Narsrim2009-05-08 18:23:27
CODE
Pattern: The max/current ego strength of %1: %2/%3

#variable targetcurrentego {%3}
#math burstego (%2/2.0)
#if (@targetcurrentego <= @burstego) {#var bursttarget %1;#var canburst 1}


Try that and see what happens.
Munsia2009-05-08 19:09:22
Ya, that registers. Now I at least get my notices.

But the alias that's suppose to be switching it to insta isn't working
Narsrim2009-05-08 19:14:41
QUOTE (munsia @ May 8 2009, 03:09 PM) <{POST_SNAPBACK}>
Ya, that registers. Now I at least get my notices.

But the alias that's suppose to be switching it to insta isn't working


What's the alias?
Munsia2009-05-08 19:16:25
CODE
escan
  addic
  #if (@canburst==1 AND @bursttarget==@target) {insta} {#if (@mainattack==0) {mblast} {vamp}}


Munsia2009-05-08 19:17:45
edit: Nope, nevermind. Whatever I just did made it worse.