Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Random Number Selection Script

Kitten Mikoyan
Registered User
Join date: 29 May 2008
Posts: 2
05-30-2008 01:46
Hi guys!

Does anybody know of a script that, on touch, will scroll through numbers on a screen, stopping at a random number? (almost like a raffle)..thank you!!
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
05-30-2008 02:28
... scroll?
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
- Cyril Connolly

Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence.
- James Nachtwey
Sean Martin
Yesnomaybe.
Join date: 13 Sep 2005
Posts: 584
05-30-2008 03:22
Strife could clean this script up real nice but this will work.
Btw.. anyone have another method for posting scripts so we don't lose the spacing data? I've seen it done somewhere.

integer TimeLeft;
float FloatValue;
integer IntValue;
string StringValue;
default
{
state_entry()
{
llSay(0, "Click to start me.";);
}

touch_start(integer total_number)
{
TimeLeft = 10;//How many numbers will scroll.
llSetTimerEvent(1);
}
timer()
{
TimeLeft = TimeLeft - 1;
if(TimeLeft >= 1)
{
FloatValue = llFrand(100);
IntValue = llRound(FloatValue);
StringValue = (string)IntValue;
llOwnerSay(StringValue); //Please do not spam.
}
else
{
llSetTimerEvent(0);//Timer is off.
}

}
}
_____________________
Viktoria Dovgal
Join date: 29 Jul 2007
Posts: 3,593
05-30-2008 03:29
From: Sean Martin
Strife could clean this script up real nice but this will work.
Btw.. anyone have another method for posting scripts so we don't lose the spacing data? I've seen it done somewhere.

Well, it would be nice if you could replace those [ quote ] tags with [ code ] or [ php ]. The reason is that if you use those other tags, they will work inline whenever the forum software finally gets updated, and they can be grabbed with intact formatting by hitting the quote button. Things inside quote tags are hidden from the quote button so they're not accessible in formatted form at all :(
_____________________
Sean Martin
Yesnomaybe.
Join date: 13 Sep 2005
Posts: 584
05-30-2008 03:31
From: Viktoria Dovgal
Well, it would be nice if you could replace those [ quote ] tags with [ code ] or [ php ]. The reason is that if you use those other tags, they will work inline whenever the forum software finally gets updated, and they can be grabbed with intact formatting by hitting the quote button. Things inside quote tags are hidden from the quote button so they're not accessible in formatted form at all :(


Yeah after the first year went by and still no update.. I figured they won't be doing it any time soon. lol
It's sad really. :rolleyes:
(Or nearly a year?) I dunno they should have fixed this a long time ago.
_____________________
Kitten Mikoyan
Registered User
Join date: 29 May 2008
Posts: 2
Random Number Selection Script- Part Two!-
05-30-2008 05:34
Yes..good point Strife!..

Ive had some more coffee..and my brain is waking up since my original post..so here is a clearer request!!..

Here's how I think it could be done =)... the numbers would be a set of textures 1-10.. stored inside the prim's contents folder..the script would have to make the prim's surface texture start to swap randomly through the 1-10 textures in its contents folder, stopping on a random one of the textures after a set period of time..say 10 seconds.

The script would also have to be activated (beginning the random texture selection for 10seconds) by touching the prim

Once again..thanks for any help guys!!
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
05-30-2008 05:48
From: Kitten Mikoyan
Yes..good point Strife!..

Ive had some more coffee..and my brain is waking up since my original post..so here is a clearer request!!..

Here's how I think it could be done =)... the numbers would be a set of textures 1-10.. stored inside the prim's contents folder..the script would have to make the prim's surface texture start to swap randomly through the 1-10 textures in its contents folder, stopping on a random one of the textures after a set period of time..say 10 seconds.

The script would also have to be activated (beginning the random texture selection for 10seconds) by touching the prim

Once again..thanks for any help guys!!


Rather than use 10 textures use a single texture with all of numbers/symbols already on it and use llOffsetTexture to display the required portion.
_____________________
I'm back......