Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Combining 2 scripts - help please!

Itell Ninetails
Registered User
Join date: 15 Feb 2008
Posts: 3
11-27-2008 08:08
Hi, everyone,
I'd like to combine 2 scripts, and have tried, but it's not working, does anyone have an idea how to get these two to run together?

Script 1:

key id;

default
{
on_rez(integer start_param)
{
llResetScript();
}
state_entry()
{
id = llGetOwnerKey(llGetKey());
llRequestPermissions(id,PERMISSION_TRIGGER_ANIMATION);
}
run_time_permissions(integer permissions)
{
if (permissions == PERMISSION_TRIGGER_ANIMATION)
{
llStartAnimation(llGetInventoryName(INVENTORY_ANIMATION,0));
}
}
}


script 2:

// From the book:
//
// Scripting Recipes for Second Life
// by Jeff Heaton (Encog Dod in SL)
// ISBN: 160439000X
// Copyright 2007 by Heaton Research, Inc.
//
// This script may be freely copied and modified so long as this header
// remains unmodified.
//
// For more information about this book visit the following web site:
//
// http://www.heatonresearch.com/articles/series/22/


fakeMakeExplosion(integer particle_count, float particle_scale, float particle_speed,
float particle_lifetime, float source_cone, string source_texture_id,
vector local_offset)
{
//local_offset is ignored
llParticleSystem([
PSYS_PART_FLAGS, PSYS_PART_INTERP_COLOR_MASK|PSYS_PART_INTERP_SCALE_MASK|PSYS_PART_EMISSIVE_MASK|PSYS_PART_WIND_MASK,
PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_ANGLE_CONE,
PSYS_PART_START_COLOR, <1.0, 1.0, 1.0>,
PSYS_PART_END_COLOR, <1.0, 1.0, 1.0>,
PSYS_PART_START_ALPHA, 0.50,
PSYS_PART_END_ALPHA, 0.25,
PSYS_PART_START_SCALE, <particle_scale, particle_scale, 0.0>,
PSYS_PART_END_SCALE, <particle_scale * 2 + particle_lifetime, particle_scale * 2 + particle_lifetime, 0.0>,
PSYS_PART_MAX_AGE, particle_lifetime,
PSYS_SRC_ACCEL, <0.0, 0.0, 0.0>,
PSYS_SRC_TEXTURE, source_texture_id,
PSYS_SRC_BURST_RATE, 1.0,
PSYS_SRC_ANGLE_BEGIN, 0.0,
PSYS_SRC_ANGLE_END, source_cone * PI,
PSYS_SRC_BURST_PART_COUNT, particle_count / 2,
PSYS_SRC_BURST_RADIUS, 0.0,
PSYS_SRC_BURST_SPEED_MIN, particle_speed / 3,
PSYS_SRC_BURST_SPEED_MAX, particle_speed * 2/3,
PSYS_SRC_MAX_AGE, particle_lifetime / 2,
PSYS_SRC_OMEGA, <0.0, 0.0, 0.0>
]);
}

default
{
state_entry()
{
llPreloadSound("explosion";);
llSetText("Touch to Explode", <0.0, 1.0, 0.0>, 1.0);
}



touch_start(integer total_number)
{
fakeMakeExplosion(80, 1.0, 13.0, 2.2, 1.0, "fire", <0.0, 0.0, 0.0>;);
llTriggerSound("explosion", 10.0);
llSleep(.5);
fakeMakeExplosion(80, 1.0, 13.0, 2.2, 1.0, "smoke", <0.0, 0.0, 0.0>;);
llSleep(1);
llParticleSystem([]);
}
}

Any and all help is appreciated.

Thanks,
Itell
Yumi Murakami
DoIt!AttachTheEarOfACat!
Join date: 27 Sep 2005
Posts: 6,860
11-27-2008 08:54
What do you want the combined script to do? It seems you have a script that triggers a particle effect on touch, and another one that animates the owner on rez or reset. So do you really want a combined script which animates the owner on rez, then waits to be touched, and gives an explosion effect when touched? Fair enough if you do, it just seems a kinda odd combination to me. :)
Itell Ninetails
Registered User
Join date: 15 Feb 2008
Posts: 3
Combine 2 Scripts
11-27-2008 09:03
Thanks for your response. I see what you're saying.

I'd like the script to animate a person, then cause a sound and an explosion. For the second script, I'd like to remove the "touch" part and just have the explosion happen after the person is animated. Can that even be done?
Yumi Murakami
DoIt!AttachTheEarOfACat!
Join date: 27 Sep 2005
Posts: 6,860
11-27-2008 10:23
From: Itell Ninetails

I'd like the script to animate a person, then cause a sound and an explosion. For the second script, I'd like to remove the "touch" part and just have the explosion happen after the person is animated. Can that even be done?


That can only be done as long as you know which animation will be used. The script can't easily tell when the animation finishes, so it'll have to know how long the animation is.

Also, by "a person" do you mean "the owner" or "any person"?
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
11-27-2008 11:16
a script might not know when an animation is done (except by timed guesswork) but a gesture does....meaninga combination of a gesture and a particle script that takes a listen might be easier ;)
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Itell Ninetails
Registered User
Join date: 15 Feb 2008
Posts: 3
11-27-2008 17:39
From: Void Singer
a script might not know when an animation is done (except by timed guesswork) but a gesture does....meaninga combination of a gesture and a particle script that takes a listen might be easier ;)



That might work. I'll give it a shot & let you know how it works.