Pet System Setting for Shoulder Pets?

No promotion here please! Discuss building, collecting, and using community catchables and 7Seas-compatible buyables. Any registered user can start new threads here and reply.

Pet System Setting for Shoulder Pets?

Postby bloodsong » 15 Apr 2009, 16:49


if i'm making a shoulder pet style catchable... do i just set the swim speed to zero in the pet system and hope the user doesnt try to make it 'swim fast' or whatever?

seven, a toggle for 'stationary' might be good... um...actually, why dont i just do that?

Code: Select all
// OpenFish: Pet System
// A simple pet fish system, for 7Seas fishing content creators.
//--  bloodsong adds stationary toggle for non-swimming creatures
// ----------------------------------------------------------------------------

// Please consult the documentation that came with your OpenSeas kit for how to
// properly install and set up these scripts.

// Note that the scripts are distributed under a Creative Commons
// Attribution 3.0 United States agreement. To use this script you must agree
// NOT to stamp your fish as "Official 7Seas Products", because even though
// they're using our code they are not created by us. This also means not
// putting our (7S) trademark text in front of your object name. Anything else,
// including commercial repurposing of the code with this header intact, is
// fair game.

// ----------------------------------------------------------------------------

// Default swim speed goes here. Valid values are 0.6, 0.3, and 0.0.
float rotationspeed = 0.3;

// To make a fish that goes the other way, turn this into a -1 instead of a 1.
integer spindirection = 1;

//--bloodsong adds stationary toggle.  set to TRUE to NOT MOVE
//-- ie: shoulder pet fish

// ** The variables below this point are new or updated in OpenFish v2.0! **

// When the fish is clicked, this text will appear in the blue popup. You can put a description
// of your fish here, such as "This is a fine looking goldfish, with shiny scales!"
// If you don't care about adding a description you can just leave it blank.
// This is limited to 350 characters (way more than most people will need!)
// You don't need to pout the Creative Commons attribution statement here!
// One will be added automatically, after your description.
string fishdescription = "";

//The UUID of the fish's aquarium texture goes here. Consult your documentation for info on how
// to prepare a texture for usage when fish are sent to a 7Seas Aquarium. If this is left blank,
// sending to aquariums will be disabled -- it's an entirely optional feature!
string fishtexture = "";

// Fish rarity. 1=Common, 2=Uncommon, 3=Rare, 4=UltraRare, 5=SuperUltraRare.
// If left at 0, it'll disable the To Aquarium button.
integer stat_rarity = 0;

// Fish stats, used in games like AquaDash and others. NOTE: Setting these all to 3 will not
//  always net you a 'win' in a game, since some games value 1's or even 2's. Try to be
//  reasonable and fair when selecting your stats; having a good spread of these values in
//  all your custom fish mean they'll be used more often in games.

//SPEED: 1=Slow, 2=Average, 3=Fast.
  integer stat_speed = 2;
//SIZE: 1=Small, 2=Average, 3=Large.
  integer stat_size = 2;
//ATTITUDE: 1=Unfriendly, 2=Normal, 3=Outgoing.
  integer stat_attitude = 2;
//COURAGE: 1=Cowardly/Timid, 2=Normal, 3=Fearless.
  integer stat_courage = 2;
//VITALITY: 1=Weak/Fragile, 2=Normal, 3=Tough
  integer stat_vitality = 2;
//BEAUTY: 1=Ugly/Unusual, 2=Ordinary, 3=Pretty/Dazzling
  integer stat_beauty = 2;
//SPECIES: 1=Robot/Toy, 2=Fish, 3=Human/Fairy/Merfolk.
  integer stat_species = 2;

// ---- Change nothing below this point. Well, unless you want to and know what you're doing. ----

string nickname = "";
key owner;
integer handel = 0;
integer chanel = 13; // This'll get reset to a random number when you re-wear it, anyway.
integer temphandel = 0;
rotation rootrot = ZERO_ROTATION;

