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
derekconlon
Newbie


Joined: 25 Nov 2015
Posts: 8

PostPosted: Wed Nov 25, 2015 8:00 pm   

Button Questions: Remove Self, Variable Captions?
 
Can buttons remove themselves without having a error?

Here is what I am trying to do:

I type "group" and it shows me my group and their health.

I want buttons to be created for the group members with low health that I can then click to heal them.

The command I'm trying out to create the buttons (that will be fired by a trigger that triggers when the member is low on health) is:

#BU 0 {HEALED} {heal test;#UNB test} {character} {} {1} {toheal1} {} {} {} {} {} {} {} {} {} {Push} {-1} {} {} {} {test} {2}

This command creates the button successfully.
When I click the button, it sends the "heal test" successfully, and deletes itself successfully, but it gives an:

Access violation at address 00DDF4E7 in module 'cMUD.exe'
Read of address 00000000.

I can click continue application and the program doesn't crash but I don't want to have to do that every time i use these buttons.

If a button cannot delete itself, then is it possible for the caption of a button to be changed by a #call command or anything?

I need a way for these buttons to dynamically update themselves as I type "group" or, to go away if i click them.

I have thought of some other solutions but they aren't as good as this one.

Thanks,
Derek Conlon
Reply with quote
Daern
Sorcerer


Joined: 15 Apr 2011
Posts: 809

PostPosted: Thu Nov 26, 2015 12:56 am   
 
Creating and removing any settings (not just buttons) adds a large performance overhead to your script. The recommended method to hide buttons when they're not needed would be to enable and disable them with the #T+ and #T- commands.

As for the caption, there probably is a way to modify it directly by script, but I'd suggest just setting the caption to a variable, then update that whenever you want the text on the button to change.
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4691
Location: Pensacola, FL, USA

PostPosted: Thu Nov 26, 2015 4:50 am   
 
You will likely need to change the caption via the GUI for the caption to not evaluate the variable instead of be the variable.
_________________
Discord: Shalimarwildcat
Reply with quote
coloradoderek
Beginner


Joined: 07 Jan 2014
Posts: 18

PostPosted: Sat Nov 28, 2015 5:15 pm   
 
I tried setting the caption to , for example, @player1

But it just shows "@player1" as the caption. How do I get it to evaluate the variable and show the variables value, rather than just verbatim what I type in the caption box.

-T and +T is something I thought of but since I couldn't get the Caption to change to the players name, I couldn't use that. Those will only work for me if the caption can also be changed by the script, which I haven't had success at achieving yet.

Thanks for the assistance!!
Derek Conlon
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4691
Location: Pensacola, FL, USA

PostPosted: Sat Nov 28, 2015 5:50 pm   
 
You can set an ID via the GUI as well.
The caption is just the default ID if no ID is set.

For the life of me I cannot get any button to display "@player1" verbatim instead of evaluating it, unless i set the caption to "~@player1".
You won't see the evaluated form inside the GUI, you will see it on the actual button.

Right clicking any user defined button will open it in the GUI.
_________________
Discord: Shalimarwildcat
Reply with quote
coloradoderek
Beginner


Joined: 07 Jan 2014
Posts: 18

PostPosted: Sat Nov 28, 2015 6:19 pm   
 
Yeah.. you are correct.

I bet I was expecting it to evaluate in the GUI and never even checked the button because it's sure doing exactly what you are saying.

Thank you.
I think all my questions have been solved on this thread now.

I feel stupid.. but at least I have my answers. That's all that matters in the end.

Derek Conlon
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