Fish Tank Version 1.0

Got any custom JavaScript additions/tweaks you think other people would like to see? Post 'em here!
Post Reply
dragon slayer
UOX3 Guru
Posts: 776
Joined: Thu Dec 21, 2006 7:37 am
Has thanked: 4 times
Been thanked: 26 times

Fish Tank Version 1.0

Post by dragon slayer »

Okay this just first version of the fish tank.

You can add all the fish from the fishbowl script this tank.
Plus its animated every time you open it those fish are some where else.
here is a picture to go along with this post

Image

fishtank.js
var maxFish = 0;

function onCreateDFN( objMade, objType )
{
   if( objType == 0 )
   {
      if( objMade.name == "a fish tank" )
      {
          objMade.SetTag( "fishs", 1);
          objMade.SetTag("fishCounter", maxFish);
      }
    }
}

function onDropItemOnItem( iDropped, pDropper, iDroppedOn )
{
   var fishcount = iDroppedOn.GetTag("fishCounter");
   if( fishcount == 10)
   {
        pDropper.SysMessage( "You can't add any more fish to the tank." );
        return 1;
   }
   else
   {
     if ( iDropped.id == 0x3B04)
     {
       if( iDroppedOn.GetTag( "fish1" ) )
       {
          pDropper.SysMessage( "That type of fish is already in the tank." );
          return 1;
       }
       else
       {
     fishcount++;
         iDroppedOn.SetTag( "fishCounter", fishcount );
         pDropper.SysMessage( "There is "+fishcount+"." );
         iDroppedOn.SetTag( "fish1", 1 );
         iDropped.Delete()
         return 0;
       }
     }
     if ( iDropped.id == 0x3AFF)
     {
       if( iDroppedOn.GetTag( "fish2" ) )
       {
          pDropper.SysMessage( "That type of fish is already in the tank." );
          return 1;
       }
       else
       {
     fishcount++;
         iDroppedOn.SetTag( "fishCounter", fishcount );
         pDropper.SysMessage( "There is "+fishcount+"." );
         iDroppedOn.SetTag( "fish2", 1 );
         iDropped.Delete()
         return 0;
       }
     }
     if ( iDropped.id == 0x3B03)
     {
       if( iDroppedOn.GetTag( "fish3" ) )
       {
          pDropper.SysMessage( "That type of fish is already in the tank." );
          return 1;
       }
       else
       {
     fishcount++;
         iDroppedOn.SetTag( "fishCounter", fishcount );
         pDropper.SysMessage( "There is "+fishcount+"." );
         iDroppedOn.SetTag( "fish3", 1 );
         iDropped.Delete()
         return 0;
       }
     }
     if ( iDropped.id == 0x3B06)
     {
       if( iDroppedOn.GetTag( "fish4" ) )
       {
          pDropper.SysMessage( "That type of fish is already in the tank." );
          return 1;
       }
       else
       {
     fishcount++;
         iDroppedOn.SetTag( "fishCounter", fishcount );
         pDropper.SysMessage( "There is "+fishcount+"." );
         iDroppedOn.SetTag( "fish4", 1 );
         iDropped.Delete()
         return 0;
       }
     }
     if ( iDropped.id == 0x3B00)
     {
       if( iDroppedOn.GetTag( "fish5" ) )
       {
          pDropper.SysMessage( "That type of fish is already in the tank." );
          return 1;
       }
       else
       {
     fishcount++;
         iDroppedOn.SetTag( "fishCounter", fishcount );
         pDropper.SysMessage( "There is "+fishcount+"." );
         iDroppedOn.SetTag( "fish5", 1 );
         iDropped.Delete()
         return 0;
       }
     }
     if ( iDropped.id == 0x3B0D)
     {
       if( iDroppedOn.GetTag( "fish6" ) )
       {
          pDropper.SysMessage( "That type of fish is already in the tank." );
          return 1;
       }
       else
       {
     fishcount++;
         iDroppedOn.SetTag( "fishCounter", fishcount );
         pDropper.SysMessage( "There is "+fishcount+"." );
         iDroppedOn.SetTag( "fish6", 1 );
         iDropped.Delete()
         return 0;
       }
     }
     if ( iDropped.id == 0x3AFD)
     {
       if( iDroppedOn.GetTag( "fish7" ) )
       {
          pDropper.SysMessage( "That type of fish is already in the tank." );
          return 1;
       }
       else
       {
     fishcount++;
         iDroppedOn.SetTag( "fishCounter", fishcount );
         pDropper.SysMessage( "There is "+fishcount+"." );
         iDroppedOn.SetTag( "fish7", 1 );
         iDropped.Delete()
         return 0;
       }
     }
     if ( iDropped.id == 0x3B05)
     {
       if( iDroppedOn.GetTag( "fish8" ) )
       {
          pDropper.SysMessage( "That type of fish is already in the tank." );
          return 1;
       }
       else
       {
     fishcount++;
         iDroppedOn.SetTag( "fishCounter", fishcount );
         pDropper.SysMessage( "There is "+fishcount+"." );
         iDroppedOn.SetTag( "fish8", 1 );
         iDropped.Delete()
         return 0;
       }
     }
     if ( iDropped.id == 0x3B08)
     {
       if( iDroppedOn.GetTag( "fish9" ) )
       {
          pDropper.SysMessage( "That type of fish is already in the tank." );
          return 1;
       }
       else
       {
     fishcount++;
         iDroppedOn.SetTag( "fishCounter", fishcount );
         pDropper.SysMessage( "There is "+fishcount+"." );
         iDroppedOn.SetTag( "fish9", 1 );
         iDropped.Delete()
         return 0;
       }
     }
     if ( iDropped.id == 0x3B02)
     {
       if( iDroppedOn.GetTag( "fish10" ) )
       {
          pDropper.SysMessage( "That type of fish is already in the tank." );
          return 1;
       }
       else
       {
     fishcount++;
         iDroppedOn.SetTag( "fishCounter", fishcount );
         pDropper.SysMessage( "There is "+fishcount+"." );
         iDroppedOn.SetTag( "fish10", 1 );
         iDropped.Delete()
         return 0;
       }
     }
     if ( iDropped.id == 0x3B0E)
     {
       if( iDroppedOn.GetTag( "fish11" ) )
       {
          pDropper.SysMessage( "That type of fish is already in the tank." );
          return 1;
       }
       else
       {
     fishcount++;
         iDroppedOn.SetTag( "fishCounter", fishcount );
         pDropper.SysMessage( "There is "+fishcount+"." );
         iDroppedOn.SetTag( "fish11", 1 );
         iDropped.Delete()
         return 0;
       }
     }
     if ( iDropped.id == 0x3AFE)
     {
       if( iDroppedOn.GetTag( "fish12" ) )
       {
          pDropper.SysMessage( "That type of fish is already in the tank." );
          return 1;
       }
       else
       {
     fishcount++;
         iDroppedOn.SetTag( "fishCounter", fishcount );
         pDropper.SysMessage( "There is "+fishcount+"." );
         iDroppedOn.SetTag( "fish12", 1 );
         iDropped.Delete()
         return 0;
       }
     }
     if ( iDropped.id == 0x3B14)
     {
       if( iDroppedOn.GetTag( "fish13" ) )
       {
          pDropper.SysMessage( "That type of fish is already in the tank." );
          return 1;
       }
       else
       {
     fishcount++;
         iDroppedOn.SetTag( "fishCounter", fishcount );
         pDropper.SysMessage( "There is "+fishcount+"." );
         iDroppedOn.SetTag( "fish13", 1 );
         iDropped.Delete()
         return 0;
       }
     }
     if ( iDropped.id == 0x3AFC)
     {
       if( iDroppedOn.GetTag( "fish14" ) )
       {
          pDropper.SysMessage( "That type of fish is already in the tank." );
          return 1;
       }
       else
       {
     fishcount++;
         iDroppedOn.SetTag( "fishCounter", fishcount );
         pDropper.SysMessage( "There is "+fishcount+"." );
         iDroppedOn.SetTag( "fish14", 1 );
         iDropped.Delete()
         return 0;
       }
     }
     if ( iDropped.id == 0x3B09)
     {
       if( iDroppedOn.GetTag( "fish15" ) )
       {
          pDropper.SysMessage( "That type of fish is already in the tank." );
          return 1;
       }
       else
       {
     fishcount++;
         iDroppedOn.SetTag( "fishCounter", fishcount );
         pDropper.SysMessage( "There is "+fishcount+"." );
         iDroppedOn.SetTag( "fish15", 1 );
         iDropped.Delete()
         return 0;
       }
     }
     if ( iDropped.id == 0x3B07)
     {
       if( iDroppedOn.GetTag( "fish16" ) )
       {
          pDropper.SysMessage( "That type of fish is already in the tank." );
          return 1;
       }
       else
       {
     fishcount++;
         iDroppedOn.SetTag( "fishCounter", fishcount );
         pDropper.SysMessage( "There is "+fishcount+"." );
         iDroppedOn.SetTag( "fish16", 1 );
         iDropped.Delete()
         return 0;
       }
     }
   }
}

