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
chris-74269
Magician


Joined: 23 Nov 2004
Posts: 364

PostPosted: Mon Dec 17, 2007 2:58 am   

Ansi issues with 2.18
 
After upgrading I've noticed that all my old ansi triggers no longer work, my old patterns of %e[7m are now %[0SA. Is there anyway asides from rewritting all my triggers to make cmud interpret the ansi codes how it did before the upgrade?
Reply with quote
ennye
Novice


Joined: 17 Dec 2007
Posts: 49

PostPosted: Mon Dec 17, 2007 11:41 pm   
 
1) I noticed, they messed %ansi codes. F.e. GREEN. No chance. #say %ansi(green)Hello.
No green.
%ansi(2)Hello.
None!
%ansi(green,bold)Hi
Works fine..
Half of my script has lost colour ;) Waiting for update!

2) Another things that stopped working :
EXAMPLE :
Got variable @str
%ansi(bold,green)-4|%ansi(bold,green)-3|%ansi(bold,green)-2|%ansi(bold,green)-1|"%ansi(bold,blue)0"|"%ansi(bold,red)+1"|"%ansi(bold,red)+2"|"%ansi(bold,red)+3"|"%ansi(bold,red)+4"|"%ansi(bold,red)+5"|"%ansi(bold,green)-2"|"%ansi(bold,green)-1"|"%ansi(bold,red)+1"|"%ansi(bold,red)+3"|"%ansi(bold,red)+5"

#say %item(@str,4)
Should give :
-1 (coloured green, bold)
Gives :
%ansi(bold,green)-1

However : #say %EXPAND(%item(@str,4))
Gives OK, -1 (coloured green bold) WHY? Its a bug ;)
Reply with quote
Larkin
Wizard


Joined: 25 Mar 2003
Posts: 1113
Location: USA

PostPosted: Tue Dec 18, 2007 2:09 am   
 
I'm not sure I'd call number 2 a bug. It can be useful to store strings that are not expanded when retrieved. Forcing expansion works, so the script can be made to do what you want...

You're absolutely correct on number 1. Confirmed that green does not work, though with the default style color it may appear so.
Reply with quote
ennye
Novice


Joined: 17 Dec 2007
Posts: 49

PostPosted: Tue Dec 18, 2007 2:58 am   
 
Other functions are expandable, I may be wrong, but one of the main ideas of cmud was "all expanded".
The same thing is with buttons. I gave up trying to make one of my zmud scripts working.
Example :
In zmud i got autocreating buttons with party members. Set of buttons is created from a variable @party, each button contains name and hp of propper party member. #forall function cycles through @party, creates button with %item(@hp,party_member_number). Try to get it working on cmud... grrr horrible. Button things were easy expandable in zmud, aret in cmud. BTW.: unbutton is killed (buttons can NO MORE be unbutton by id, must be unbutton by path|id , WHY ?)


#forall @team {
#va team_hp %additem( "unchecked", @team_hp)
#BUTTON %trim( %i) {%proper( %word( %i, 1)) => "%item(@team_hp,%ismember(%i,@team))"} {command %item( @team2, %ismember( %i, @team))} {} {} {} {} {} {size} {170} {20} {} {} {} {} {} {} {} "statusbars|hpbutt" {Explore|Right} {} {}
}

Creates a set of buttons for each partymember with appropriate name ( or first word of a name if its more than 1-word) => hp , executes command <name> when hit.
Every hp check buttons are refreshed from variables with : "%item(@team_hp,%ismember(%i,@team))" where ONLY %i should be expanded in button, and thats the problem.

%word( %i, 1) - should be expanded and it works ok
"%item(@team_hp,%ismember(%i,@team))" - only %i expanded as it works LIVE updating hp from team_hp variable (which is updated every hp check by a trigger) (Probably this %i expanding IS a problem. It cant expand since its in "". It expands ok in zmud.)
command %item( @team2, %ismember( %i, @team)) - %i expanded (not working under cmud, %i not expands in any way, gave up why)
I tried virtually all combinations ;) Even temporary variables etc. The script works great under zmud as it is.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Tue Dec 18, 2007 1:48 pm   
 
