Forgot? Join

Scripting

LSL Guide

Every script function this grid actually runs, read straight from the region software rather than copied from a wiki — including the wolf* functions that exist only here.

Functions · Constants

wolfDriveInput

Wolf Territories
list wolfDriveInput(string avatar)

The exact wheel and pedals of a driver sitting on this object (the script needs PERMISSION_TAKE_CONTROLS from them, as control() does), from their Wolf viewer: [steer -1..1 (right +), throttle 0..1, brake 0..1, clutch 0..1, gear (WOLF_DRIVE_GEAR_P/R/N/D or 1..18), buttons (WOLF_DRIVE_BTN_* bits), age in seconds]. Sent on change and once a second, so an age over ~2 s means the viewer has gone. An empty list from any other viewer: keep a control() event for those.

Only for a script in the linkset the avatar is sitting on, holding PERMISSION_TAKE_CONTROLS from them, on a Wolf Territories region. The list is empty when any of that is not so, or when the driver's viewer is not WolfViewer or WolfStorm (other viewers never send these values): keep a control() event for them. wolfGetLastError says which.

Parameters

TypeName What it does
string avatar The driver: the avatar sitting on this object, usually llAvatarOnSitTarget().

What it returns

IndexTypeValue
0floatsteer, -1 to 1 (right is +)
1floatthrottle, 0 to 1
2floatbrake, 0 to 1
3floatclutch, 0 to 1
4integergear: WOLF_DRIVE_GEAR_P, _R, _N or _D, or 1 to 18 (a gear the driver chose)
5integerbuttons held: WOLF_DRIVE_BTN_* bits
6floatage: seconds since the viewer sent these (it sends on change and once a second, so over about 2 s means the viewer has gone)

The constants

ConstantValue
WOLF_DRIVE_BTN_GEAR_UP1
WOLF_DRIVE_BTN_GEAR_DOWN2
WOLF_DRIVE_BTN_HORN4
WOLF_DRIVE_BTN_LIGHTS8
WOLF_DRIVE_BTN_INDICATOR_LEFT16
WOLF_DRIVE_BTN_INDICATOR_RIGHT32
WOLF_DRIVE_BTN_HANDBRAKE64
WOLF_DRIVE_BTN_HAZARDS128
WOLF_DRIVE_BTN_CRUISE256
WOLF_DRIVE_GEAR_P-2
WOLF_DRIVE_GEAR_R-1
WOLF_DRIVE_GEAR_N0
WOLF_DRIVE_GEAR_D99

How players use it, and more examples: the Driving guide.

Example

// From analogue_car.lsl (the full script is on the Driving guide):
list wheel = wolfDriveInput(gDriver);
if (llGetListLength(wheel) == 7 && llList2Float(wheel, 6) < LIVE_AGE)
{
    // A Wolf viewer: exactly how far the wheel is turned and the pedals are pressed.
    steer    = llList2Float(wheel, 0);
    throttle = llList2Float(wheel, 1);
    brake    = llList2Float(wheel, 2);
    gear     = llList2Integer(wheel, 4);
    pressButtons(llList2Integer(wheel, 5));
}
else
{
    // Any other viewer: the keys, all or nothing. Back is reverse, as on most SL cars.
    if (gKeys & CONTROL_FWD) throttle = 1.0;
    if (gKeys & CONTROL_BACK) { throttle = 1.0; gear = WOLF_DRIVE_GEAR_R; }
    if (gKeys & (CONTROL_ROT_RIGHT | CONTROL_RIGHT)) steer += 1.0;
    if (gKeys & (CONTROL_ROT_LEFT | CONTROL_LEFT)) steer -= 1.0;
}
Energy 10

Ours alone. Grid features you will not find on any other OpenSimulator grid.

More in Wolf Territories