Jump to content

Confused, want this script to start at first picture each time rezzed in world...


Domitan Redenblack
 Share

You are about to reply to a thread that has been inactive for 4712 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

//--------------------------
// preloads textures on a box
// just drop it in with the images and it will cycle every 10 seconds, or 
// change the picture_pace variable to change the speed
// updates on touch as well
//--------------------------
// =IcaruS= - Added ability to crtl+drag textures
integer AddDrag = TRUE;
// Change this next line to adjust the image rotation speed
float picture_pace=10.0;

// Sendao Goodman, 2007

integer reload;
list pictures;
integer slideno;

loadPictures()
{
    pictures=[];
    integer i = llGetInventoryNumber(INVENTORY_TEXTURE);
    if( i > 0 ) {
        while( i > 0 ) {
            i--;
            pictures=(pictures=[])+pictures+[llGetInventoryName(INVENTORY_TEXTURE,i)];
        }
        llOwnerSay((string)llGetListLength(pictures)+" pictures loaded");
        pictures = llListSort( pictures, 1, TRUE ); // put them in order
        llSetTimerEvent(picture_pace);
    } else if( reload == 0 ) {
        llSetTimerEvent(0.0);
    }
}
string getSlide(integer slide)
{
    return llList2String( pictures, (slide+llGetListLength(pictures))%llGetListLength(pictures) );
}

default
{
    on_rez(integer sp)
    {
        loadPictures();
        slideno=0;
        reload=0;
        llAllowInventoryDrop(AddDrag); // icarus edit
    }
    state_entry()
    {
        loadPictures();
        slideno=0;
        reload=0;
        llSetColor( <1,1,1>, 0 );
        llSetColor( <0,0,0>, 1 );
        llSetColor( <0,0,0>, 2 );
        llSetColor( <0,0,0>, 3 );
        llSetColor( <0,0,0>, 4 );
        llSetColor( <0,0,0>, 5 );
        llAllowInventoryDrop(AddDrag); // icarus edit
    }
    
    changed( integer ch )
    {
        if( ch & CHANGED_INVENTORY ) {
            reload=1;
            llSetTimerEvent(2.0);
        }
        if (ch & CHANGED_OWNER){
            llResetScript();
        }
            
        if( ch & CHANGED_ALLOWED_DROP ) {
            reload=1;
            
        }
    }
    

    touch_start(integer nd)
    {
        if( llGetListLength(pictures) > 0 ) {
            integer i=6;
            while( i > 0 ) {
                i--;
                llSetTexture( getSlide(slideno+(i-2)), i);
            }
            slideno = (slideno+1)%llGetListLength(pictures);
        }
    }        

    
    timer()
    {
        if( reload == 1 ) {
            reload = 0;
            loadPictures();
            return;
        }
        integer i=6;
        while( i > 0 ) {
            i--;
            llSetTexture( getSlide(slideno+(i-2)), i);
        }
        slideno = (slideno+1)%llGetListLength(pictures);
    }
}

 

Confused, want this script to start at first picture each time rezzed in world...

I think part of the problem is textures *already* on faces of cube when rezzed, but the hacks I have tried dont seem to work.

Help!

ty

 

Link to comment
Share on other sites

you need to run the setTexture code in the on_rez event if you want it to place a spcefic image at start up... currently you only do that from the touch and timer, so the last picture viewed will be the default until code in one of those two events changes it.

Link to comment
Share on other sites


Void Singer wrote: you need to run the setTexture code in the on_rez event if you want it to place a spcefic image at start up... currently you only do that from the touch and timer, so the last picture viewed will be the default until code in one of those two events changes it.

Nope, tried that. Did not work, not sure why.

Link to comment
Share on other sites

So, force it by putting llSetTexture(llList2String(pictures,0),ALL_SIDES); in your loadPictures function, right before the llSetTimerEvent(picture_pace) statement.  That will put your first texture on all faces, 5 of which will be black.

Link to comment
Share on other sites

Ah, I see what the problem is...

There is a -2 on the picture index increment, which mucks up the way I want it to work.

   llSetTexture( getSlide(slideno+(i-2)), i);

This makes the last two pics appear first, which I thought were leftovers from before, already in the prim. Silly.

All working now, thanks!

 

Link to comment
Share on other sites

You actually could have just changed which face is not blacked out to get the same result.  That -2 is just an offset to put the active texture on the proper face. The first texture in your series is actually displayed on face #2, which is currently black.  I've modified that same script many times for different purposes and have messed with that index more than once.  :smileywink:

Link to comment
Share on other sites


Rolig Loon wrote:

You actually could have just changed which face is not blacked out to get the same result.  That -2 is just an offset to put the active texture on the proper face. The first texture in your series is actually displayed on face #2, which is currently black.  I've modified that same script many times for different purposes and have messed with that index more than once.  :smileywink:

Hmm.... I got rid of the -2 and everything works right for me now; starts with the first Texture in the contents on the central face of the flattened cube. Perhaps my cube is flattened differently.  A friend gave me this object, so maybe they changed the face/shape etc.

In any case, its all working fine now

 

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4712 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...