Billybob Street
Registered User
Join date: 18 Aug 2004
Posts: 26
|
03-19-2005 20:32
i am working on a touch cannon and i dont know how have a 15 sec reload time between each shot heres what i got done so far
integer FORCE = 30; vector STARTOFFSET = <-1.7,0,0>;
default { state_entry() { }
touch_start(integer total_number) { llTriggerSound("Report", 1.0); llRezObject("CannonBall", llGetPos() + STARTOFFSET * llGetRot(), <-1 * FORCE,0,0> * llGetRot(),ZERO_ROTATION,0); } }
|
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
|
03-19-2005 21:18
llSleep(15.0);
_____________________
---
|
Jillian Callahan
Rotary-winged Neko Girl
Join date: 24 Jun 2004
Posts: 3,766
|
03-19-2005 21:31
Or (to avoid queueing up lots of shots): integer FORCE = 30; vector STARTOFFSET = <-1.7,0,0>; float tod; // global variables
touch_start(integer n) { float ctod = llGetWallclock(); if ((ctod - tod) < 15.0) // less than 15 seconds since last firing time { llWhisper(0, "Still reloading!"); } else { llTriggerSound("Report", 1.0); llRezObject("CannonBall", llGetPos() + STARTOFFSET * llGetRot(), <-1 * FORCE,0,0> * llGetRot(),ZERO_ROTATION,0); tod = llGetWallClock(); } }
|
Billybob Street
Registered User
Join date: 18 Aug 2004
Posts: 26
|
03-19-2005 22:13
i keep geting a syntex error with the script above
|
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
|
03-19-2005 23:36
If you insist on No Queuing...
integer FORCE = 30; vector STARTOFFSET = <-1.7,0,0>;
default {
touch_start(integer total_number) { llTriggerSound("Report", 1.0); llRezObject("CannonBall", llGetPos() + STARTOFFSET * llGetRot(), <-1 * FORCE,0,0> * llGetRot(),ZERO_ROTATION,0); state wait; } }
state wait { state_entry() { llSleep(15.0); state default; } }
_____________________
---
|
Jillian Callahan
Rotary-winged Neko Girl
Join date: 24 Jun 2004
Posts: 3,766
|
03-20-2005 06:39
Yeah, that is better. But, sleep freezes the script. To be flexible enough to do other things (Specifically: user feedback) how about: integer FORCE = 30; vector STARTOFFSET = <-1.7,0,0>;
default {
touch_start(integer total_number) { llTriggerSound("Report", 1.0); llRezObject("CannonBall", llGetPos() + STARTOFFSET * llGetRot(), <-1 * FORCE,0,0> * llGetRot(),ZERO_ROTATION,0); state wait; } }
state wait { state_entry() { llSetTimerEvent(15.0); }
touch_start(integer n) { llWhisper(0, "Still reloading."); }
timer() { state default; } } 
|
Billybob Street
Registered User
Join date: 18 Aug 2004
Posts: 26
|
03-20-2005 09:36
thx that one worked now is how can u make alot of smoke come out of the cannon when u shoot it
|