function onUseChecked ( pUser, iUsed )
{
    var myGump = new Gump;
    var fishcount = iUsed.GetTag("fishCounter");
    var iDice1 = RandomNumber( 20, 300 );
    var iDice2 = RandomNumber( 15, 110 );
    var iDice3 = RandomNumber( 20, 300 );
    var iDice4 = RandomNumber( 15, 115 );
    var iDice5 = RandomNumber( 20, 300 );
    var iDice6 = RandomNumber( 15, 120 );
    var iDice7 = RandomNumber( 20, 300 );
    var iDice8 = RandomNumber( 15, 125 );
    var iDice9 = RandomNumber( 20, 300 );
    var iDice10 = RandomNumber( 15, 130 );
    var iDice11 = RandomNumber( 20, 300 );
    var iDice12 = RandomNumber( 15, 135 );
    var iDice13 = RandomNumber( 20, 300 );
    var iDice14 = RandomNumber( 15, 140 );
    var iDice15 = RandomNumber( 20, 300 );
    var iDice16 = RandomNumber( 15, 141 );
    var iDice17 = RandomNumber( 20, 300 );
    var iDice18 = RandomNumber( 15, 142 );
    var iDice19 = RandomNumber( 20, 300 );
    var iDice20 = RandomNumber( 15, 143 );
    var iDice21 = RandomNumber( 20, 300 );
    var iDice22 = RandomNumber( 15, 144 );
    var iDice23 = RandomNumber( 20, 300 );
    var iDice24 = RandomNumber( 15, 145 );
    var iDice25 = RandomNumber( 20, 300 );
    var iDice26 = RandomNumber( 15, 146 );
    var iDice27 = RandomNumber( 20, 300 );
    var iDice28 = RandomNumber( 15, 147 );
    var iDice29 = RandomNumber( 20, 300 );
    var iDice30 = RandomNumber( 15, 148 );
    var iDice31 = RandomNumber( 20, 300 );
    var iDice32 = RandomNumber( 15, 150 );
    myGump.AddPage(0);
    myGump.AddBackground( 0, 0, 350, 323, 0xE10 );
    myGump.AddGump( 0, 0, 0x2C96 );
    if( iUsed.GetTag( "fish1" ) )
    {
       myGump.AddPicture( iDice1, iDice2, 0x3B04 );
    }
    if( iUsed.GetTag( "fish2" ) )
    {
       myGump.AddPicture( iDice3, iDice4, 0x3AFF );
    }
    if( iUsed.GetTag( "fish3" ) )
    {
       myGump.AddPicture( iDice5, iDice6, 0x3B03 );
    }
    if( iUsed.GetTag( "fish4" ) )
    {
       myGump.AddPicture( iDice7, iDice8, 0x3B06 );
    }
    if( iUsed.GetTag( "fish5" ) )
    {
       myGump.AddPicture( iDice9, iDice10, 0x3B00 );
    }
    if( iUsed.GetTag( "fish6" ) )
    {
       myGump.AddPicture( iDice11, iDice12, 0x3B0D );
    }
    if( iUsed.GetTag( "fish7" ) )
    {
       myGump.AddPicture( iDice13, iDice14, 0x3AFD );
    }
    if( iUsed.GetTag( "fish8" ) )
    {
       myGump.AddPicture( iDice16, iDice16, 0x3B05 );
    }
    if( iUsed.GetTag( "fish9" ) )
    {
       myGump.AddPicture( iDice17, iDice18, 0x3B08 );
    }
    if( iUsed.GetTag( "fish10" ) )
    {
       myGump.AddPicture( iDice19, iDice20, 0x3B02 );
    }
    if( iUsed.GetTag( "fish11" ) )
    {
       myGump.AddPicture( iDice21, iDice22, 0x3B0E );
    }
    if( iUsed.GetTag( "fish12" ) )
    {
       myGump.AddPicture( iDice23, iDice24, 0x3AFE );
    }
    if( iUsed.GetTag( "fish13" ) )
    {
       myGump.AddPicture( iDice25, iDice26, 0x3B14 );
    }
    if( iUsed.GetTag( "fish14" ) )
    {
       myGump.AddPicture( iDice27, iDice28, 0x3AFC );
    }
    if( iUsed.GetTag( "fish15" ) )
    {
       myGump.AddPicture( iDice29, iDice30, 0x3B09 );
    }
    if( iUsed.GetTag( "fish16" ) )
    {
       myGump.AddPicture( iDice31, iDice32, 0x3B07 );
    }
    myGump.AddText( 20, 200, 0xFF, "Fish Count "+fishcount+"/10" );
    myGump.Send( pUser );
    myGump.Free();
    return false;
}
make sure you add this line to your jse_fileassociations
5087=custom/fishtank.js
Last edited by dragon slayer on Tue Mar 27, 2012 7:48 pm, edited 1 time in total.
Mindless Automaton
UOX3 Apprentice
Posts: 189
Joined: Wed May 10, 2006 3:48 am
Has thanked: 0
Been thanked: 1 time
Contact:

Post by Mindless Automaton »

dragon slayer wrote:Okay this just first version of the fish tank.

You can add all the fish from the fishbowl script this tank.
Plus its animated every time you open it those fish are some where else.

fishtank.js
That sounds cool. Can I use my fishing pole to get a tuna outta there? ;)

Thanks!
Mindless Automaton
Mindless Automaton
Linux - UOX3 - 0.99.5 dev branch
Win10Pro 19042.572 - UOX3 0.99.3a; Razor 1.0.14; Client 7.0.87.11 or 4.0.11c (Patch 0)
dragon slayer
UOX3 Guru
Posts: 776
Joined: Thu Dec 21, 2006 7:37 am
Has thanked: 4 times
Been thanked: 26 times

Post by dragon slayer »

Well next version I'm adding ship models and logs and some sea weed to put in the tank.

Then I'm going to try and add a fish feeding timer and a fish removal system :) so you can remove fish.
dragon slayer
UOX3 Guru
Posts: 776
Joined: Thu Dec 21, 2006 7:37 am
Has thanked: 4 times
Been thanked: 26 times

Post by dragon slayer »

add picture to first post
Post Reply