OSI snowman

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

OSI snowman

Post by dragon slayer »

I had to create two .js files for this as I'm not sure how to make one do samething for both ids.
[snowman]
{
script=5040
id=0x2328
weight=1000
newbie
dyeable
}

[snowman2]
{
id=0x2329
script=5041
weight=1000
newbie
dyeable
}
snowman.js
function onCreateDFN( objMade, objType )
{
    if( objType == 0 )
             if(objMade.id =0x2328 )
             {
        switch( RandomNumber( 0, 51 ) )
                {
                       case 0: objMade.name = "Backflash the Snowman"; break;
                       case 1: objMade.name = "Carbon the Snowman"; break;
                       case 2: objMade.name = "Colbalistic the Snowman"; break;
                       case 3: objMade.name = "Comforl the Snowman"; break;
                       case 4: objMade.name = "Coppacchia the Snowman"; break;
                       case 5: objMade.name = "Cyrus the Snowman"; break;
                       case 6: objMade.name = "DannyB the Snowman"; break;
                       case 7: objMade.name = "DJSoul the Snowman"; break;
                       case 8: objMade.name = "DraconisRex the Snowman"; break;
                       case 9: objMade.name = "Earia the Snowman"; break;
                       case 10: objMade.name = "Foster the Snowman"; break;
                       case 11: objMade.name = "Gonzo the Snowman"; break;
                       case 12: objMade.name = "Haan the Snowman"; break;
                       case 13: objMade.name = "Halona the Snowman"; break;
                       case 14: objMade.name = "Hugo the Snowman"; break;
                       case 15: objMade.name = "Hyacinth the Snowman"; break;
                       case 16: objMade.name = "Imirian the Snowman"; break;
                       case 17: objMade.name = "Jinsol the Snowman"; break;
                       case 18: objMade.name = "Liciatia the Snowman"; break;
                       case 19: objMade.name = "Loewen the Snowman"; break;
                       case 20: objMade.name = "Loke the Snowman"; break;
                       case 21: objMade.name = "Magnus the Snowman"; break;
                       case 22: objMade.name = "Maleki the Snowman"; break;
                       case 23: objMade.name = "Morpheus the Snowman"; break;
                       case 24: objMade.name = "Obberron the Snowman"; break;
                       case 25: objMade.name = "Odee the Snowman"; break;
                       case 26: objMade.name = "Orbeus the Snowman"; break;
                       case 27: objMade.name = "Pax the Snowman"; break;
                       case 28: objMade.name = "Phields the Snowman"; break;
                       case 29: objMade.name = "Pigpen the Snowman"; break;
                       case 30: objMade.name = "Platinum the Snowman"; break;
                       case 31: objMade.name = "Polpol the Snowman"; break;
                       case 32: objMade.name = "Prume the Snowman"; break;
                       case 33: objMade.name = "Quinnly the Snowman"; break;
                       case 34: objMade.name = "Ragnarok the Snowman"; break;
                       case 35: objMade.name = "Rend the Snowman"; break;
                       case 36: objMade.name = "Roland the Snowman"; break;
                       case 37: objMade.name = "RyanM the Snowman"; break;
                       case 38: objMade.name = "Screach the Snowman"; break;
                       case 39: objMade.name = "Seraph the Snowman"; break;
                       case 40: objMade.name = "Silvani the Snowman"; break;
                       case 41: objMade.name = "Sherbear the Snowman"; break;
                       case 41: objMade.name = "SkyWalker the Snowman"; break;
                       case 42: objMade.name = "Snark the Snowman"; break;
                       case 43: objMade.name = "Sowl the Snowman"; break;
                       case 44: objMade.name = "Spada the Snowman"; break;
                       case 45: objMade.name = "Starblade the Snowman"; break;
                       case 46: objMade.name = "Tenacious the Snowman"; break;
                       case 47: objMade.name = "Tnez the Snowman"; break;
                       case 48: objMade.name = "Wasia the Snowman"; break;
                       case 49: objMade.name = "Zilo the Snowman"; break;
                       case 50: objMade.name = "Zippy the Snowman"; break;
                       case 51: objMade.name = "Zoer the Snowman"; break;
                     default: objMade.name = "Ragnarok the Snowman"; break;
                }
             }
}
snowman2.js
function onCreateDFN( objMade, objType )
{
    if( objType == 0 )
             if(objMade.id =0x2329 )
             {
        switch( RandomNumber( 0, 51 ) )
                {
                       case 0: objMade.name = "Backflash the Snowman"; break;
                       case 1: objMade.name = "Carbon the Snowman"; break;
                       case 2: objMade.name = "Colbalistic the Snowman"; break;
                       case 3: objMade.name = "Comforl the Snowman"; break;
                       case 4: objMade.name = "Coppacchia the Snowman"; break;
                       case 5: objMade.name = "Cyrus the Snowman"; break;
                       case 6: objMade.name = "DannyB the Snowman"; break;
                       case 7: objMade.name = "DJSoul the Snowman"; break;
                       case 8: objMade.name = "DraconisRex the Snowman"; break;
                       case 9: objMade.name = "Earia the Snowman"; break;
                       case 10: objMade.name = "Foster the Snowman"; break;
                       case 11: objMade.name = "Gonzo the Snowman"; break;
                       case 12: objMade.name = "Haan the Snowman"; break;
                       case 13: objMade.name = "Halona the Snowman"; break;
                       case 14: objMade.name = "Hugo the Snowman"; break;
                       case 15: objMade.name = "Hyacinth the Snowman"; break;
                       case 16: objMade.name = "Imirian the Snowman"; break;
                       case 17: objMade.name = "Jinsol the Snowman"; break;
                       case 18: objMade.name = "Liciatia the Snowman"; break;
                       case 19: objMade.name = "Loewen the Snowman"; break;
                       case 20: objMade.name = "Loke the Snowman"; break;
                       case 21: objMade.name = "Magnus the Snowman"; break;
                       case 22: objMade.name = "Maleki the Snowman"; break;
                       case 23: objMade.name = "Morpheus the Snowman"; break;
                       case 24: objMade.name = "Obberron the Snowman"; break;
                       case 25: objMade.name = "Odee the Snowman"; break;
                       case 26: objMade.name = "Orbeus the Snowman"; break;
                       case 27: objMade.name = "Pax the Snowman"; break;
                       case 28: objMade.name = "Phields the Snowman"; break;
                       case 29: objMade.name = "Pigpen the Snowman"; break;
                       case 30: objMade.name = "Platinum the Snowman"; break;
                       case 31: objMade.name = "Polpol the Snowman"; break;
                       case 32: objMade.name = "Prume the Snowman"; break;
                       case 33: objMade.name = "Quinnly the Snowman"; break;
                       case 34: objMade.name = "Ragnarok the Snowman"; break;
                       case 35: objMade.name = "Rend the Snowman"; break;
                       case 36: objMade.name = "Roland the Snowman"; break;
                       case 37: objMade.name = "RyanM the Snowman"; break;
                       case 38: objMade.name = "Screach the Snowman"; break;
                       case 39: objMade.name = "Seraph the Snowman"; break;
                       case 40: objMade.name = "Silvani the Snowman"; break;
                       case 41: objMade.name = "Sherbear the Snowman"; break;
                       case 41: objMade.name = "SkyWalker the Snowman"; break;
                       case 42: objMade.name = "Snark the Snowman"; break;
                       case 43: objMade.name = "Sowl the Snowman"; break;
                       case 44: objMade.name = "Spada the Snowman"; break;
                       case 45: objMade.name = "Starblade the Snowman"; break;
                       case 46: objMade.name = "Tenacious the Snowman"; break;
                       case 47: objMade.name = "Tnez the Snowman"; break;
                       case 48: objMade.name = "Wasia the Snowman"; break;
                       case 49: objMade.name = "Zilo the Snowman"; break;
                       case 50: objMade.name = "Zippy the Snowman"; break;
                       case 51: objMade.name = "Zoer the Snowman"; break;
                     default: objMade.name = "Ragnarok the Snowman"; break;
                }
             }
}
User avatar
Xuri
Site Admin
Posts: 3704
Joined: Mon Jun 02, 2003 9:11 am
Location: Norway
Has thanked: 48 times
Been thanked: 8 times
Contact:

