|
Wrens Novice
Joined: 01 Jun 2003 Posts: 32 Location: USA
|
Posted: Wed Feb 07, 2007 12:33 am
What is the difference in button behavior in CMUD |
In ZMud someone wrote some scripts to handle a compass, and the various position and status buttons. In the case of the compass, it would use the GSL(j) to change the enable states for a button, giving you a red arrow a direction in the room, and a different arrow (disabled) for non directions.
Lets start with the GSL trigger
Code: |
%gsl( j) {showexits %2} |
This works fine, and sends the string to the alias.
The alias
Code: |
#call %btnenable(btnnw,%ismember(nw,%1))
#call %btnenable(btnn,%ismember(n,%1))
#call %btnenable(btnne,%ismember(ne,%1))
#call %btnenable(btnw,%ismember(w,%1))
#call %btnenable(btne,%ismember(e,%1))
#call %btnenable(btnsw,%ismember(sw,%1))
#call %btnenable(btns,%ismember(s,%1))
#call %btnenable(btnse,%ismember(se,%1))
#call %btnenable(btnd,%ismember(d,%1))
#call %btnenable(btnu,%ismember(u,%1))
#call %btnenable(btnout,%ismember(out,%1)) |
I did notice that the behavior of %ismemeber was changed...returns the item number. I modified the above to use
Code: |
#call %btnenable(btnne, %if(%ismember(ne,%1) >0, True, false)) |
Didn't work.
I have noticed that if all the buttons are enabled (showing the red arrows) when I log on, it turns off all the directions except for the proper ones for the room(leaving that direction arrow red), but moving from room to room eventually turns off all the buttons. I check to see the enabled status of the button, and this seems to happen correctly, but the image of the red arrow never comes back.
I have read that the way buttons behave has been changed. So maybe someone more knowlegable than me can explain, and get me back on the track so the compass works.
The position and status buttons are pretty much the same but use the GSL(P) string, and set the button image. I think the reason I am not getting the images is not having them in the right directory.
The code for that is.
Code: |
pos = %trim( %gsl( P))
#IF (@pos = @cpos) {#ABORT 1}
#IF (%pos( N, @pos)>0 AND %pos( D, @pos)>0) {#NOOP %btnimage( hidden, "invhide.bmp")} {#IF %pos( D, @pos)>0) {#NOOP %btnimage( hidden, "inv.bmp")} {#IF (%pos( N, @pos)>0) {#NOOP %btnimage( hidden, "hidden.bmp")} {#NOOP %btnimage( hidden, "blank.bmp")}}}
#IF (%pos( P, @pos)>0) {#NOOP %btnimage( joined, "join.bmp")} {#NOOP %btnimage( joined, "blank.bmp")}
#IF (%pos( M, @pos)>0) {#NOOP %btnimage( unconscious, "unc.bmp")} {#NOOP %btnimage( unconscious, "blank.bmp")}
#IF (%pos( I, @pos)>0) {#NOOP %btnimage( stunned, "stun.bmp")} {#NOOP %btnimage( stunned, "blank.bmp")}
#IF (%pos( C, @pos)>0) {#NOOP %btnimage( webbed, "web.bmp")} {#NOOP %btnimage( webbed, "blank.bmp")}
#IF (%pos( B, @pos)>0) {#NOOP %btnimage( dead, "dead.bmp")} {#NOOP %btnimage( dead, "blank.bmp")}
#IF (%pos( GH, @pos)>0) {#NOOP %btnimage( position, "kneel.bmp")} {#IF (%pos( G, @pos)>0) {#NOOP %btnimage( position, "lie.bmp")} {#IF (%pos( H, @pos)>0) {#NOOP %btnimage( position, "sit.bmp")} {#NOOP %btnimage( position, "stand.bmp")}}}
#IF (%pos( O, @pos)>0) {#NOOP %btnimage( bleeder, "bleeding.bmp")} {#NOOP %btnimage( bleeder, "blank.bmp")}
cpos = @pos
myprompt |
yes, long and complicated. The myprompt at the end works giving me the old wizard prompt, with the status messages. The code for this follows and you will have to set your simtronics options for the MUD prompt to myprompt>
Code: |
#IF (%pos( P, @cpos)>0) {Joined = "J"} {Joined = ""}
#IF (%pos( M, @cpos)>0) {#VAR uncon U} {#VAR uncon ""}
#IF (%pos( I, @cpos)>0) {#VAR stun S} {#VAR Stun ""}
#IF (%pos( D, @cpos)>0) {#VAR inv I} {#VAR inv ""}
#IF (%pos( N, @cpos)>0) {hid = "H"} {hid = ""}
#IF (%pos( C, @cpos)>0) {#VAR web W} {#VAR web ""}
#IF (%pos( B, @cpos)>0) {#VAR dead "[DEAD]"} {#VAR dead ""}
#IF (%pos( G, @cpos)>0 and %pos( H, cpos)>0) {#VAR kneel K} {#VAR kneel ""}
#IF (%pos( G, @cpos)>0 and %pos( H, cpos)=0) {#VAR Lie P} {#VAR lie ""}
#IF (%pos( G, @cpos)=0 and %pos( H, cpos)>0) {#VAR sit s} {#VAR sit ""}
#IF (%pos( O, @cpos)>0) {#VAR bleeding "!"} {#VAR bleeding ""}
myprompt = %Trim( %concat( @dead, @bleeding, @hid, @invisible, @Kneel, @Lie, @standing, @sit, @stun)) |
Well, long post I hope someone can help me with breaking it down to simple terms.
Wrens[/img][/code] |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Wed Feb 07, 2007 12:47 am |
%btnenable is bugged, it'll only let you do one, either disable or enable. I forget which.
%ismember always returned the item number. It doesn't matter in %if and it shouldn't matter in %btnenable really. Perhaps a feature to request.
Custom images on buttons are only supported currently if the ENTIRE directory including the drive letter is included. |
|
|
|
Wrens Novice
Joined: 01 Jun 2003 Posts: 32 Location: USA
|
Posted: Wed Feb 07, 2007 12:59 am |
Thanks for the reply. My guess it is the button enable. I will try the full path for the image and see what happens. Oh, and I tried a few positions while in the game with CMud for that prompt above. Hidden works giving me H>. and Lie P>. However, if I kneel, I get P>, and sit nothing at all. I have not tried dead yet. or stunned, bleeding... kind of leary of being in dangerous situations with CMud right now.
Thanks Wrens |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Wed Feb 07, 2007 1:34 am |
For one thing, do you use those variables for anything else? If not, you can convert them to local variables. Just use $kneel=K and then refer to $kneel at the end instead.
Also, did you mean for the var @inv to be set by this, but the variable @invisible to be referenced at the end?
The problem here took me AAAAAAAAGES to find and it's ridiculously simple! The three "prone-state" if statements have two %pos calls in their expression, but the second one for each looks in the literal string cpos rather than @cpos. Just add the @ and it'll work fine. Also, the #if will return true on any value greater than 0, so you don't need the >0s, you can just use:
Code: |
#IF (%pos( P, @cpos)) {Joined = "J"} {Joined = ""}
#IF (%pos( M, @cpos)) {#VAR uncon U} {#VAR uncon ""}
#IF (%pos( I, @cpos)) {#VAR stun S} {#VAR Stun ""}
#IF (%pos( D, @cpos)) {#VAR inv I} {#VAR inv ""}
#IF (%pos( N, @cpos)) {hid = "H"} {hid = ""}
#IF (%pos( C, @cpos)) {#VAR web W} {#VAR web ""}
#IF (%pos( B, @cpos)) {#VAR dead "[DEAD]"} {#VAR dead ""}
#IF (%pos( G, @cpos) and %pos( H, @cpos)) {#VAR kneel K} {#VAR kneel ""}
#IF (%pos( G, @cpos) and !%pos( H, @cpos)) {#VAR Lie P} {#VAR lie ""}
#IF (!%pos( G, @cpos) and %pos( H, @cpos)) {#VAR sit s} {#VAR sit ""}
#IF (%pos( O, @cpos)) {#VAR bleeding "!"} {#VAR bleeding ""}
myprompt = %Trim( %concat( @dead, @bleeding, @hid, @invisible, @Kneel, @Lie, @standing, @sit, @stun)) |
Here's a version that uses local vars:
Code: |
#local $Joined $uncon $stun $inv $hid $web $dead $kneel $Lie $sit $bleeding
#IF (%pos( P, @cpos)) {$Joined = "J"}
#IF (%pos( M, @cpos)) {$uncon=U}
#IF (%pos( I, @cpos)) {$stun=S}
#IF (%pos( D, @cpos)) {$inv=I}
#IF (%pos( N, @cpos)) {$hid=H}
#IF (%pos( C, @cpos)) {$web=W}
#IF (%pos( B, @cpos)) {$dead="[DEAD]"}
#IF (%pos( G, @cpos) and %pos( H, @cpos)) {$kneel=K}
#IF (%pos( G, @cpos) and !%pos( H, @cpos)) {$Lie=P}
#IF (!%pos( G, @cpos) and %pos( H, @cpos)) {$sit=s}
#IF (%pos( O, @cpos)) {$bleeding="!"}
myprompt = %Trim( %concat( $dead, $bleeding, $hid, $inv, $Kneel, $Lie, $standing, $sit, $stun)) |
I've assumed in this one that you meant $inv in the myprompt rather than $invisible. |
|
|
|
Wrens Novice
Joined: 01 Jun 2003 Posts: 32 Location: USA
|
Posted: Thu Feb 08, 2007 12:13 am |
Thanks, works wonderfully. Yes, I wanted it to be inv. I had to add another varibile in the #local statement $standing. Never knew you could do local varibles. That will change some thinking on other things I am doing.
Thanks again
Wrens |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Thu Feb 08, 2007 2:02 am |
They're one of the new features in CMUD, they're erased after the script that defines them finishes - that means that localvars defined inside #if statements won't exist outside them though, so be careful.
Also, none of those #ifs set a variable called $standing so you can probably just delete it from the %concat at the end. |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Thu Feb 08, 2007 10:47 pm |
Regarding the %btnenable() thing, you can re-enable the button via #T+. I'm not sure if that command works with button numbers, so you'll want to name all your buttons.
|
|
_________________ EDIT: I didn't like my old signature |
|
|
|
Wrens Novice
Joined: 01 Jun 2003 Posts: 32 Location: USA
|
Posted: Fri Feb 09, 2007 12:25 am |
Tried that button enable #t+, can turn them on and off that way... Seems the position of the button goes away too. Same thing happens with the %btnenable command.
I got the %btimage working with putting the complete path in. However, the images seem to display differently for each button. Yes, even with setting the size, margin, etc all the same. I know in ZMud you could have a button without a caption (name on the button). I've tried everything, I can't get rid of the name on the button. Another bug? All I need is the image on the button, the button the size of the image. Works well in Zmud, Don't seem to work at all in CMud. |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Fri Feb 09, 2007 12:42 am |
Yes, I think that bug was reported a while ago - if the button has an ID but no name, it'll display the ID as the name instead. Quite annoying if you just want a picture.
|
|
|
|
tomcat025 Wanderer
Joined: 30 Dec 2001 Posts: 66 Location: USA
|
Posted: Fri Feb 09, 2007 2:04 am |
Has anyone gotten a working compass package yet? I am not as concerned about the positions although that would be usefull as well.
If anyone has a working package could you publish it? |
|
_________________ You can pick your nose. You can pick your friends... but you can't pick your friends nose.
~Arwin Hochhauser |
|
|
|
Arminas Wizard
Joined: 11 Jul 2002 Posts: 1265 Location: USA
|
Posted: Fri Feb 09, 2007 2:31 am |
%btnenable works with the priority number.
And because of the priority number you can have multiple buttons with "" for the name and a blank ID
As for them losing their positions. You can turn off Auto Position and enter the values manually. That way they do not move if one disappears. |
|
_________________ Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram |
|
|
|
Wrens Novice
Joined: 01 Jun 2003 Posts: 32 Location: USA
|
Posted: Fri Feb 09, 2007 7:49 pm |
I have the autoposition turned off. When the button is disabled, it goes away all together rahter than leave something there for position. In Zmud, it would leave a nice little faded out arrow. That is why I started this topic with changes in the behavior of buttons. I really think there have been changes.
As for a package, I am putting most of this into a Dragonrealms.pkg. I have the thought window, arrival and departures, and deaths windows working. Just a little trouble with keeping the layout right. Everytime I think I have it licked strange things happen...I wind up with two windows for each, one tabbed and one positioned. Delete the tabbed one or the positioned one, and the triggers start crashing.
Wrens |
|
|
|
Arminas Wizard
Joined: 11 Jul 2002 Posts: 1265 Location: USA
|
Posted: Fri Feb 09, 2007 9:34 pm |
I just started up Zmud 7.21 and disabled/enabled some buttons and they also vanished when disabled. Are you able to open a copy of zmud and cmud side by side and look at the settings?
BTW converting a .mud file to a pkg file does not destroy the .mud file. |
|
_________________ Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Fri Feb 09, 2007 10:41 pm |
Also, you could make a greyed-out graphic yourself and change it manually. So:
#alias northon {#call %btnimage(north,"on-image");#var ButtonNorth 1}
#alias northoff {#call %btnimage(north,"off-image");#var ButtonNorth 0}
then have the button script check @ButtonNorth before it sends the command. |
|
|
|
Wrens Novice
Joined: 01 Jun 2003 Posts: 32 Location: USA
|
Posted: Tue Feb 13, 2007 2:46 am |
I've thought of making it image buttons, and just flopping the images with the directions. I've had so much trouble getting the images to display right on my status buttons. Stand etc.. I don't think that would work very well. I have exactly the same code in ZMud for this compass as I have for CMud. I've even compared the buttons in each. The compass works wonderfully in ZMud. And, eventually I wind up with nothing in CMud. Buttons gone for every direction.
Which I guess brings me back to the original topic of this discussion. Are there changes in the behaviors of buttons, when displaying images? Enabled/disabled?
Thank you in advance |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Tue Feb 13, 2007 3:40 am |
And I'll repeat what I said right at the start of the thread :)
Fang Xianfu wrote: |
%btnenable is bugged, it'll only let you do one, either disable or enable. I forget which.
%ismember always returned the item number. It doesn't matter in %if and it shouldn't matter in %btnenable really. Perhaps a feature to request.
Custom images on buttons are only supported currently if the ENTIRE directory including the drive letter is included. |
Because btnenable is bugged, it'll only let you turn off your buttons. Your script is TRYING to turn them back on, but it can't - so yes, eventually all your buttons have been disabled. |
|
|
|
Wrens Novice
Joined: 01 Jun 2003 Posts: 32 Location: USA
|
Posted: Tue Feb 13, 2007 5:47 am |
I am sorry There is a misunderstanding here for which I am mostly responsible. I really should have paid more attention in english class. It makes communicating effectively hard. To make it even worse, I brought to this thred several issues. Just trying to find answers.
One of them has been solved, and quite well. The dragonrealms prompt displays my all the various status items. Thanks
One of them, won't get answered cause it is bugged. I will just have to wait on getting that compass to work the way it did in ZMud.
Putting the path into the command to display the various bitmaps on the buttons, worked wonderfully. They change as expected.
It brought up another issue. Now that I can get them displayed, I've noticed two things. One, I can't get them centered consistantly. Each button displays differntly with the same settings. The button preview in the package editor doesn't even look like the product on the bar with I save it.
And, Two, I can't get rid of the caption on the button. I've removed the text from the name field. And, put it in the Id field. This is how you did a captionless button in Zmud. But, it keeps coming back. I think the caption is partly responsible for the images not working right. Also, it is a little visually unpleasant to see just a little speck of word on the button. I am anal rententive and like to see things spotless.
Please be patient with me. I am trying hard to relate visual issues in a verbal medium. It seems I am failing miserably.
|
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Tue Feb 13, 2007 7:42 am |
The two problems sound linked - because the caption is still being displayed and is presumably different for each button, it'll move the image by a different amount.
The caption thing is another bug - if a button has no name, its ID is displayed on the button instead. It shouldn't be doing that. |
|
|
|
Arminas Wizard
Joined: 11 Jul 2002 Posts: 1265 Location: USA
|
Posted: Tue Feb 13, 2007 2:36 pm |
If you want a button with NO text displayed NAME the button "" and do not use an ID. This gives you a blank button. THEN try putting on your image.
If you want to be able to actually Enable AND Disable a button use the button PRIORITY number with %btnenable. Yes it is bugged but in THIS instance it works properly. |
|
_________________ Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram |
|
|
|
Wrens Novice
Joined: 01 Jun 2003 Posts: 32 Location: USA
|
Posted: Thu Feb 15, 2007 12:37 am |
I tried getting rid of the name and the Id, button priority of 5 to solve the caption thing. Now I need to play button button who has the button. It disappeared from the package. Thanks for the suggestion. Are we really sure this is out of beta? Sorry, Zugg, I know this is very hard work.
Wrens |
|
|
|
Wrens Novice
Joined: 01 Jun 2003 Posts: 32 Location: USA
|
Posted: Thu Feb 15, 2007 1:20 am |
Doh, someone made a suggestion to publish it to the package library, then everyone that is interested can put hands on. I have managed through the trials and tribulations of a true CMud beginner to post it.
Wrens |
|
|
|
|
|
|
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
|
|