You are currently in the Forum Archive. All content within this area is Read-Only and cannot be modified. Active Forums can be found here.
Reply
Honored Resident
Julia Tiraxibar
Posts: 10

How do I script a random gift giver for a chemistry assignment?

Hi, I'm looking for help in scripting an object that will give a random object to one person.  I'm a chemistry prof at Texas A&M University, who is using Hiro Sheridan's Molecular Rezzor to create many different molecules using VSEPR theory (It's OK if you don't know what I'm saying).  I want my students to click on the object (the "giver") and randomly get only one of many molecular rezzer boxes with a preordained molecule in it as their assignment/quiz.  I do want the ability to reset it so that a student can get another one if something goes wrong with the assignment.  If you want to see what I'm doing, go here:

http://slurl.com/secondlife/12th%20Man/210/238/26    If anyone can help me, that would be great.  I am only a rudimentary beginner in scripting.

Wendy 

Member
Pete Olihenge
Posts: 1,256

Re: How do I script a random gift giver for a chemistry assignment?

Reply to Julia Tiraxibar - view message

A few questions, for clarification:

If something goes wrong with the assignment, does the student need to be able to go back and get the same molecule again?

Will the student, at some later time, be given another assignment, requiring a different random molecule?

Must each student get a different random molecule?

Roughly how many students would be using the giver, and need keeping track of (assuming the answer to any of the above is yes)?

New Resident
Grated Romano
Posts: 1

Re: How do I script a random gift giver for a chemistry assignment?

Reply to Julia Tiraxibar - view message

I know this doesn't exactly help, but you sound like a great chemistry teacher. Keep up the creative work & good luck with your scripting.

Void Singer
Posts: 7,475
Solutions: 64
Registered: ‎05-28-2009

Re: How do I script a random gift giver for a chemistry assignment?

Reply to Julia Tiraxibar - view message

feeling bored, here ya go...

/*//( Script Start )//*/

integer gIntBoxes;
list    gLstAssignment;
list    gLstStudent;

default{
    state_entry(){
        gIntBoxes = llGetInventoryNumber( INVENTORY_OBJECT );
    }
   
    touch_end( integer vIntNul ){
        if (llGetOwner() == llDetectedKey( 0 )){
            integer vIntLoop = ~-([] != gLstStudent);
            while (++vIntLoop){
                llOwnerSay( llList2String( gLstStudent, vIntLoop ) + " assigned package " + llGetInventoryName( INVENTORY_OBJECT, llList2Integer( gLstAssignment, vIntLoop ) ) );
            }
        }else{
            integer vIntTest = llListFindList( gLstStudent, (list)llDetectedName( 0 ) );
            if (!~vIntTest){
                gLstStudent += (list)llDetectedName( 0 );
                gLstAssignment += (list)((integer)llFrand( (float)gIntBoxes ));
            }
            llGiveInventory( llDetectedKey( 0 ), llGetInventoryName( INVENTORY_OBJECT, llList2Integer( gLstAssignment, vIntTest ) ) );
        }
    }
   
    changed( integer vBitChg ){
        if (CHANGED_INVENTORY & vBitChg){
            llResetScript();
        }
    }
}

/*//( Script End )//*/

- Farewell to your ports and good luck to you all
Honored Resident
Julia Tiraxibar
Posts: 10

Re: How do I script a random gift giver for a chemistry assignment?

Reply to Julia Tiraxibar - view message

Hi, Pete - thanks so much for your interest.  To answer your questions....

A few questions, for clarification:

If something goes wrong with the assignment, does the student need to be able to go back and get the same molecule again?

No, the student can get a different molecule.

Will the student, at some later time, be given another assignment, requiring a different random molecule?

These are great questions.  The answer would be yes - that would be best.

Must each student get a different random molecule?

No, I have about 550 students; they can't all get different molecules (smile)...

Roughly how many students would be using the giver, and need keeping track of (assuming the answer to any of the above is yes)?

I would love the ability to keep track of who does what molecule.  Although I have so many students, only perhaps 100 or so at most should be doing the assignment.  I cannot make it mandatory, since a few of my students are under 18.

Wendy 

Honored Resident
Julia Tiraxibar
Posts: 10

Re: How do I script a random gift giver for a chemistry assignment?

Reply to Julia Tiraxibar - view message

Thanks, Grated!

Wendy 

Honored Resident
Julia Tiraxibar
Posts: 10

Re: How do I script a random gift giver for a chemistry assignment?

Reply to Julia Tiraxibar - view message

Wow - thanks,  Void!

Wendy 

Void Singer
Posts: 7,475
Solutions: 64
Registered: ‎05-28-2009

Re: How do I script a random gift giver for a chemistry assignment?

Reply to Julia Tiraxibar - view message

it's also possible to modify it so that it's limited to one per student, by building a list of the contained objects (instead of just a count) and then removing one from that list at random and adding it to the assignment list (along with the name to the student list)... although at that level it probably doesn't need to be randomly picked (and it'd be more effecient to use list randomize to do it if you did)

- Farewell to your ports and good luck to you all
Honored Resident
Julia Tiraxibar
Posts: 10

Re: How do I script a random gift giver for a chemistry assignment?

Reply to Julia Tiraxibar - view message

You said:

it's also possible to modify it so that it's limited to one per student, by building a list of the contained objects (instead of just a count) and then removing one from that list at random and adding it to the assignment list (along with the name to the student list)... although at that level it probably doesn't need to be randomly picked (and it'd be more effecient to use list randomize to do it if you did)

So, I have many more students than molecules to pick from.  So, if I have 20 molecules and 100 students, the hope is to have each student randomly get a molecule (it would be nice if I knew the molecule given to a particular student) so in the end only about 5 students would have the same molecule. Am I a little more clear?

Wendy

Honored Resident
Julia Tiraxibar
Posts: 10

Re: How do I script a random gift giver for a chemistry assignment?

Reply to Julia Tiraxibar - view message


Thanks so much, Void.  this  is definitely my summer project!  I do have the book, Scripting your World - the official guide.  So, I'll be working thru that to understand the ins and outs of your script!

Wendy  (Julia Tiraxibar)