From: Vance Adder
You might post your code here if you can and see if we can suggest changes. It sounds like there are multiple things you are wanting to do.
I don't have any scripts for a hud camera control. I want to add a button to my existing hud that will turn the active camera on and off.
This is the active camera line in the main vehicle script I want to control:
llSetCameraParams([
CAMERA_ACTIVE, 1, // 1 is active, 0 is inactive
--------------------------------------------------------------------------------------------------------
This is the code for the exhaust smoke that works with sit and unsit presently. I added the smoke to my bike and now want to also control it with the hud button to turn if off and on as well as still work with sit/unsit:
default
{
state_entry()
{
//updateParticles();
keystate = 0 ;
//target = llGetLinkKey(2) ;
//updateParticles() ;
//llParticleSystem([]) ;
//llSitTarget(<0.0, 0.0, 0.1>, ZERO_ROTATION);
llListen(11,"","","started");
}
link_message(integer sender_num, integer num, string str, key id){
if(str == "SMOKEON"){
updateParticles();
}
if(str == "SMOKEOFF"){
llParticleSystem([]);
}
}
}
//// this goes in the seat
// changed(integer change){
// if(change == CHANGED_LINK){
// if(llAvatarOnSitTarget() != NULL_KEY){
// llMessageLinked(LINK_SET, 0, "SMOKEON", NULL_KEY);
// }else{
// llMessageLinked(LINK_SET, 0, "SMOKEOFF", NULL_KEY);
// }
// }
// }
--------------------------------------------------------------------------------------------------------
This is the code in the hud start stop button. This starts and stops the bike motor regardless if you are sitting or not. I want this to control the exhaust smoke as well as be controlled by sit/unsit:
key stop="e63c2f40-11cb-407e-9f04-247717bd49fd";
key start="be8840c4-1924-4a56-adf6-31e7f3a2a68b";
integer started=TRUE;
default
{
state_entry()
{
llSetTexture(stop,ALL_SIDES);
started=TRUE;
llListen(11,"","","started");
}
touch_start(integer total_number)
{
if (started){llWhisper(4,"stop");started=FALSE;llSetTexture(start,ALL_SIDES);}
else {llWhisper(4,"start");started=TRUE;llSetTexture(stop,ALL_SIDES);}
}
listen(integer ch, string name, key id, string msg)
{
if (llGetOwnerKey(id) != llGetOwner()) return;
started=TRUE;llSetTexture(stop,ALL_SIDES);
}
}
--------------------------------------------------------------------------------------------------------
This is the code for burn out, presently controlled by the hud button. This controls the burn out smoke for the back tire and is working. I need the tire rotation texture to work with the hud button as well as by the bike velocity:
default
{
on_rez(integer start_param)
{
llResetScript();
}
state_entry()
{
llListen(3,"",NULL_KEY,"");
llSetTimerEvent(0.0);
llStopSound();
}
listen(integer channel, string name, key id, string message)
{
if(message == "off")
{
llSetTimerEvent(0.0);
llStopSound();
llParticleSystem([]);
} else if(message == "on")
{
llSetTimerEvent(0.1);
}
}
timer()
{
llParticleSystem([
PSYS_PART_FLAGS,
//PSYS_PART_BOUNCE_MASK |
PSYS_PART_INTERP_SCALE_MASK |
PSYS_PART_INTERP_COLOR_MASK,
//PSYS_PART_WIND_MASK,
PSYS_PART_MAX_AGE, 2.0,
PSYS_PART_START_SCALE, <1.1, 1.1, 0.0>,
PSYS_PART_END_SCALE, <0.1, 0.1, 0.1>,
PSYS_PART_START_COLOR, <1,1,1>,
PSYS_PART_END_COLOR, <1,1,1>,
PSYS_PART_START_ALPHA, 1.0,
PSYS_PART_END_ALPHA, 0.0,
PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_ANGLE_CONE,
PSYS_SRC_TEXTURE, "d1df5743-efa9-8fab-0d2f-8c206931299b",
PSYS_SRC_INNERANGLE, 0.0,
PSYS_SRC_OUTERANGLE, 0.3,
PSYS_SRC_BURST_RADIUS, 0.2,
PSYS_SRC_BURST_PART_COUNT, 300,
PSYS_SRC_BURST_RATE, 0.04,
PSYS_SRC_MAX_AGE, 0.5,
PSYS_SRC_ACCEL, <0,0,0.0>,
PSYS_SRC_BURST_SPEED_MAX, 8.0,
PSYS_SRC_BURST_SPEED_MAX, 0.0
]);
llLoopSound("burnout Slayer",1.0);//0.0 with no sound - 1.0 max Sound
}
}
--------------------------------------------------------------------------------------------------------
This is the code for the burn out button on the hud. This script presently works for the burnout smoke. I need it to work with the tire rotation texture as well. This script has references to light, but works with the burn out script in the tire.
integer menu_handler;
integer menu_channel;
integer light = FALSE;
setLight() {
if (light) {
llWhisper(3,"on");
//llSay(0,"is ON");
}
else
{
llWhisper(3,"off");
//llSay(0,"is OFF");
}
}
default
{
state_entry()
{
setLight();
}
on_rez(integer start)
{
llResetScript();
}
touch_start(integer total_number)
{
light = !light;
setLight();
}
}
--------------------------------------------------------------------------------------------------------
This is the code for the tire texture rotation. It is controlled by the velocity of the bike. I want it to also be controlled on and off with the hud button.
default
{
state_entry()
{
llSetTimerEvent(0.20);
}
timer()
{
vector vel = llGetVel();
float speed = llVecMag(vel);
//speed = 0.2; //uncoment this to see the rotation stationary to check it's right
if(speed > 0)
{
llSetTextureAnim(ANIM_ON | SMOOTH | LOOP, ALL_SIDES, 0, 0, 0, 1, speed*-6.5);
}
else
{
llSetTextureAnim(ANIM_ON | SMOOTH | LOOP | REVERSE, 0, 0, 0, 0, 1, speed*-6.5);
}
}
}
I hope I supplied enought code to work with. I cannot post the main script here because it was purchased for building and is not to be destributed freely.