I am trying to add HUD buttons to an existing Dragon Hud to control effects that i added to the AV (such as a new particle breath). The effect works when actuated by a gesture based trigger, but i would like to be able to customize further via the HUD. I have at the moment tried this:
For the HUD button:
integer channel = 51;
integer STB = FALSE;
string text;
default
{
touch_start(integer total_number)
{
if(STB == TRUE)
{
llSay(channel,"/BREATHSTART"
;llSetColor(<1,1,1>,ALL_SIDES);
text = "FireBreath On";
llSetText(text,<1,1,1>,1);
STB = FALSE;
}
else if(STB == FALSE)
{
llSay(channel,"/BREATHSTOP"
;llSetColor(<1,0,0>,ALL_SIDES);
text = "FireBreath Off";
llSetText(text,<1,1,1>,1);
STB = TRUE;
}
}
link_message(integer sender,integer num,string msg,key id)
{
if(msg == "HIDE"

{
llSetAlpha(0,ALL_SIDES);
llSetText("",<1,1,1>,1);
state hidden;
}
}
}
state hidden
{
link_message(integer sender,integer num,string msg,key id)
{
if(msg == "SHOW"

{
llSetAlpha(1,ALL_SIDES);
llSetText(text,<1,1,1>,1);
state default;
}
}
}
For the prim i have added to the AV's head to emit the particle effect:
ParticleStart()
{
llParticleSystem([
PSYS_PART_FLAGS, 307,
PSYS_SRC_PATTERN, 8,
PSYS_PART_START_ALPHA, 1.00,
PSYS_PART_END_ALPHA, 0.00,
PSYS_PART_START_COLOR, <1.00,0.00,1.00>,
PSYS_PART_END_COLOR, <1.00,1.00,0.00>,
PSYS_PART_START_SCALE, <0.05,0.05,0.00>,
PSYS_PART_END_SCALE, <10.00,10.00,0.00>,
PSYS_PART_MAX_AGE, 2.30,
PSYS_SRC_MAX_AGE, 0.00,
PSYS_SRC_ACCEL, <0.00,0.00,0.00>,
PSYS_SRC_ANGLE_BEGIN, 0.00,
PSYS_SRC_ANGLE_END, 0.07,
PSYS_SRC_BURST_PART_COUNT, 10,
PSYS_SRC_BURST_RADIUS, 0.10,
PSYS_SRC_BURST_RATE, 0.05,
PSYS_SRC_BURST_SPEED_MIN, 1.15,
PSYS_SRC_BURST_SPEED_MAX, 10.00,
PSYS_SRC_OMEGA, <0.00,0.00,0.00>,
PSYS_SRC_TEXTURE, "a96ecd50-96e1-28b4-51ec-96b3112210c0"
]);
}
ParticleStop()
{
llParticleSystem([]);
}
//*****************************************************************************
default
{
state_entry()
{
llListen( 51, "", "", "" );
}
listen( integer channel, string name, key id, string message )
{
if( message == "BREATHSTART" )
{
if (llGetOwnerKey(id) == llGetOwner())
ParticleStart();
}
else if( message == "BREATHSTOP" )
{
if (llGetOwnerKey(id) == llGetOwner())
ParticleStop();
}
}
}
It's my 1st try at a HUD command so lord knows what i'm off on
, the basic approach on the button code was modified from an LCK open source HUD. The dragon HUD is a Daryth made wyrmling HUD if that is helpful to know.