|
thegto Beginner
Joined: 12 Jun 2007 Posts: 20
|
Posted: Sat Jun 21, 2008 4:15 am
(solved) How to make toggle button ? |
It looks like this Picture such as "tell window"
and then if I got message
> You are poisoned!
Then I'd like to show word Poisoned and red color in the new window
and then if I cure myself
> You are cleaned!
I'd like to show word Poisoned in the green color
is it possible to write something like this ?
I don't know what command how to write this scripts, If somebody could give some example, it'd be nice.
Thank you in advance.
Edit..
Change topic from how to make new window to how to make toggle button :P |
|
Last edited by thegto on Sun Jun 22, 2008 8:31 am; edited 1 time in total |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Sat Jun 21, 2008 11:08 am |
Might be better to do this with a toggle button, which has two parts - one red and one green - and is controlled by a variable, @Poisoned, which you set using triggers to 1 or 0 depending on whether or not you're poisoned. You could do it with a window, but it'd be more difficult. You could perhaps use the status window, too - check out the help files on that.
|
|
|
|
thegto Beginner
Joined: 12 Jun 2007 Posts: 20
|
Posted: Sat Jun 21, 2008 2:11 pm |
Thank you Fang Xianfu for your reply
if it's too difficult I will give up then
Here I try to make toggle button
Code: |
#CLASS My status
#BUTTON 49 {Poisoned} {cast cure poison} {NO-Poison} {} {} {1} {} {} {} {} {} {} {} {12} {} {} {11} "" {Explore|Inset|Stack|Top} {Tool tip} {} {2}
#TRIGGER {^You are poisoned!$} {What does command to tell button that I was poisoned ?}
#IF (Your body is cleansed.) {If success, what does the command to tell button that I am NO-poison ?} {If fail, What does the command to tell button that I am still poisoned ?}
#CLASS 0 |
I remember there is some example but I couldn't find it today
as you said "triggers to 1 or 0" .. I don't know to make it works ? where should I put 1 or 0 ? |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Sat Jun 21, 2008 6:43 pm |
Dear lord, don't use the #button command to create buttons. It's horrific. Use the GUI.
Unfortunately I can't remember how you make buttons with more than one state with zMUD's GUI, so someone's going to have to help you out there. Perhaps the help knows, but I sure don't.
So yeah, anyway. There's a box on the UI somewhere for putting a variable into that will control which state the button is set to (0 or 1). So, you stick a variable (@Poisoned, say) and stick it in there. Any time you want to change the button, you change the value of @Poisoned to the number of the right state - 0 or 1. You do that simply with
Poisoned=0
or
Poisoned=1
and the button should magically change all on its own. |
|
|
|
thegto Beginner
Joined: 12 Jun 2007 Posts: 20
|
Posted: Sat Jun 21, 2008 7:50 pm |
I created this button from New>New Button and then I export button script
Code: |
#BUTTON 49 {Poisoned} {cast cure poison} {NO-Poison} {} {} {1} {} {} {} {} {} {} {} {12} {} {} {11} "" {Explore|Inset|Stack|Top} {Tool tip} {} {2} |
I don't know how to toggle button when I received pattern
> You are poisoned!
Show red button
or
> You failed to remove poison!
try to remove poison but failed by using cast 'cure poison'
or
> You are cleaned!
show green button if I have cured.
and also I don't know where to put
Poisoned=0
or
Poisoned=1
here what I'm setting this button
Pic1
Pic2
Pic3
Pic4
sorry for newbie question |
|
|
|
charneus Wizard
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Sat Jun 21, 2008 9:35 pm |
Easiest way to do that:
1. Make a new button.
2. Change "kind" to "Toggle."
3. Caption should probably read "Poison."
4. Choose your colors for not poisoned (I chose green as the background, white as the foreground).
5. Change "State" to "Button Down."
6. Caption again should probably be "Poison."
7. Choose your colors for being poisoned (I chose red as the background, white as the foreground).
8. Click on the "Advanced" tab.
9. In the "Variable" field, put "@poison" (without quotes).
10. Create the following triggers:
Code: |
#TRIGGER {You are poisoned!} {poison=1}
#TRIGGER {You are cleaned!} {poison=0}
#TRIGGER {You fail to remove poison!} {c 'cure poison'} |
There you have it. Of course, move it to where you want it to be.
Charneus |
|
|
|
thegto Beginner
Joined: 12 Jun 2007 Posts: 20
|
Posted: Sun Jun 22, 2008 8:29 am |
Yay! thank you very much Charneus
it works now, whoohoo!! |
|
|
|
|
|