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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Fri Apr 25, 2008 1:56 am   

Color2
 
So... I tried

Code:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <func name="RGB" type="Literal" copy="yes">
    <value>#RESULT ""
$Val=(($Red*256+$Green)*256+$Blue)
$Ret=%mss(%concat("Hex(",$Val,")"))
#IF (%len($Ret)<=6) {#RETURN %left(%concat("#",%rightback(%concat("000000",$Ret),6)),7)}</value>
    <arglist>$Red, $Green, $Blue</arglist>
  </func>
</cmud>


from Vigilante, and then put it in...

Code:

#regex test {^You begin to mill a fir log\.$} {#COLOR @RGB(255,0,0)}


(don't ask me why it's regex, I'm just used to using that now)

and I get:

ERROR: Syntax error in Function: RGB : invalid local variable: Red


Also... I may not use the function, and try to adapt to hex, however, I don't know how to get the hex to work with color. I've tried #color hex or #color colorname(hex) etc...
Reply with quote
Larkin
Wizard


Joined: 25 Mar 2003
Posts: 1113
Location: USA

PostPosted: Fri Apr 25, 2008 2:19 am   
 
I created this using #FUNCTION (because I don't know how to paste that XML yet), and it gave me #FF0000 as the output from the function. It's not of type Literal and there's no copy attribute, so maybe those are your issue here?

Code:
<func name="RGB" id="1">
  <value>#RESULT ""
$Val=(($Red*256+$Green)*256+$Blue)
$Ret=%mss(%concat("Hex(",$Val,")"))
#IF (%len($Ret)<=6) {#RETURN %left(%concat("#",%rightback(%concat("000000",$Ret),6)),7)}</value>
  <arglist>$Red,$Green,$Blue</arglist>
</func>
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Fri Apr 25, 2008 2:24 am   
 
Urm, OK aside from the forums messing up the less than and greater than bracket codes.

Both the trigger and the function work perfectly for me and give me a nice red color for
the trigger text.

As I don't know how to read the RGB syntax I am guessing red text is the correct result!

Because I had to manually create the function due to the problem with the forum eating the bracket codes
I had the function set to be auto type instead of literal. I don't know if that could cause the issue or not.

Ninja'd

Larkin the main problem with pasting xml is that the forums eat the brackets so you cannot paste most
things directly from the forums.

Right click on the funtion that you created and select copy. Then paste it into a notepad.
Note that < and > are replaced by & lt and & gt

So if you copy the stuff from notepad you can paste it into the tree view in a blank session.
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram

Last edited by Arminas on Fri Apr 25, 2008 2:28 am; edited 1 time in total
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Fri Apr 25, 2008 2:27 am   
 
At this point I just want to know how I can use the hex with #color

I just want bright red... it shouldn't be so difficult.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Fri Apr 25, 2008 2:31 am   
 
brackets?

*sighs* I just want to use the hex at the moment...
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Fri Apr 25, 2008 2:33 am   
 
As Larkin mentioned above the output from the function is #FF0000

So just put "#color #FF0000" in your trigger for the bright red.
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Fri Apr 25, 2008 2:43 am   
 
That didn't work, I tried it an it just made it so the text didn't even show. I'll try again.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Fri Apr 25, 2008 3:00 am   
 
Besides that, I cannot tell any difference between "#color mxpred" and "#color #FF0000" And I happen to recall that being mentioned in the thread where Vij gave you that function in the first place.
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Fri Apr 25, 2008 12:52 pm   
 
What am I doing wrong?

Reply with quote
Dharkael
Enchanter


Joined: 05 Mar 2003
Posts: 593
Location: Canada

PostPosted: Fri Apr 25, 2008 1:20 pm   
 
Well your pattern is anchored with ^$ forcing the entire line to match for it to be accepted.
The lines with the string that are intended to match appear to begin with whitespace(s) which the pattern does not allow.
The pattern will fail to match the intended string.
_________________
-Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style."
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Fri Apr 25, 2008 1:24 pm   
 
I thought it could be the case, wasn't sure.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Fri Apr 25, 2008 1:28 pm   
 
Yup. thanks.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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