Yes button redefining is broken. I didn't know #UNBUTTON was affected as well, and that seems a bug. I would suggest making the buttons permanently, and using a function to display the values. The benefit of this is that your scripts will be faster. The general idea is something like this
Code:
#CLASS TeamButtons
#FUNCTION TeamDisplay {#RETURN {%concat(%proper(%word(%item(@team,%1),1))," => ",%item(@teamhp,%1))}}
#FUNCTION DoTeamUpdate {#LOOP 9 {#IF (%i<=%numitems(@team)) {#T+ {TeamBtn%i} {#T- {TeamBtn%i};UpdateTeam=(!UpdateTeam)}
#VAR UpdateTeam {0} {0}
#BUTTON "TeamBtn1" {%if(@UpdateTeam,,)@TeamDisplay(1)} {command %item( @team2,1)} {} {} {} {} {} {size} {170} {20} {} {} {} {} {} {} {} "statusbars|hpbutt" {Explore|Right} {} {}
#BUTTON "TeamBtn2" {%if(@UpdateTeam,,)@TeamDisplay(2)} {command %item( @team2,2)} {} {} {} {} {} {size} {170} {20} {} {} {} {} {} {} {} "statusbars|hpbutt" {Explore|Right} {} {}
#BUTTON "TeamBtn3" {%if(@UpdateTeam,,)@TeamDisplay(3)} {command %item( @team2,3)} {} {} {} {} {} {size} {170} {20} {} {} {} {} {} {} {} "statusbars|hpbutt" {Explore|Right} {} {}
#BUTTON "TeamBtn4" {%if(@UpdateTeam,,)@TeamDisplay(4)} {command %item( @team2,4)} {} {} {} {} {} {size} {170} {20} {} {} {} {} {} {} {} "statusbars|hpbutt" {Explore|Right} {} {}
#BUTTON "TeamBtn5" {%if(@UpdateTeam,,)@TeamDisplay(5)} {command %item( @team2,5)} {} {} {} {} {} {size} {170} {20} {} {} {} {} {} {} {} "statusbars|hpbutt" {Explore|Right} {} {}
#BUTTON "TeamBtn6" {%if(@UpdateTeam,,)@TeamDisplay(6)} {command %item( @team2,6)} {} {} {} {} {} {size} {170} {20} {} {} {} {} {} {} {} "statusbars|hpbutt" {Explore|Right} {} {}
#BUTTON "TeamBtn7" {%if(@UpdateTeam,,)@TeamDisplay(7)} {command %item( @team2,7)} {} {} {} {} {} {size} {170} {20} {} {} {} {} {} {} {} "statusbars|hpbutt" {Explore|Right} {} {}
#BUTTON "TeamBtn8" {%if(@UpdateTeam,,)@TeamDisplay(8)} {command %item( @team2,8)} {} {} {} {} {} {size} {170} {20} {} {} {} {} {} {} {} "statusbars|hpbutt" {Explore|Right} {} {}
#BUTTON "TeamBtn9" {%if(@UpdateTeam,,)@TeamDisplay(9)} {command %item( @team2,9)} {} {} {} {} {} {size} {170} {20} {} {} {} {} {} {} {} "statusbars|hpbutt" {Explore|Right} {} {}
#CLASS 0
Now where you used to have that #FORALL you can put this "#CALL @DoTeamUpdate()".
_________________
The only good questions are the ones we have never answered before.
Search the Forums

Last edited by Vijilante on Tue Dec 18, 2007 2:34 pm; edited 1 time in total
Reply with quote
Larkin
Wizard


Joined: 25 Mar 2003
Posts: 1113
Location: USA

PostPosted: Tue Dec 18, 2007 2:24 pm   
 
I think your brackets and parentheses are off in that script, Vij...
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Tue Dec 18, 2007 2:35 pm   
 
Quite right, thanks. Hopefully I had enough coffee to get all the errors.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Mon Jan 07, 2008 9:43 pm   
 
I confirmed that %ansi(green) doesn't work properly. It always uses the default text style instead of green.

I also confirmed that #BUTTON doesn't let you redefine buttons based upon button number. Since the button "number" in CMUD is really the button priority number, I suggest using a button ID name instead. For example:

#BUTTON 1 {hello} {#say hello world}

will create a new button each time. But doing this:

#BUTTON "test" {hello} {#say hello world}

will properly redefine the "test" button each time. I added this to the bug list to see if it is possible to fix.
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