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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Churlant
Novice


Joined: 17 Oct 2002
Posts: 44
Location: USA

PostPosted: Tue Apr 05, 2005 3:01 am   

Color Matching... ?
 
I need a bit of help on a trigger I'm trying to refine. What I want to do is cast a spell only when the status line is a certain color... the only real way to know if the spell is already active is by the color - dark cyan for inactive, light cyan for active.

The problem is I can't figure out how to get the ansi code. The code I've produced isn't working out...

Trigger so far is

#TR {*(%w)%sMana~:%s%d%sLearned~:%s%d~%%s~((%d)~)$} {#IF (%ismember( %2, @badspells)) {#NOOP} {#IF (%colorname( %1) = "536870911") {c '%2'} {#NOOP}}

I'm not sure if the color code is wrong or not... any suggestions would be great :)
_________________
>-Churlant-<
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Tue Apr 05, 2005 4:25 am   
 
1)no obligatory MUD output to compare to the trigger pattern. Even if we understood what you want, we'd have no way to test our code against what you're seeing and so we can't help you with problems in (y)our code or your logic.

2)%colorname() is being used incorrectly. It does not tell you the color of a piece of text, it tells you the decimal equivalent (255) of a color name (red) or RGB value (#FF0000). I wager you can toss that out completely, but see #1.

3)"536870911" is the color value for "no color". Is that what you were wanting to test for or were you wanting to test for the two colors you mentioned?

4)%2 = %d (a number). Does @badspells contain numbers (ie, 1|2|4|3|4), or does it contain words? I have no idea what @badspells contains, so I'd thought I mention this just in case you made a mistake.
_________________
EDIT: I didn't like my old signature
Reply with quote
Churlant
Novice


Joined: 17 Oct 2002
Posts: 44
Location: USA

PostPosted: Tue Apr 05, 2005 4:31 am   
 
MattLofton wrote:
1)no obligatory MUD output to compare to the trigger pattern. Even if we understood what you want, we'd have no way to test our code against what you're seeing and so we can't help you with problems in (y)our code or your logic.

2)%colorname() is being used incorrectly. It does not tell you the color of a piece of text, it tells you the decimal equivalent (255) of a color name (red) or RGB value (#FF0000). I wager you can toss that out completely, but see #1.

3)"536870911" is the color value for "no color". Is that what you were wanting to test for or were you wanting to test for the two colors you mentioned?

4)%2 = %d (a number). Does @badspells contain numbers (ie, 1|2|4|3|4), or does it contain words? I have no idea what @badspells contains, so I'd thought I mention this just in case you made a mistake.


Okay... well, for #1... here is a sample line:

Level: 34 Godly embrace Mana: 30 Learned: 76% (425)

The spell name, 'Godly Embrace', will be a different color if it is active than if it is not. What I'm trying to do is get the trigger to understand whether or not the spell is active by matching its current color to the inactive color - that way, if it matches, I cast the spell... if not, it is already active, and I do nothing.

2. I'm unsure how to get the trigger to match the color - but I figured color name wasn't going to work. The code, being 'no color', is good to know... that explains why the trigger fires almost every time ;)

3. See above...

4. Badspells contains numbers. Basically the spells can be cast by name or number. The final number in the line above is the spell #, and since I don't want to cast ALL the spells which show up in a listing, I added the check so it wouldn't fire on spells which are listed in that db.

Hope that helps...

-JC
_________________
>-Churlant-<
Reply with quote
DeathDealer
Adept


Joined: 20 Jul 2004
Posts: 268

PostPosted: Tue Apr 05, 2005 1:20 pm   
 
Churlant, lemme take a guess. Yer trying to use the spellup code from Alhena's Aard script site?
If ya are, then I can tell ya that I posted a question about this long ago, and for some reason NONE of the suggestions on her site helped, and nothing I could get from here would work either for some reason.
http://forums.zuggsoft.com/phpbb/viewtopic.php?t=17315&highlight=
So, i gave up on it and am using the spellup script from Crimson's site:
http://www33.brinkster.com/crimsonhorde/zmudspell1.asp

It's a little more complex, and frankly, i fixed up a few errors in it but it works nicely.
The errors were with recasting Heighten, and in casting Harden Body on someone.

Under Skills_Self the trigger ^Your senses don't feel any more accurate! it SAYS #IF (@spellup_heightenstat="X") {heighten} but it SHOULD be #IF (@spellup_heightenstatus="X") {heighten}

