|
VeldrinCrescent Newbie
Joined: 29 Nov 2005 Posts: 9
|
Posted: Tue Mar 03, 2009 5:04 pm
Couple of questions (zmud user gone cmud) |
I just reinstalled cmud and decided to have a go at it again but I'm stumbling onto things I got no clue on how to solve (been trying to search for it too)
First on some of my buttons I have the name of it being something like this.
Sip: %if(@candrink, Yes, No)
but it won't update as it changes (like it would in zmud), it just saves the name as the variable was when the button got saved. Anyway to fix it to be like I want?
Also doesn't !@whatever.something work anymore? I've had trouble with it and had to go over to !%iskey(@whatever, something) to get it to work (which means if I have to do that there's a lot and lot of things I have to go change in my converted system), possible having to use %db to check for the value of the key (something I'm used to just do @auto.health to see if its on)
I also have some problems with this (well I got a ton more trouble but this one's been mind boggling) script, it's an alias
Code: |
#if (%1) {currentrace=%1}
#if (%proper( @currentrace)=%proper( dragon)) {
#t+ Dragon
#t- %db(@characters, @my_name)
} {
#t- Dragon
#t+ %db(@characters, @my_name)
}
mycon=%item( %db( @lesserforms, @currentrace), 1)
myint=%item( %db( @lesserforms, @currentrace), 2)
#if (%ismember( "a Hunter's Belt", @wearing)) {#add mycon 1} {#if (%ismember( "a Girdle of the Titans", @wearing)) {#add mycon 2} {#if (%ismember( "a Girdle of Aegis", @wearing) or %ismember( "a Belt of Aegis", @wearing)) {#add mycon 3}}}
#if (%ismember( "a Epicurus Sash", @wearing)) {#add myint 1} {#if (%ismember( "a Sash of Wisdom", @wearing)) {#add myint 2} {#if (%ismember( "a Sash of Caymus", @wearing)) {#add myint 3}}}
#if (%ismember( "a Ceylonese bracelet", @wearing)) {braceletbonus=1,10} {braceletbonus=1}
#if (%ismember( "a pair of Mayan Bracelets", @wearing)) {braceletbonus=1,05} {braceletbonus=1}
#if (%ismember( "a pair of Logosian Bracelets", @wearing)) {braceletbonus=1,15} {braceletbonus=1}
#if (%ismember( "a Mayan ring", @wearing)) {sipbonus=110} {sipbonus=100}
#if (%ismember( "a Ceylonese ring", @wearing)) {sipbonus=120} {sipbonus=100}
#if (%ismember( "a Logosian ring", @wearing)) {sipbonus=130} {sipbonus=100}
scores |
it claims I got unmatched braces, but I've simply been unable to find them, far as I can see all parentheses are properly closed and there's a space between ) and { so it's not that either (something I saw in another thread upon searching)
I think it's somewhere with the bracelets but I simply can't see myself out what it is
I'd appreciate any help! |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Tue Mar 03, 2009 6:30 pm |
1) If you're using the #button command, don't. Put the %if right in the caption and it should work.
Code: |
<button>
<caption>%if(@test,yes,no)</caption>
</button> |
works fine for me doing test=1 and test=0 from the command line.
2) @whatever.something should still be returning the value stored in the "something" key of the "whatever" variable, but make sure that it really is empty when you think it is. You could also just do #if (@whatever.something) {} {commands}. If it's really not working, you can copy the XML of the variable and paste it in some code tags like I did above with the button - that'll let us try for ourselves.
3) Debugging this sort of script is easy - press ctrl+k and CMUD takes you right to the source of the problem, which is the construct "1,10" - is it a string, is it a number? Who knows? Basically, the problem is that the 1 looks like a number but the , looks like a string. You need to decide which it's going to be - if it's a string, put "" around it, giving you braceletbonus="1,10", or make it a number and use . as the decimal point, which is what I suspect you were aiming for. I'm aware that some countries use , as their decimal, but CMUD uses . |
|
|
|
VeldrinCrescent Newbie
Joined: 29 Nov 2005 Posts: 9
|
Posted: Tue Mar 03, 2009 6:45 pm |
ah thanks! yeah it was the decimal problem (zmud used , for me before), didn't strike me that cmud might have made it so it was only .
with the button I got this
Code: |
<button type="Gauge" autosize="false" width="65" height="23" autopos="false" top="26" toolbar="2" inset="true" toolstyle="true" transparent="false" color="black" textcolor="red" gaugelowcol="red" gaugebackcol="silver" priority="116" id="7543">
<caption>Sip: %if(@candrink, Yes, No)</caption>
<expr>@candrink</expr>
<gaugemax>1</gaugemax>
<gaugelow>0</gaugelow>
</button>
|
with this as my candrink
Code: |
<var name="candrink" id="3305">%if( %iskey(@auto, "health") and %iskey(@auto, "mana") and !%iskey(@lostbals, "healing") and !%iskey(@flags, "healing_try") and !%iskey(@affs, "anorexia"), 1, 0)</var>
|
checking with echo's shows the variable is turning to 0/1 true enough by changing the keys, but the button still isn't showing the change |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Tue Mar 03, 2009 6:50 pm |
Therein lies the problem. The button is only updated when the value of candrink changes, and the value of candrink is "%if( %iskey(@auto, "health") and %iskey(@auto, "mana") and !%iskey(@lostbals, "healing") and !%iskey(@flags, "healing_try") and !%iskey(@affs, "anorexia"), 1, 0)", and never changes. It doesn't nest calls like this. I suggest you either create a variable that contains a plain 0 or 1 to store the value of your candrink status, and update it every time you change one of the values that matters to it, or you put that code - %if( %iskey(@auto, "health") and %iskey(@auto, "mana") and !%iskey(@lostbals, "healing") and !%iskey(@flags, "healing_try") and !%iskey(@affs, "anorexia"), 1, 0) straight into the button. That will mean lots of calls, though, because it'll look for updates every time any of those variables changes, even if none of the keys it's looking for are different.
|
|
|
|
VeldrinCrescent Newbie
Joined: 29 Nov 2005 Posts: 9
|
Posted: Tue Mar 03, 2009 7:08 pm |
Thanks for the clarification. I'll see if I can get what I want in some other way then. Perhaps setting an additional variable to be equal to the first one on each prompt or something, hrm.
|
|
|
|
|
|
|
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
|
|