Dicey Proposition

Creating scripts
Post Reply
User avatar
Shandon Loring
Posts: 1341
Joined: Sat Oct 26, 2013 3:25 am
Has thanked: 961 times
Been thanked: 1581 times
Contact:

Dicey Proposition

Post by Shandon Loring »

Graham Mills wrote:
Sat Jan 28, 2023 1:45 pm
I may be missing something but this works for me.

Code: Select all

default
{
    touch_start(integer n)
    {
        llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_OMEGA,<1,3,0.5>,TWO_PI,1]); 
        llSetTimerEvent(5.0);
    }
    
    timer()
    {
        llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_OMEGA,<0,0,0>,0,0]);
        llSetTimerEvent(0.0);
        state zero;
    }
}

state zero
{
    state_entry()
    {
        llSetRot(ZERO_ROTATION);
        state default;
    }
}
Hey that works pretty neat Graham. Not sure how it would work in a game die for random results, but I can see some other applications. Thanks!
Also, I tripped across a dice function built in to FS, I'm guessing there is a real good chance y'all already know about it, and it is not a supercool object thing, but still pretty effective and fast for anyone that might need quick rollings of various dice that everyone can see the numbers and no taint of bias (if you trust Jessica!).. like for the Call Of Cthulhu game we're hosting next month for example! <wink>

The short of it is type "rolld" (without the quotes of course) in local chat and FS rolls a 6-sided die for you. Strictly textual output but still...
And it gets better... you need a D20? three D10's? a D1000?? Penetration? Explodes? There is a ton of modifiers available. Detail at:
https://wiki.firestormviewer.org/fs_dice Could easily create pop-up Dialogue HUD to roll whatever was needed. Hey, maybe I should do that!

Again, maybe y'all already know about it, and it's not object oriented, but I found it kinda cool anyway.
These users thanked the author Shandon Loring for the post (total 3):
Ilan TochnerGraham MillsChris Namaste
Graham Mills
Posts: 1314
Joined: Sun Dec 23, 2012 2:26 pm
Has thanked: 1134 times
Been thanked: 1141 times

Re: Dicey Proposition

Post by Graham Mills »

I did not know that. Learn something new every day :)
These users thanked the author Graham Mills for the post:
Shandon Loring
Graham Mills
Posts: 1314
Joined: Sun Dec 23, 2012 2:26 pm
Has thanked: 1134 times
Been thanked: 1141 times

Re: Dicey Proposition

Post by Graham Mills »

Modified the previous script to show random faces (no idea how random).

Code: Select all

list POS = [<0.000000, 0.000000, 0.000000, 1.000000>,
         <0.000000, 0.707107, 0.000000, 0.707107>,
         <-0.500000, 0.500000, -0.500000, 0.500000>,
         <-0.707107, 0.000000, -0.707107, 0.000000>,
         <0.500000, 0.500000, 0.500000, 0.500000>,
          <-0.707107, -0.707107, 0.000000, 0.000000>];
rotation ROT;

default
{
    state_entry()
    {
        ROT = llList2Rot(llListRandomize(POS, 1), 0);
    }
    
    touch_start(integer n)
    {
        llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_OMEGA,<1,3,0.5>,TWO_PI,1]); 
        llSetTimerEvent(5.0);
    }
    
    timer()
    {
        llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_OMEGA,<0,0,0>,0,0]);
        llSetTimerEvent(0.0);
        state zero;
    }
}

state zero
{
    state_entry()
    {
        llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_ROTATION, ROT]);
        state default;
    }
}
These users thanked the author Graham Mills for the post:
Ilan Tochner
Post Reply