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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
Troublemag
Wanderer


Joined: 14 Jul 2004
Posts: 83

PostPosted: Thu Nov 22, 2007 2:09 am   

[2.13] Issue with the #sub command?
 
This worked on 1.34, but I may have missed a change somewhere along the line. If so, I apologize beforehand.

The trigger commands are:
Code:
#var weavename %1
#var aircost %3
#var earthcost %5
#var firecost %7
#var spiritcost %9
#var watercost %11
#var endcost %13
#if ((@sphereair>=@aircost)&&(@sphereearth>=@earthcost)&&(@spherefire>=@firecost)&&(@spherespirit>=@spiritcost)&&(@spherewater>=@watercost)) {#sub "@weavename @aircost<color white> A</color>,%4@earthcost<color darkgoldenrod> E</color>,%6@firecost<color red> F</color>,%8@spiritcost<color yellow> S</color>,%10@watercost<color blue> W,</color>%12@endcost <color green>End.</color> <color Red>Yes</color>"} {#sub "@weavename @aircost<color white> A</color>,%4@earthcost<color darkgoldenrod> E</color>,%6@firecost<color red> F</color>,%8@spiritcost<color yellow> S</color>,%10@watercost<color blue> W,</color>%12@endcost <color green>End.</color> <color Red>No</color>"}


With triggers disabled, the output is this:
Code:
blade of flame       0 A,  40 E,  90 F,   0 S,   0 W,    30 End.
blindness           30 A,   0 E,   0 F,  15 S,   0 W,    30 End.
blizzard            60 A,   0 E,   0 F,   0 S,  80 W,    85 End.
bond                 0 A,   0 E,   0 F,  70 S,   0 W,   100 End.
call lightning      80 A,   0 E,  50 F,  30 S,   0 W,    85 End.
calm                 0 A,   0 E,   0 F,  75 S,   0 W,    30 End.
create flame         5 A,   0 E,  10 F,   0 S,   0 W,     7 End.
create spring        0 A,   0 E,   0 F,   0 S,  12 W,    20 End.
delve               30 A,   0 E,   0 F,  55 S,  35 W,    90 End.


With the trigger, the output should be the same only with a Yes or a No at the end. The output is this:
Code:
@weavename @aircost A,%4@earthcost E,%6@firecost F,%8@spiritcost S,%10@watercost W,%12@endcost End. No
@weavename @aircost A,%4@earthcost E,%6@firecost F,%8@spiritcost S,%10@watercost W,%12@endcost End. Yes
@weavename @aircost A,%4@earthcost E,%6@firecost F,%8@spiritcost S,%10@watercost W,%12@endcost End. No
@weavename @aircost A,%4@earthcost E,%6@firecost F,%8@spiritcost S,%10@watercost W,%12@endcost End. Yes
@weavename @aircost A,%4@earthcost E,%6@firecost F,%8@spiritcost S,%10@watercost W,%12@endcost End. Yes
@weavename @aircost A,%4@earthcost E,%6@firecost F,%8@spiritcost S,%10@watercost W,%12@endcost End. Yes
@weavename @aircost A,%4@earthcost E,%6@firecost F,%8@spiritcost S,%10@watercost W,%12@endcost End. Yes


The values for @sphereair, @sphereearth, etc. are set as part of another trigger that is functioning correctly.

Suggestions? Hints?
_________________
CMUDPro 3.22
Reply with quote
Zugg
MASTER


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

PostPosted: Thu Nov 22, 2007 2:29 am   
 
This should have never worked in v1.34. Variables and %1..%99 are *not* expanded within " quotes. And your #SUB command is using " quotes around it's arguments. Use {} instead of quotes and then it should work.
Reply with quote
Troublemag
Wanderer


Joined: 14 Jul 2004
Posts: 83

PostPosted: Thu Nov 22, 2007 2:35 am   
 