Post by Xuri »

Nice :) Here's an alternate method for you:

Code: Select all

var snowmanNames = new Array( "Backflash", "Carbon", "Colbalistic", "Comforl", "Coppacchia", "Cyrus",
							  "DannyB", "DJSoul", "DraconisRex", "Earia", "Foster", "Gonzo", "Haan", 
							  "Halona", "Hugo", "Hyacinth", "Imirian", "Jinsol" ); //and so forth
							
function onCreateDFN( objMade, objType )
{
	if( objType == 0 )
	{
		if( objMade.id == 0x2328 || objMade.id == 0x2329 )
		{
			var i = RandomNumber( 0, 51 );
			objMade.name = snowmanNames[i]+" the Snowman";
		}
	}
}
Also another tip - whenever you want to compare something, like "if X equals 7", use double equalizer symbols, like so: "if( X == 7 )"
-= Ho Eyo He Hum =-
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 »

thanks that looks much nicer and easyer hehe
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 »

Update V2

Fixed it to look like xuri script :)
much cleaner and nicer.

[snowman]
{
script=5040
id=0x2328
weight=1000
newbie
dyeable
}

[snowman2]
{
get=snowman
id=0x2329
}
snowman.js
var snowmanNames = new Array( "Backflash", "Carbon", "Colbalistic", "Comforl", "Coppacchia", "Cyrus",
                       "DannyB", "DJSoul", "DraconisRex", "Earia", "Foster", "Gonzo", "Haan",
                       "Halona", "Hugo", "Hyacinth", "Imirian", "Jinsol", "Liciatia","Loewen",
                       "Loke", "Magnus", "Maleki", "Morpheus", "Obberron", "Odee", "Orbeus", "Pax",
                       "Phields", "Pigpen", "Platinum", "Polpol", "Prume", "Quinnly", "Ragnarok",
                       "Rend", "Roland", "RyanM", "Screach", "Seraph", "Silvani", "Sherbear",
                       "SkyWalker", "Snark", "Sowl", "Spada", "Starblade", "Tenacious", "Tnez",
                       "Wasia", "Zilo", "Zippy", "Zoer"  );
                     
function onCreateDFN( objMade, objType )
{
   if( objType == 0 )
   {
      if( objMade.id == 0x2328 || objMade.id == 0x2329 )
      {
         var i = RandomNumber( 0, 51 );
         objMade.name = snowmanNames[i]+" the Snowman";
      }
   }
}
Post Reply