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
Ithilion
Wanderer


Joined: 02 Sep 2005
Posts: 85

PostPosted: Sun Sep 18, 2011 8:14 am   

psub issues
 
Aight, on Aardwolf, making my own affects colorized by spell duration -
below 3600 seconds colorizes just fine, but above that, it misses the hour and colorizes the rest.. Any ideas?
this is my current code right now with the uncooperating snippet

Code:

$secs = %eval( %if( %3, %eval( %3*3600))+(%5*60)+%6)
#if ($secs >= 3600) {
          #psub @mxp_num4( %3) %x3
          #psub @mxp_num4( %4) %x4
          spells_dropping11=@spells_dropping11+1
          }


Skill : Shadow form (01:22:26) for anyone who wants to try and help
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Mon Sep 19, 2011 12:33 am   
 
So in all of that, %x4 is colored but %x3 is not? I would check for errors in @mxp_num4() or test %3, etc to see exactly what the code is working on ("01" as a string is not the same as "1" as a number, for example). Personally, however, I'd decomplicate the pattern so that the time was captured into just one variable, doing the separation and math in the code. #PSUB modifies the length of the raw string but does not preserve the positions of captured subpatterns, so things like color tags might cause subsequent #PSUBs to insert their changes in the wrong place.

#switch (%numwords(%3))
("3") {
$seconds = @mxp_num4(%word(%3,1))":"@mxp_num4(%word(%3,2))":"%word(%3,3)
}
("2") {
$seconds = @mxp_num4(%word(%3,1))":"%word(%3,2)
}
("1") {
$seconds = %3
}
{
#exit
}
#psub $seconds %x3
_________________
EDIT: I didn't like my old signature
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