|
Arden Douglas
Registered User
Join date: 26 Dec 2006
Posts: 3
|
12-27-2006 10:29
Hello everyone. I have what will probably be a rather simple question concerning a problem with a Listen event handler in a vehicle script. I have tried looking in the forums, the various libraries, and the LSL wiki for an answer and have not found one (unless I missed it or did not know what I was looking for). In the code snippet below, the llSetVehicleFloatParam in touch_start works correctly, making the vehicle move. However, when llSetVehicleFloatParam is used in the listen, the hover height does not change until something else happens to the vehicle i.e. the vehicle is edited, someone sits on it, etc. I know the code inside the "if" statement is working since the llOwnerSay string is displayed immediately upon detecting the message on channel 374. Any ideas what I am doing wrong or how I can work around the problem? Thanks! touch_start(integer total_number) { llOwnerSay("I was touched!"); llSetVehicleFloatParam( VEHICLE_HOVER_HEIGHT, 40); } listen(integer channel, string name, key id, string message) { if (( channel == 374) && (message == "Move")) { llOwnerSay("Moving as per your instructions"); llSetVehicleFloatParam( VEHICLE_HOVER_HEIGHT, 30); } }
|
|
Tiarnalalon Sismondi
Registered User
Join date: 1 Jun 2006
Posts: 402
|
12-27-2006 11:17
do you have a VEHICLE_HOVER_TIMESCALE set? I haven't messed with the hover attributes a ton as I just found ones that work for me, and I haven't attempted to switch anything other than mouselook attributes in mid-flight through scripting. Might find more help here: http://www.lslwiki.com/lslwiki/wakka.php?wakka=LindenVehicleTutorial
|
|
Arden Douglas
Registered User
Join date: 26 Dec 2006
Posts: 3
|
12-27-2006 11:41
The hover parameters and flags are set in both state_entry and on_rez as follows: llSetVehicleFloatParam( VEHICLE_HOVER_HEIGHT, 23 ); llSetVehicleFloatParam( VEHICLE_HOVER_EFFICIENCY, 1.0 ); llSetVehicleFloatParam( VEHICLE_HOVER_TIMESCALE, 0.0 ); llSetVehicleFloatParam( VEHICLE_BUOYANCY, 1 ); llSetVehicleFlags(VEHICLE_FLAG_HOVER_GLOBAL_HEIGHT); llRemoveVehicleFlags(VEHICLE_FLAG_HOVER_TERRAIN_ONLY | VEHICLE_FLAG_HOVER_WATER_ONLY | VEHICLE_FLAG_HOVER_UP_ONLY);
I could understand the parameters/flags playing a role if both the listen and touch_start behaved the same but the first does not execute the VEHICLE_HOVER_HEIGHT until subsequent activity while the later executes it instantly. And if it looks odd, the spaces in "Only" are caused by the PHP code formatting, not the original code.
|
|
Jillian Callahan
Rotary-winged Neko Girl
Join date: 24 Jun 2004
Posts: 3,766
|
12-27-2006 13:23
It's an update thing. Touching the vehicle forces an update to the prims, where no such update is given by the listen event.
Give the vehicle a little bit of a poke with llApplyImpulse.
|
|
Arden Douglas
Registered User
Join date: 26 Dec 2006
Posts: 3
|
12-27-2006 20:24
From: Jillian Callahan It's an update thing. Touching the vehicle forces an update to the prims, where no such update is given by the listen event.
Give the vehicle a little bit of a poke with llApplyImpulse. Thanks alot Jillian. That did the trick.
|