I made the changes and the output is still a bit off. The first line works, but subsequent lines aren't quite right.
Code:
blade of flame       0 A,  40 E,  90 F,   0 S,   0 W,    30 End. No
30<color 30 A,   0 E,   0 F,  15 S,   0 W,    30 End. Yes
60<color 60 A,   0 E,   0 F,   0 S,  80 W,    85 End. No
0<color 0 A,   0 E,   0 F,  70 S,   0 W,   100 End. Yes
80<color 80 A,   0 E,  50 F,  30 S,   0 W,    85 End. Yes
0<color 0 A,   0 E,   0 F,  75 S,   0 W,    30 End. Yes
5<color 5 A,   0 E,  10 F,   0 S,   0 W,     7 End. Yes
0<color 0 A,   0 E,   0 F,   0 S,  12 W,    20 End. Yes
30<color 30 A,   0 E,   0 F,  55 S,  35 W,    90 End. Yes
50<color 50 A,  75 E,   0 F,  95 S,   0 W,   100 End. Yes
0<color 0 A,  80 E,   0 F,   0 S,   0 W,    85 End. Yes
_________________
CMUDPro 3.22
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5187

PostPosted: Thu Nov 22, 2007 3:51 am   
 
Going out on a bit of a limb since I havent tested using MXP inside of %format, however it is and always was the right way to do such a thing.
Code:
#sub {%format("&50s&5n<color white> A</color>,&5n<color darkgoldenrod> E</color>,&5n<color red> F</color>,&5n<color yellow> S</color>,&5n<color blue> W</color>,&5n <color green>End.</color> <color Red>Yes</color>",@weavname,@aircost,@earthcost,@firecost,@spiritcost,@watercost,@endcost)}


Also without actually seeing the changes you made we can't really tell if there is a bug with #SUB that needs to be corrected.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Troublemag
Wanderer


Joined: 14 Jul 2004
Posts: 83

PostPosted: Thu Nov 22, 2007 5:10 am   
 
The change I made was changing the quotes to brackets as Zugg said to do. That was the only change made.

I did find the source of the display problem, however. Somehow, the #SUB command created triggers for the weavenames and put the first characters as the value being #SUBbed. I'm not sure how that happened and I haven't been able to recreate it. Once I deleted all the extra triggers, it has worked flawlessly using Zugg's suggested change.
_________________
CMUDPro 3.22
Reply with quote
Zugg
MASTER


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

PostPosted: Thu Nov 22, 2007 5:10 am   
 
Yes, please post your modified script so we can look at it. Perhaps someone can convert it into a simpler test. There have definitely been several changes to how colors and MXP stuff works. I even made some changes in 2.13 that were weird collisions between ANSI color, MXP color, and style colors (you get the default style color when you use the ESC[0m reset code). So it's definitely possible that I added some bugs because of this. But we'll need a test procedure that demonstrates the bug.
Reply with quote
Troublemag
Wanderer


Joined: 14 Jul 2004
Posts: 83

PostPosted: Thu Nov 22, 2007 7:19 am   
 
The modified code:
Code:
Trigger pattern:
(*)(%s)(%d) A,(%s)(%d) E,(%s)(%d) F,(%s)(%d) S,(%s)(%d) W,(%s)(%d) End.

commands:
#var weavename %1
#var aircost %3
#var earthcost %5
#var firecost %7
#var spiritcost %9
#var watercost %11
#var endcost %13
#if ((@sphereair>=@aircost)&&(@sphereearth>=@earthcost)&&(@spherefire>=@firecost)&&(@spherespirit>=@spiritcost)&&(@spherewater>=@watercost)) {#sub {@weavename @aircost<color white> A</color>,%4@earthcost<color darkgoldenrod> E</color>,%6@firecost<color red> F</color>,%8@spiritcost<color yellow> S</color>,%10@watercost<color blue> W,</color>%12@endcost <color green>End.</color> <color Red>Yes</color>}} {#sub {@weavename @aircost<color white> A</color>,%4@earthcost<color darkgoldenrod> E</color>,%6@firecost<color red> F</color>,%8@spiritcost<color yellow> S</color>,%10@watercost<color blue> W,</color>%12@endcost <color green>End.</color> <color Red>No</color>}}
_________________
CMUDPro 3.22
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum 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