Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Channel Command for scripted glow.

Soap Clawtooth
Registered User
Join date: 13 Feb 2008
Posts: 200
04-11-2008 03:29
Well i've been trying for a while now, but is anyone able to add a channel command, say like

/9 glowon | /9 glowoff to this script?


default
{
touch_start(integer total_number)
{
list values = llGetPrimitiveParams([PRIM_GLOW, 1]);
float glow = llList2Float(values, 0);
llSetPrimitiveParams([PRIM_GLOW, ALL_SIDES, 1.0 - glow]);
}
}


Would be MUCH appreciated :) im kinda new to this.
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
04-11-2008 03:33
the PRIM_GLOW is not supported until viewer 1.20.x is it?
_____________________
From Studio Dora
Soap Clawtooth
Registered User
Join date: 13 Feb 2008
Posts: 200
04-11-2008 04:19
From: Dora Gustafson
the PRIM_GLOW is not supported until viewer 1.20.x is it?



I'm USING that client now, however the overall effect of the glow turning on and off should be visible in any client. :)
Winter Ventura
Eclectic Randomness
Join date: 18 Jul 2006
Posts: 2,579
04-11-2008 06:27
... any windlight client, running on a computer that is capable of rendering glow.

I'm learning that glow is NOT a constant among my friends.


ANYWAYS.... Try this.
CODE

// script by Winter Ventura
// Permission is granted to use, abuse, change, alter, or whatever.
// Use it together, use it in peace.

// Script (in it's original form) responds to three commands:
// /9 glow on <-- Turns glow on to the preset variable.
// /9 glow off <-- Turns glow off
// /9 glow ## <-- where "##" is any number between 1 and 100. Higher numbers will read
// as 100, and 0 will read as an error. Negative numbers will be ignored.

integer chatchan = 9;

float on = 1.0; // value when on
float off = 0.0; // value when off

setglow(float setting)
{
llSetPrimitiveParams([25, ALL_SIDES, setting]); // "25" can be changed to PRIM_GLOW if you're using SL 1.20 or higher
}

init()
{
llListen(chatchan, "", llGetOwner(), "");
}

default
{
state_entry()
{
init();
}

on_rez(integer startparam)
{
init();
}

changed (integer change)
{
if (change & CHANGED_OWNER) init();
}

listen(integer channel, string name, key id, string message)
{
message = llStringTrim(llToLower(message), STRING_TRIM);
string prefix = llGetSubString(message, 0, 3);
if (prefix != "glow") return;
string command = llDeleteSubString(message, 0, 4);
if (llStringTrim(command, STRING_TRIM) == "on") setglow(on);
else if (llStringTrim(command, STRING_TRIM) == "off") setglow(off);
else
{
float custom = (float)llStringTrim(command, STRING_TRIM) / 100;
if (custom == 0.0) llOwnerSay("I'm sorry, I didn't understand");
else setglow(custom);
}
}
}

_____________________

● Inworld Store: http://slurl.eclectic-randomness.com
● Website: http://www.eclectic-randomness.com
● Twitter: @WinterVentura
Soap Clawtooth
Registered User
Join date: 13 Feb 2008
Posts: 200
04-11-2008 07:10
Super helpful! thanks! :D
Imnotgoing Sideways
Can't outlaw cute! =^-^=
Join date: 17 Nov 2007
Posts: 4,694
04-11-2008 07:10
So far, when I've scripted for glow, I've kept this line on top so that when it's finally supported there would be no clean up issues in the future. Also, it keeps me in the habit of using the right keywords. (^_^)

integer PRIM_GLOW = 25; //Delete this line when PRIM_GLOW is supported by the compiler

(^_^)y
_____________________
Somewhere in this world; there is someone having some good clean fun doing the one thing you hate the most. (^_^)y


http://slurl.com/secondlife/Ferguson/54/237/94
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
04-11-2008 11:25
From: Imnotgoing Sideways
So far, when I've scripted for glow, I've kept this line on top so that when it's finally supported there would be no clean up issues in the future. Also, it keeps me in the habit of using the right keywords. (^_^)

integer PRIM_GLOW = 25; //Delete this line when PRIM_GLOW is supported by the compiler

Yeah. That way the compiler should even tell you when it has been implemented the first time you recompile afterwards.