erm.... I was making buttons and then realized.... There HAS to be a more organized way to do this! I've been up for around 60hrs so I cant even understand it anymore, but maybe the expertise of the forums could help me clear the coding up and maybe find a better way to do this. I made the hover, select, and normal icons work but i dont wont them all to be selectable at once. Well here is my coding... (copy & paste strait from DM)
----------Thanks for your time!!!--------------------------
-----------------------------------------------------------
var
attackselected = 0
guardselected = 0
magicselected = 0
fleeselected = 0
rangeselected = 0
obj
//-------------------------------------------------------------------------------
attackbutton
icon_state = "attack"
MouseEntered()
if(attackselected == 1)
icon_state = "attack highlight"
if(attackselected == 0)
icon_state = "attack hover"
MouseDown()
if(attackselected == 0)
icon_state = "attack highlight"
attackselected = 1
return..()
if(attackselected == 1)
icon_state = "attack"
attackselected = 0
return..()
MouseExited()
if(attackselected == 1)
icon_state = "attack highlight"
if(attackselected == 0)
icon_state = "attack"
//-----------------------------------------------------------------------------
guardbutton
icon_state = "guard"
MouseEntered()
if(guardselected == 1)
icon_state = "guard highlight"
if(guardselected == 0)
icon_state = "guard hover"
MouseDown()
if(guardselected == 0)
icon_state = "guard highlight"
guardselected = 1
return..()
if(guardselected == 1)
icon_state = "guard"
guardselected = 0
return..()
MouseExited()
if(guardselected == 1)
icon_state = "guard highlight"
if(guardselected == 0)
icon_state = "guard"
//-----------------------------------------------------------------------------
magicbutton
icon_state = "magic"
MouseEntered()
if(magicselected == 1)
icon_state = "magic highlight"
if(magicselected == 0)
icon_state = "magic hover"
MouseDown()
if(magicselected == 0)
icon_state = "magic highlight"
magicselected = 1
return..()
if(magicselected == 1)
icon_state = "magic"
magicselected = 0
return..()
MouseExited()
if(magicselected == 1)
icon_state = "magic highlight"
if(magicselected == 0)
icon_state = "magic"
//-----------------------------------------------------------------------------
fleebutton
icon_state = "flee"
MouseEntered()
if(fleeselected == 1)
icon_state = "flee highlight"
if(fleeselected == 0)
icon_state = "flee hover"
MouseDown()
if(fleeselected == 0)
icon_state = "flee highlight"
fleeselected = 1
return..()
if(fleeselected == 1)
icon_state = "flee"
fleeselected = 0
return..()
MouseExited()
if(fleeselected == 1)
icon_state = "flee highlight"
if(fleeselected == 0)
icon_state = "flee"
//----------------------------------------------------------------------------
rangebutton
icon_state = "range"
MouseEntered()
if(rangeselected == 1)
icon_state = "range highlight"
if(rangeselected == 0)
icon_state = "range hover"
MouseDown()
if(rangeselected == 0)
icon_state = "range highlight"
rangeselected = 1
return..()
if(rangeselected == 1)
icon_state = "range"
rangeselected = 0
return..()
MouseExited()
if(rangeselected == 1)
icon_state = "range highlight"
if(rangeselected == 0)
icon_state = "range"
//----------------------------------------------------------------------------
icon = 'Buttons.dmi'
ID:148054
Jul 26 2003, 9:51 am
|
|
Jul 26 2003, 6:47 pm
|
|
The only way I know of to do this is with flag variables. You could make a new var/IsDoingTooManyThingsAtOnce and check if it's greater than 0. If it is don't let them use the button, and if it isn't set it to 1 and then let them continue. Just don't forget to set it back to 0 when they are done using that button. As always, this may not be the best way(Have to add that so I don't get in trouble if I'm wrong :)).
|