{   attach(key id)
    { if (id != NULL_KEY) { if (llGetObjectName() == "(7S Boxed Stuff) OpenSeas Developer's Kit") { return; }
                            owner = llGetOwner();
                            //--stationary toggle add
                            llOwnerSay("Your pet swims happily around you. (Click your pet for a menu of options!)");
                            llOwnerSay("Your pet looks around happily. (Click your pet for a menu of options!)");
                            if (handel != 0) { llListenRemove(handel); }
                            chanel = llRound(llFrand(4000.0))+22362;
                            handel = llListen(chanel,"",owner,"");
                            rootrot = llGetLocalRot();
                            //--stationary toggle add
                            llTargetOmega(llRot2Up(rootrot),rotationspeed * spindirection,PI);
                            fishdescription = llGetSubString(fishdescription,0,350);
                            // There's an occasional bug where a spinning object won't spin unless the client gets regular updates,
                            // hence, every 5 seconds, it'll have randomized invisible hovertext added.
                            //--stationary toggle add
                     else { llSetTimerEvent(0.0);
                            if (handel != 0) { llListenRemove(handel); handel = 0; }
                            if (temphandel != 0) { llListenRemove(temphandel); temphandel = 0; }
                            owner = NULL_KEY; }
    touch_start(integer num_detected)
    { if (llGetObjectName() == "(7S Boxed Stuff) OpenSeas Developer's Kit") { return; }
      if (llDetectedKey(0) == owner)
      { list buttonbar = ["Nickname"];
        if ((stat_rarity != 0) && (fishtexture != "")) { buttonbar += ["To Aquarium"]; }
        buttonbar += ["Bubbles On","Bubbles Off"];
        //--stationary toggle add
         buttonbar += ["Swim Slow","Swim Fast","Swim Stop"];
        llDialog(owner,fishdescription+"\n(Created using the 7Seas OpenFish System. Not an official 7Seas Fishing product; contact the creator of this object for support.)",buttonbar,chanel);
    timer() // The timer does three things. One, it times out a nickname request if they didn't type anything.
            // Two, it'll check if the rotation of the fish has changed -- if so it'll fix the spin.
            // Three, it sets random invisible hovertext over the fish, to work around an odd spin bug in SL.
    { if (temphandel != 0)
      { llOwnerSay("Nickname change request timed out, so it'll be left as-is. Click your pet again to retry setting nickname, and remember to say the new name within 20 seconds.");
        llListenRemove(temphandel); temphandel = 0; }
     //--stationary toggle add
      if ((llGetLocalRot() != rootrot) && (rotationspeed != 0.0))
       { llTargetOmega(llRot2Up(rootrot),0.0,PI);
         rootrot = llGetLocalRot();
         llTargetOmega(llRot2Up(rootrot),rotationspeed * spindirection,PI);
    listen(integer channel, string name, key id, string message)
    { if (id != owner) { return; } // We're ignoring anything not from our owner. Just in case.
      if (channel == 0) // This is a nickname change request.
      { if (temphandel != 0) { llListenRemove(temphandel); temphandel = 0; }
        if (llToLower(message) == "none") { message = ""; }
        llMessageLinked(LINK_ALL_OTHERS,411,message,NULL_KEY); // Connects to the Nicknamer script.
        nickname = message;
        if (nickname == "") { llOwnerSay("Nickname cleared."); } else { llOwnerSay("Nickname set to "+nickname+"."); }               
      // Everything else is from the blue popup menu.
      else if (message == "Nickname")
      { llOwnerSay("Okay, say your pet's new nickname aloud within 20 seconds, or say None for no nickname.");
        if (temphandel != 0) { llListenRemove(temphandel); temphandel = 0; }
        temphandel = llListen(0,"",owner,"");
      else if (message == "Swim Slow")
      { llOwnerSay("Swimming speed set to Slow.");
        rotationspeed = 0.3; llTargetOmega(llRot2Up(rootrot),rotationspeed * spindirection,PI);
      else if (message == "Swim Fast")
      { llOwnerSay("Swimming speed set to Fast.");
        rotationspeed = 0.6; llTargetOmega(llRot2Up(rootrot),rotationspeed * spindirection,PI);
      else if (message == "Swim Stop")
      { llOwnerSay("Swimming speed set to Stop.");
        rotationspeed = 0.0; llTargetOmega(llRot2Up(rootrot),rotationspeed * spindirection,PI);
      else if (message == "Bubbles On")
      { llOwnerSay("Bubbles turned On."); llMessageLinked(LINK_ALL_OTHERS,666,"on",NULL_KEY); }
      else if (message == "Bubbles Off")
      { llOwnerSay("Bubbles turned Off."); llMessageLinked(LINK_ALL_OTHERS,666,"off",NULL_KEY); }
      else if (message == "To Aquarium")
      { llOwnerSay("Sending a copy of your pet to all nearby public or personal 7Seas Aquariums.");
        string fishname = llGetObjectName();
        integer colon = llSubStringIndex(fishname,":");
        if (colon != -1) { fishname = llStringTrim(llDeleteSubString(fishname,0,colon),STRING_TRIM); }   

Posts: 3
Joined: 10 Mar 2009, 10:38

Re: Pet System Setting for Shoulder Pets?

Postby Seven Shikami » 15 Apr 2009, 18:29

We don't really bother with an OpenFish driver in the shoulder pets ourselves, because they don't swim, they don't take hovertext well (it ends up embedding itself in the side of your head!) and without swimming there's no reason to put them in the aquariums. But, hey! If you wanna use a variant on the code in your own pets, have fun with it. :D One of the joys of community creations are that they go places the official catches don't.
From the workshop of Seven Shikami, Official 7Seas Code Monkey.
For technical support please contact 7Seas Sass by IM in Second Life.
User avatar
Seven Shikami
Posts: 144
Joined: 18 Dec 2008, 09:43

Return to OpenSeas Creations

Who is online

Users browsing this forum: No registered users and 2 guests