And under one or more of these: spellup_others_fulllist, spellup_others_nolist, or spellup_others_yeslist harden body is missing. fixed that one about a month ago, so don't remember which it was.

Err...if I am wrong and you aren't using Alhena's script, and/or you aren't from Aard...errr...i'll just stfu now :-)
As a side note, using the spell #'s in aard reduce the bandwidth a lil and makes for a faster spellup. so you should use %4 and not %2. What I mean is that the text sent to aard is smaller, so it goes quicker. It was something I noticed when i was a 7x. the amount of time diff for a full spellup was prolly less than 2-3 seconds, but when u got a double going every sec counts :-)
_________________
Reply with quote
Churlant
Novice


Joined: 17 Oct 2002
Posts: 44
Location: USA

PostPosted: Tue Apr 05, 2005 3:08 pm   
 
DeathDealer wrote:

As a side note, using the spell #'s in aard reduce the bandwidth a lil and makes for a faster spellup. so you should use %4 and not %2. What I mean is that the text sent to aard is smaller, so it goes quicker. It was something I noticed when i was a 7x. the amount of time diff for a full spellup was prolly less than 2-3 seconds, but when u got a double going every sec counts :-)


Well, right MUD, wrong script. This one is actually my own horrid creation. I don't really want a super-complex script... I don't want something that keeps track of what wears off, for instance. All I really was is a couple of simple scripts that'll toss on stat spells or ac spells, depending.

Currently I have a simple system that'll do a full spellup and recast the lost concentrations... I just want to be able to specific between spells stats, etc...

As to the spell # suggestion... good to know :) I can do the alterations.

Now I just need to know how to do the color matching... if it's even possible.

-JC

As another thought... I suppose I COULD create vars for every spell name and translate them all into their numbers, then check the saff list to the total list and compare which numbers are missing to cast spells which aren't active... but that may be frightfully complicated. I could code it I suppose, but I'm not sure about the lag rate... of course, the new version of ZMud is infinitely faster than what I had before, so I dunno...
_________________
>-Churlant-<
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Tue Apr 05, 2005 9:43 pm   
 
Quote:

2. I'm unsure how to get the trigger to match the color - but I figured color name wasn't going to work. The code, being 'no color', is good to know... that explains why the trigger fires almost every time ;)


Much better! Not having the output forced me to keep the field broadened far too widely so I wasn't able to offer anything real useful.

As for the above, I have no idea how to pull out the ansi codes themselves but ZMud does allow you to create ANSI color triggers that match the codes. You simply will have to create two triggers (one for each trigger) and put the appropriate code in each one. That looks like a prompt or some other frequent bit of text, so you might want to include some boolean checks to prevent spam.
_________________
EDIT: I didn't like my old signature
Reply with quote
Churlant
Novice


Joined: 17 Oct 2002
Posts: 44
Location: USA

PostPosted: Tue Apr 05, 2005 10:07 pm   
 
MattLofton wrote:
Quote:

2. I'm unsure how to get the trigger to match the color - but I figured color name wasn't going to work. The code, being 'no color', is good to know... that explains why the trigger fires almost every time ;)


Much better! Not having the output forced me to keep the field broadened far too widely so I wasn't able to offer anything real useful.

As for the above, I have no idea how to pull out the ansi codes themselves but ZMud does allow you to create ANSI color triggers that match the codes. You simply will have to create two triggers (one for each trigger) and put the appropriate code in each one. That looks like a prompt or some other frequent bit of text, so you might want to include some boolean checks to prevent spam.


Uhm... well I'm not really sure how to do that. Embarassed

I do know about the ansi-match checkbox, but it reads as if it matches the color of the entire line, and it's got to be word-specific.

-JC
_________________
>-Churlant-<
Reply with quote
DeathDealer
Adept


Joined: 20 Jul 2004
Posts: 268

PostPosted: Wed Apr 06, 2005 2:44 pm   
 
On alhena's site the spellup has these 2 versions to work off.

*%e[36m%1%s%e[0m Mana: %e[36m%s%d%e[0m Learned:%e[36m%s%2~%

*%e[36m%1%s%e[37m%sMana:%s%e[36m%s%d%e[37m%sLearned:%e[36m%s%2~%

Btw, using %2 in your script i think was wrong.
It shoulda been %1 the * don't count unless ya did %* i think.
But the %4 SHOULD work from my suggestion for the #'s.....i think....

BTW, i ain't DeathDealer on Aard..so don't ask him for help :-)
_________________
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD 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