Go Back   RunUO - Ultima Online Emulation > RunUO > Custom Script Releases

Custom Script Releases This forum is where you can release your custom scripts for other users to use.

Please note: By releasing your scripts here you are submitting them to the public and as such agree to publish them under the GPL licensing terms. The RunUO Team has made its software GPL for you to use and enjoy you should do the same for anything based off of RunUO.

Reply
 
Thread Tools Display Modes
Old 06-05-2007, 02:28 PM   #51 (permalink)
Forum Novice
 
Nevaeh the Genie's Avatar
 
Join Date: Jul 2006
Location: Oregon (the place with alot of trees)
Posts: 332
Send a message via ICQ to Nevaeh the Genie Send a message via MSN to Nevaeh the Genie
Default

Client Version 5.0.6e
RunUO 2
Downloaded Music Box file, unzipped, and installed in customs.
I have not done any mods to my music files.
Getting the following errors.

Code:
Errors:
 + Customs/Decoration/Music Box/Music Box/Music Box Songs/ConversationWithGwenno
.cs:
    CS0117: Line 19: 'Server.MusicName' does not contain a definition for 'Gwenn
oConversation'
 + Customs/Decoration/Music Box/Music Box/Music Box Songs/DreadHornArea.cs:
    CS0117: Line 19: 'Server.MusicName' does not contain a definition for 'Dread
HornArea'
 + Customs/Decoration/Music Box/Music Box/Music Box Songs/ElfCity.cs:
    CS0117: Line 19: 'Server.MusicName' does not contain a definition for 'ElfCi
ty'
 + Customs/Decoration/Music Box/Music Box/Music Box Songs/GoodEndGame.cs:
    CS0117: Line 19: 'Server.MusicName' does not contain a definition for 'GoodE
ndGame'
 + Customs/Decoration/Music Box/Music Box/Music Box Songs/GoodVsEvil.cs:
    CS0117: Line 19: 'Server.MusicName' does not contain a definition for 'GoodV
sEvil'
 + Customs/Decoration/Music Box/Music Box/Music Box Songs/GreatEarthSerpentsThem
e.cs:
    CS0117: Line 19: 'Server.MusicName' does not contain a definition for 'Great
EarthSerpents'
 + Customs/Decoration/Music Box/Music Box/Music Box Songs/GrizzleDungeon.cs:
    CS0117: Line 19: 'Server.MusicName' does not contain a definition for 'Grizz
leDungeon'
 + Customs/Decoration/Music Box/Music Box/Music Box Songs/Humanoids.cs:
    CS0117: Line 19: 'Server.MusicName' does not contain a definition for 'Human
oids_U9'
 + Customs/Decoration/Music Box/Music Box/Music Box Songs/MelisandesLair.cs:
    CS0117: Line 19: 'Server.MusicName' does not contain a definition for 'Melis
andesLair'
 + Customs/Decoration/Music Box/Music Box/Music Box Songs/MinocNegative.cs:
    CS0117: Line 19: 'Server.MusicName' does not contain a definition for 'Minoc
Negative'
 + Customs/Decoration/Music Box/Music Box/Music Box Songs/ParoxysmusLair.cs:
    CS0117: Line 19: 'Server.MusicName' does not contain a definition for 'Parox
ysmusLair'
 + Customs/Decoration/Music Box/Music Box/Music Box Songs/Paws.cs:
    CS0117: Line 19: 'Server.MusicName' does not contain a definition for 'Paws'

 + Customs/Decoration/Music Box/Music Box/Music Box Songs/SelimsBarStrikeCommand
er.cs:
    CS0117: Line 19: 'Server.MusicName' does not contain a definition for 'Selim
sBar'
 + Customs/Decoration/Music Box/Music Box/Music Box Songs/UltimaVIISerpentIsleCo
mbat.cs:
    CS0117: Line 19: 'Server.MusicName' does not contain a definition for 'Serpe
ntIsleCombat_U7'
 + Customs/Decoration/Music Box/Music Box/Music Box Songs/ValoriaShips.cs:
    CS0117: Line 19: 'Server.MusicName' does not contain a definition for 'Valor
iaShips'
 + Customs/Decoration/Music Box/Music Box/MusicBox.cs:
    CS0117: Line 122: 'Server.MusicName' does not contain a definition for 'Gwen
noConversation'
    CS0117: Line 122: 'Server.MusicName' does not contain a definition for 'Good
EndGame'
    CS0117: Line 122: 'Server.MusicName' does not contain a definition for 'Good
VsEvil'
    CS0117: Line 123: 'Server.MusicName' does not contain a definition for 'Grea
tEarthSerpents'
    CS0117: Line 123: 'Server.MusicName' does not contain a definition for 'Huma
noids_U9'
    CS0117: Line 123: 'Server.MusicName' does not contain a definition for 'Mino
cNegative'
    CS0117: Line 123: 'Server.MusicName' does not contain a definition for 'Paws
'
    CS0117: Line 123: 'Server.MusicName' does not contain a definition for 'Seli
msBar'
    CS0117: Line 124: 'Server.MusicName' does not contain a definition for 'Serp
entIsleCombat_U7'
    CS0117: Line 124: 'Server.MusicName' does not contain a definition for 'Valo
riaShips'
    CS0117: Line 130: 'Server.MusicName' does not contain a definition for 'Drea
dHornArea'
    CS0117: Line 130: 'Server.MusicName' does not contain a definition for 'ElfC
ity'
    CS0117: Line 130: 'Server.MusicName' does not contain a definition for 'Meli
sandesLair'
    CS0117: Line 131: 'Server.MusicName' does not contain a definition for 'Paro
xysmusLair'
    CS0117: Line 131: 'Server.MusicName' does not contain a definition for 'Griz
zleDungeon'
Scripts: One or more scripts failed to compile or no script files were found.
 - Press return to exit, or R to try again.
Nevaeh the Genie is offline   Reply With Quote
Old 06-05-2007, 04:59 PM   #52 (permalink)
Forum Expert
 
Lokai's Avatar
 
Join Date: Aug 2003
Location: Bergen, NY (Rochester)
Age: 42
Posts: 1,493
Send a message via ICQ to Lokai Send a message via MSN to Lokai Send a message via Yahoo to Lokai
Default

@Nevaeh the Genie

I don't know what that means.

Check your Server files. In the Core, there is a file called Region.cs, and that starts out like this:

Code:
namespace Server
{
 public enum MusicName
 {
  Invalid = -1,
  OldUlt01 = 0,
  Create1,
  DragFlit,
  OldUlt02,
  OldUlt03,
  OldUlt04,
  OldUlt05,
  OldUlt06,
  Stones2,
  Britain1,
  Britain2,
  Bucsden,
  Jhelom,
  LBCastle,
  Linelle,
  Magincia,
  Minoc,
  Ocllo,
  Samlethe,
  Serpents,
  Skarabra,
  Trinsic,
  Vesper,
  Wind,
  Yew,
  Cave01,
  Dungeon9,
  Forest_a,
  InTown01,
  Jungle_a,
  Mountn_a,
  Plains_a,
  Sailing,
  Swamp_a,
  Tavern01,
  Tavern02,
  Tavern03,
  Tavern04,
  Combat1,
  Combat2,
  Combat3,
  Approach,
  Death,
  Victory,
  BTCastle,
  Nujelm,
  Dungeon2,
  Cove,
  Moonglow,
  Zento,
  TokunoDungeon,
  Taiko,
  DreadHornArea,
  ElfCity,
  GrizzleDungeon,
  MelisandesLair,
  ParoxysmusLair,
  GwennoConversation,
  GoodEndGame,
  GoodVsEvil,
  GreatEarthSerpents,
  Humanoids_U9,
  MinocNegative,
  Paws,
  SelimsBar,
  SerpentIsleCombat_U7,
  ValoriaShips
 }
So, I don't understand why your compiler would say Server.MusicName does not contain a definition for.... all those songs.
Lokai is offline   Reply With Quote
Old 06-05-2007, 05:19 PM   #53 (permalink)
Forum Expert
 
Lokai's Avatar
 
Join Date: Aug 2003
Location: Bergen, NY (Rochester)
Age: 42
Posts: 1,493
Send a message via ICQ to Lokai Send a message via MSN to Lokai Send a message via Yahoo to Lokai
Default

First post updated.

Added Animation. See first post for details.
Lokai is offline   Reply With Quote
Old 06-07-2007, 03:49 AM   #54 (permalink)
andrewd
Guest
 
Posts: n/a
Default client crash

im getting a client crash when server does a restart not sure if this is just me or not. just thought id post to see if it can be a fix in the script or is it something on my side.
  Reply With Quote
Old 06-07-2007, 05:41 AM   #55 (permalink)
Forum Expert
 
Lokai's Avatar
 
Join Date: Aug 2003
Location: Bergen, NY (Rochester)
Age: 42
Posts: 1,493
Send a message via ICQ to Lokai Send a message via MSN to Lokai Send a message via Yahoo to Lokai
Default

Quote:
Originally Posted by andrewd View Post
im getting a client crash when server does a restart not sure if this is just me or not. just thought id post to see if it can be a fix in the script or is it something on my side.
To be honest, I would have to think it is something on your side. Not positive, but cannot think of anything that would cause a client crash that was recently added.
Lokai is offline   Reply With Quote
Old 06-07-2007, 09:07 AM   #56 (permalink)
Forum Novice
 
Join Date: Jul 2004
Location: Vermont
Age: 50
Posts: 225
Default

I feel stupid! I figured out how it works.... *blushes* uhmmm can I blame it on mentalpause!?! lolol
__________________
:p Back up and save a world! :p

Last edited by Roseanne; 06-07-2007 at 09:20 AM.
Roseanne is offline   Reply With Quote
Old 06-07-2007, 09:20 AM   #57 (permalink)
Forum Novice
 
Fixxxer's Avatar
 
Join Date: Mar 2006
Location: upstate NY
Age: 36
Posts: 488
Default

Quote:
Originally Posted by Roseanne View Post
I still don't hear anything. Yes my music option is checked & my speaker volume is up.... would there be another reason for not being able to hear anything?
Probably is a stupid suggestions and all but did add songs to it? And selected a song as active in the index?? And your volume is up too?? Sometimes people overlook the simple stuff lol.

Sometimes they wont play on mine for some reason and I have to switch songs and then go back to the one I wanted to play. Other then that I dont know why you wouldnt hear music.
__________________
http://www.freewebs.com/sosariashonor/sosariashonor.gif
Fixxxer is offline   Reply With Quote
Old 06-07-2007, 09:44 AM   #58 (permalink)
Forum Novice
 
Join Date: Jul 2004
Location: Vermont
Age: 50
Posts: 225
Default

Sometimes, it doesn't work... and switching songs helps. Sometimes the songs will end and other go on & on... Has anyone figure out how to make it actually stop when you turn it off??? Does it work the same way on OSI?

Quote:
Originally Posted by Fixxxer View Post
Probably is a stupid suggestions and all but did add songs to it? And selected a song as active in the index?? And your volume is up too?? Sometimes people overlook the simple stuff lol.

Sometimes they wont play on mine for some reason and I have to switch songs and then go back to the one I wanted to play. Other then that I dont know why you wouldnt hear music.
__________________
:p Back up and save a world! :p
Roseanne is offline   Reply With Quote
Old 06-07-2007, 10:30 AM   #59 (permalink)
Newbie
 
Join Date: Sep 2006
Location: USA
Age: 51
Posts: 92
Default

This still doesn't work for me, I have mega cliloc errors and the music either doesn't play on the few that show, or loops like a broken record, he he which is kind of funny when that happens, but not what is suppose to occur.
Ml edition and not patched, both on the server AND client side, still results in Cliloc issues. Must be something I have modded, but I have not been able to figure it out yet.

I am still working on fixing the cliloc errors and when I do, I will ask to post them for anyone else having the same issues.
madron is offline   Reply With Quote
Old 06-07-2007, 10:35 AM   #60 (permalink)
Forum Master
 
Join Date: Oct 2005
Age: 46
Posts: 6,283
Default

Well, if you are getting cliloc errors, you either modified your cliloc (doubtful as I assume you would already have thought of that), or his cliloc has been patched by an OSI patch that was released after the ML client was originally released. I have only seen cliloc errors of that sort when cliloc numbers are used that are not in the cliloc file being used by that client or server.
__________________
Why is it that I'm never as smart as I thought I was yesterday?
My vast knowledge is only surpassed by my infinite ignorance.
<TheOutkastDev> i might have to hire an assassin to killl mal so that i can jump in front of the bullet and piss on him
Malaperth is offline   Reply With Quote
Old 06-07-2007, 10:40 AM   #61 (permalink)
Newbie
 
Join Date: Sep 2006
Location: USA
Age: 51
Posts: 92
Default

Quote:
Originally Posted by Malaperth View Post
Well, if you are getting cliloc errors, you either modified your cliloc (doubtful as I assume you would already have thought of that), or his cliloc has been patched by an OSI patch that was released after the ML client was originally released. I have only seen cliloc errors of that sort when cliloc numbers are used that are not in the cliloc file being used by that client or server.

Oh karma to you, thats it!!! omg! rofl. I have never touched clilocs before this script. You saved me a ton of work, but I do not know how to correct this on my end, other than to mod the scripts, its a lot of work, and I am not sure my scripting abilities are up to it, but I am trying. Any other ideas ?


Edited to add: I could go back and add the entries from an unpatched ML version, yes? This might work, my way is like a ton of mod work!
madron is offline   Reply With Quote
Old 06-07-2007, 10:44 AM   #62 (permalink)
Forum Master
 
Join Date: Oct 2005
Age: 46
Posts: 6,283
Default

I would just patch your files personally. From what I understand, if you start the 2D client, the autopatch will stop at version 5.0.6(something) although I have only heard that from one post and have not tried it myself. You can back up the entire UO directory before you patch so if it causes unpleasantness you can put the version you had back and be where you started.
__________________
Why is it that I'm never as smart as I thought I was yesterday?
My vast knowledge is only surpassed by my infinite ignorance.
<TheOutkastDev> i might have to hire an assassin to killl mal so that i can jump in front of the bullet and piss on him
Malaperth is offline   Reply With Quote
Old 06-07-2007, 11:01 AM   #63 (permalink)
Newbie
 
Join Date: Sep 2006
Location: USA
Age: 51
Posts: 92
Default

Quote:
Originally Posted by Malaperth View Post
I would just patch your files personally. From what I understand, if you start the 2D client, the autopatch will stop at version 5.0.6(something) although I have only heard that from one post and have not tried it myself. You can back up the entire UO directory before you patch so if it causes unpleasantness you can put the version you had back and be where you started.
I did this a while back when 6.0 came out, and OMG hellish crap! I worked for three days to get UO maps working etc... and the graphics for KR in 2D sucked, so I reverted. Reasons I reverted is that patching even a tiny bit, puts something into the client that creates havoc with custom maps; one being using UOARCH copied items that were not there, it was just a bloody mess!

So my solution, if I want to use this script, is to go in and Mod the script to use my version of clilocs. I want this to go with my dancing script, which I just finished. Thank you very much Malaperth, I would not of thought of this on my own.
madron is offline   Reply With Quote
Old 06-07-2007, 11:13 AM   #64 (permalink)
Forum Master
 
Join Date: Oct 2005
Age: 46
Posts: 6,283
Default

The choice is yours, but take a look at this thread before you decide. If you back up your UO install, you can't lose anything

http://www.runuo.com/forums/server-s...an-change.html
__________________
Why is it that I'm never as smart as I thought I was yesterday?
My vast knowledge is only surpassed by my infinite ignorance.
<TheOutkastDev> i might have to hire an assassin to killl mal so that i can jump in front of the bullet and piss on him
Malaperth is offline   Reply With Quote
Old 06-07-2007, 11:28 AM   #65 (permalink)
Newbie
 
Join Date: Sep 2006
Location: USA
Age: 51
Posts: 92
Default

Okay, I am going to give it a try once more. When I first did this, it was during the transition of the first 6.0 patch. * crosses fingers and backs up everything*

Thanks again Malaperth, huge help
madron is offline   Reply With Quote
Old 06-11-2007, 10:30 AM   #66 (permalink)
Forum Expert
 
Erica's Avatar
 
Join Date: Jan 2005
Location: Laramie, Wyoming
Age: 45
Posts: 1,699
Send a message via ICQ to Erica Send a message via AIM to Erica Send a message via MSN to Erica Send a message via Yahoo to Erica Send a message via Skype™ to Erica
Default

Got a fix now players can use it while locked down heres the script in codes.
Code:
using System;
using System.Collections;
using System.Collections.Generic;
using Server;
using Server.Targeting;
using Server.Gumps;
using Server.ContextMenus;
using Server.Network;
using Server.Mobiles;
using Server.Commands;
using Server.Items;
using Server.Multis;

namespace Server.Items.MusicBox
{
    [Flipable(0x2AF9, 0x2AFD)]
    public class MusicBox : Item, ISecurable
    {
		public static void Initialize() 
		{
            CommandSystem.Register("AddAllSongs", AccessLevel.GameMaster, new CommandEventHandler(AddAllSongs_OnCommand)); 
		}

        [Usage("AddAllSongs")]
        [Description("Adds all songs to the MusicBox.")]

        public static void AddAllSongs_OnCommand(CommandEventArgs e)
        {
            e.Mobile.SendMessage("Target the MusicBox.");
            e.Mobile.Target = new InternalTarget();
        }

        public class InternalTarget : Target
        {
            public InternalTarget()
                : base(1, false, TargetFlags.None)
            {
            }

            protected override void OnTarget(Mobile from, object o)
            {
                if (o is MusicBox)
                {
                    from.SendMessage("All Tracks were added to the Music Box!");
                    ((MusicBox)o).AddAllTracks();
                }
                else
                    from.SendMessage("That is not a Music Box!");
            }
        }

        public const int SONGS = 51;

        // Set animationSpeed to speed up or slow down the animation.
        // 0.10 (VERY FAST), 0.22 (FAST), 0.36 (NORMAL), 0.58 (SLOW), 0.92(VERY SLOW)
        private double animationSpeed = 0.36;
        private Packet p;
        private SecureLevel m_Level;

	  [CommandProperty( AccessLevel.GameMaster )]
	  public SecureLevel Level
	  {
		  get{ return m_Level; }
		  set{ m_Level = value; }
	  }


        [Constructable]
        public MusicBox()
            : base(0x2AF9)
        {
            Name = "Dawn's MusicBox: Stopped";
            Weight = 3.0;
            m_HasTrack = new bool[SONGS];
            for (int x = 0; x < SONGS; x++)
            {
                m_HasTrack[x] = false;
            }
            AddTrack(new MusicBoxTrack(1075144));
            m_Music = MusicName.Britain1;
            m_HasTrack[12] = true; //Default Song: Britain1
        }

        public MusicBox(Serial serial)
            : base(serial)
        {
        }

		public override void GetContextMenuEntries( Mobile from, List<ContextMenuEntry> list )
		{
			base.GetContextMenuEntries( from, list );
                  SetSecureLevelEntry.AddTo( from, this, list );
                 list.Add(new PlayListEntry(from, this));
        }

        bool playing;

        public override void OnDoubleClick(Mobile from)
        {
            if (GetSong() < 0)
                return;

            if (from.AccessLevel < AccessLevel.GameMaster)
            {
                if (playing)
                {
                    StopMusic(from);
                    Name = "Dawn's MusicBox: Stopped";
                    p.Release();
                }
                else
                {
                    PlayMusic(from);
                    Name = "Dawn's MusicBox: Playing";
                }
            }
            else
            {
                IPooledEnumerable eable = from.Map.GetMobilesInRange(from.Location, m_Range);
                ArrayList list = new ArrayList();
                foreach (Mobile mob in eable)
                {
                    if (playing)
                        StopMusic(mob);
                    else
                        PlayMusic(mob);
                }
                eable.Free();
                if (playing)
                    Name = "Dawn's MusicBox: Stopped";
                else
                    Name = "Dawn's MusicBox: Playing";
            }
            playing = !playing;
            if (playing) Animate(true);
            else Animate(false);
        }

        private static int[] Length = new int[] { 106, 128, 114, 126, 74, 68, 114, 219, 285, 118, 
            48, 135, 53, 39, 59, 36, 17, 62, 66, 56, 56, 48, 61, 36, 35, 60, 58, 50, 18, 22, 18, 
            18, 48, 50, 52, 20, 17, 98, 54, 58, 58, 60, 148, 88, 227, 120, 321, 120, 120, 36, 120 };

        private static int[] m_Locals = new int[] { 1075131, 1075132, 1075133, 1075134, 1075135, 1075136, 1075137, 
            1075138, 1075139, 1075140, 1075142, 1075143, 1075144, 1075145, 1075146, 1075147, 1075148, 1075149, 
            1075150, 1075151, 1075152, 1075154, 1075155, 1075156, 1075157, 1075158, 1075159, 1075160, 1075163, 
            1075164, 1075165, 1075166, 1075167, 1075168, 1075170, 1075171, 1075172, 1075173, 1075174, 1075175, 
            1075176, 1075177, 1075178, 1075179, 1075180, 1075181, 1075182, 1075183, 1075184, 1075185, 1075186
        };

        private static MusicName[] m_Songs = new MusicName[] { 
            MusicName.GwennoConversation,MusicName.GoodEndGame,MusicName.GoodVsEvil,
            MusicName.GreatEarthSerpents,MusicName.Humanoids_U9,MusicName.MinocNegative,MusicName.Paws,MusicName.SelimsBar,
            MusicName.SerpentIsleCombat_U7,MusicName.ValoriaShips,MusicName.OldUlt02,MusicName.Serpents,MusicName.Britain1,
            MusicName.Britain2,MusicName.Bucsden,MusicName.Jhelom,MusicName.LBCastle,MusicName.Magincia,MusicName.Minoc,
            MusicName.Ocllo,MusicName.Samlethe,MusicName.Skarabra,MusicName.Trinsic,MusicName.Vesper,MusicName.Wind,
            MusicName.Yew,MusicName.Cave01,MusicName.Dungeon9,MusicName.Sailing,MusicName.Tavern01,MusicName.Tavern02,
            MusicName.Tavern03,MusicName.Tavern04,MusicName.Combat1,MusicName.Combat3,MusicName.Death,MusicName.Victory,
            MusicName.BTCastle,MusicName.Nujelm,MusicName.Dungeon2,MusicName.Cove,MusicName.Moonglow,MusicName.Zento,
            MusicName.TokunoDungeon,MusicName.Taiko,MusicName.DreadHornArea,MusicName.ElfCity,MusicName.MelisandesLair,
            MusicName.ParoxysmusLair,MusicName.Linelle,MusicName.GrizzleDungeon
        };

        public static int[] Locals
        {
            get { return m_Locals; }
        }

        public static MusicName[] Songs
        {
            get { return m_Songs; }
        }

        private bool[] m_HasTrack;

        public bool[] HasTrack
        {
            get { return m_HasTrack; }
            set { m_HasTrack = value; }
        }

        public void AddTrack(MusicBoxTrack track)
        {
            for (int x = 0; x < MusicBox.SONGS; x++)
            {
                if (track.Song == MusicBox.Songs[x])
                {
                    m_HasTrack[x] = true;
                }
            }
        }

        private Timer AnimateTimer = new Timer(TimeSpan.Zero);

        public virtual void Animate(bool running)
        {
            if (!running && AnimateTimer.Running)
                AnimateTimer.Stop();
            else if (running && !AnimateTimer.Running)
                AnimateTimer = Timer.DelayCall(TimeSpan.FromSeconds(animationSpeed), TimeSpan.FromSeconds((double)Length[GetSong()]), 
                new TimerStateCallback(Tick), this);
        }

        public virtual void Tick(object o)
        {
            switch (ItemID)
            {
                case 0x2AF9: ItemID = 0x2AFA; break;
                case 0x2AFA: ItemID = 0x2AFB; break;
                case 0x2AFB: ItemID = 0x2AFC; break;
                case 0x2AFC: ItemID = 0x2AF9; break;
                case 0x2AFD: ItemID = 0x2AFE; break;
                case 0x2AFE: ItemID = 0x2AFF; break;
                case 0x2AFF: ItemID = 0x2B00; break;
                case 0x2B00: ItemID = 0x2AFD; break;
            }
        }

        private int GetSong()
        {
            for (int x = 0; x < SONGS; x++)
            {
                if (m_Music == m_Songs[x])
                    return x;
            }
            return -1;
        }

        public void AddAllTracks()
        {
            for (int x = 0; x < MusicBox.SONGS; x++)
            {
                m_HasTrack[x] = true;
            }
        }

        private int m_Range = 10;

        [CommandProperty(AccessLevel.GameMaster)]
        public int Range
        {
            get { return m_Range; }
            set { m_Range = value; }
        }

        private MusicName m_Music = MusicName.Invalid;

        [CommandProperty(AccessLevel.GameMaster)]
        public MusicName Music
        {
            get { return m_Music; }
            set { m_Music = value;
                if (GetSong() < 0) m_Music = MusicName.Britain1;
                InvalidateProperties(); }
        }

        public virtual void PlayMusic(Mobile m)
        {
            if (m_Music != MusicName.Invalid && m.NetState != null)
            {
                p = Network.PlayMusic.GetInstance(m_Music);
                m.Send(p);
            }
        }

        public virtual void StopMusic(Mobile m)
        {
            if (m_Music != MusicName.Invalid && m.NetState != null)
            {
                p = Network.PlayMusic.GetInstance(m.Region.Music);
                m.Send(p);
            }
        }

        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);
            writer.Write((int)0); // version
            writer.WriteEncodedInt( (int) m_Level );

            writer.Write((int)m_Range);
            writer.Write((int)m_Music);
            for (int x = 0; x < SONGS; x++)
            {
                writer.Write((bool)m_HasTrack[x]);
            }
        }

        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();
            m_Level = (SecureLevel) reader.ReadEncodedInt();
            m_Range = reader.ReadInt();
            m_Music = (MusicName)reader.ReadInt();
            m_HasTrack = new bool[SONGS];
            for (int x = 0; x < SONGS; x++)
            {
                m_HasTrack[x] = reader.ReadBool();
            }
            Name = "Dawn's MusicBox: Stopped";
        }
    }

    public class PlayListEntry : ContextMenuEntry
    {
        private Mobile m_From;
        private MusicBox m_Box;

        public PlayListEntry(Mobile from, MusicBox box)
            : base(10003, 1)
        {
            m_From = from;
            m_Box = box;
        }

        public override void OnClick()
        {
            m_From.SendGump(new PlayListGump(m_From, m_Box));
        }
    }

    public class PlayListGump : Gump
    {
        private MusicBox m_Box;
        private Mobile m_From;

        public PlayListGump(Mobile from, MusicBox box)
            : base(30, 30)
        {
            from.CloseGump(typeof(PlayListGump));
            m_Box = box;
            m_From = from;
            AddBackground(0, 0, 600, 480, 9400);
            AddPage(0);
            AddHtmlLocalized(250, 10, 180, 20, 1075130, 2124, false, false);
            int Xpos = 26, Ypos = 42;
            int z = 0;
            for (int x = 0; x < 3; x++)
            {
                for (int y = 0; y < 17; y++)
                {
                    bool has = (box.HasTrack[z]);
                    AddSongEntry(Xpos, Ypos, MusicBox.Locals[z], has ? 177 : 547, z + 100, has);
                    Ypos += 20;
                    z++;
                }
                Xpos += 200;
                Ypos = 42;
            }
            AddLabel(250, 460, 2124, "Add Songs");
            AddButton(220, 460, 1210, 1210, 99, GumpButtonType.Reply, 0);
        }

        private void AddSongEntry(int x, int y, int local, int color, int song, bool active)
        {
            AddHtmlLocalized(x, y, 180, 20, local, color, false, false);
            if (active) AddButton(x - 20, y, 1210, 1210, song, GumpButtonType.Reply, 0);
        }

        public override void OnResponse(NetState sender, RelayInfo info)
        {
            if (info.ButtonID == 99)
            {
                m_From.Target = new InternalTarget(this);
            }
            else if (info.ButtonID > 99)
            {
                m_Box.Music = MusicBox.Songs[info.ButtonID - 100];
                m_From.SendMessage("Now active:");
                m_From.SendLocalizedMessage(MusicBox.Locals[info.ButtonID - 100]);
            }
            else
                return;
        }

        public void Target(MusicBoxTrack target)
        {
            for (int x = 0; x < MusicBox.SONGS; x++)
            {
                if (target.Song == MusicBox.Songs[x])
                {
                    if (!m_Box.HasTrack[x])
                    {
                        m_Box.HasTrack[x] = true;
                        target.Delete();
                        m_From.SendMessage("Song successfully added.");
                    }
                    else
                        m_From.SendMessage("That song is already added.");
                }
            }
        }

        public class InternalTarget : Target
        {
            private PlayListGump m_Owner;

            public InternalTarget(PlayListGump owner)
                : base(1, false, TargetFlags.None)
            {
                m_Owner = owner;
            }

            protected override void OnTarget(Mobile from, object o)
            {
                if (o is MusicBoxTrack)
                {
                    m_Owner.Target((MusicBoxTrack)o);
                }
                else
                    from.SendMessage("That is not a Song Track!");
            }
        }
    }
}
all you gotta do is Add everything thats in red color and will work for players.
__________________

Last edited by Erica; 06-11-2007 at 10:37 AM.
Erica is offline   Reply With Quote
Old 06-11-2007, 12:13 PM   #67 (permalink)
Forum Expert
 
Lokai's Avatar
 
Join Date: Aug 2003
Location: Bergen, NY (Rochester)
Age: 42
Posts: 1,493
Send a message via ICQ to Lokai Send a message via MSN to Lokai Send a message via Yahoo to Lokai
Default

Thank you, Erica.

I would advise the following change to your Serialization, to prevent having to wipe all existing MusicBoxes:

Code:
        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);
            writer.Write((int)1); // version

            writer.WriteEncodedInt( (int) m_Level ); //version 1
 
            writer.Write((int)m_Range); //version 0
            writer.Write((int)m_Music);
            for (int x = 0; x < SONGS; x++)
            {
                writer.Write((bool)m_HasTrack[x]);
            }
        }
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();
   switch(version)
   {
    case 1:
    {
              m_Level = (SecureLevel) reader.ReadEncodedInt();
     goto case 0;
    }
    case 0:
    {
              m_Range = reader.ReadInt();
              m_Music = (MusicName)reader.ReadInt();
              m_HasTrack = new bool[SONGS];
              for (int x = 0; x < SONGS; x++)
              {
                  m_HasTrack[x] = reader.ReadBool();
              }
     break;
    }
   }
            Name = "Dawn's MusicBox: Stopped";
        }
Lokai is offline   Reply With Quote
Old 06-11-2007, 01:07 PM   #68 (permalink)
Forum Expert
 
Erica's Avatar
 
Join Date: Jan 2005
Location: Laramie, Wyoming
Age: 45
Posts: 1,699
Send a message via ICQ to Erica Send a message via AIM to Erica Send a message via MSN to Erica Send a message via Yahoo to Erica Send a message via Skype™ to Erica
Default

Quote:
Originally Posted by Lokai View Post
Thank you, Erica.

I would advise the following change to your Serialization, to prevent having to wipe all existing MusicBoxes:

Code:
        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);
            writer.Write((int)1); // version

            writer.WriteEncodedInt( (int) m_Level ); //version 1
 
            writer.Write((int)m_Range); //version 0
            writer.Write((int)m_Music);
            for (int x = 0; x < SONGS; x++)
            {
                writer.Write((bool)m_HasTrack[x]);
            }
        }
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();
   switch(version)
   {
    case 1:
    {
              m_Level = (SecureLevel) reader.ReadEncodedInt();
     goto case 0;
    }
    case 0:
    {
              m_Range = reader.ReadInt();
              m_Music = (MusicName)reader.ReadInt();
              m_HasTrack = new bool[SONGS];
              for (int x = 0; x < SONGS; x++)
              {
                  m_HasTrack[x] = reader.ReadBool();
              }
     break;
    }
   }
            Name = "Dawn's MusicBox: Stopped";
        }
Thanks but didnt have to fix that since i never added to my shard till i made my own fix so its not necessary for me to do that.
__________________
Erica is offline   Reply With Quote
Old 06-11-2007, 01:09 PM   #69 (permalink)
Forum Novice
 
Raider's Avatar
 
Join Date: Jan 2005
Age: 33
Posts: 289
Send a message via Yahoo to Raider
Default

Thanks Erica for that fix plus Karma for you.
__________________
Raider is offline   Reply With Quote
Old 06-11-2007, 01:16 PM   #70 (permalink)
Forum Expert
 
Lokai's Avatar
 
Join Date: Aug 2003
Location: Bergen, NY (Rochester)
Age: 42
Posts: 1,493
Send a message via ICQ to Lokai Send a message via MSN to Lokai Send a message via Yahoo to Lokai
Default

Quote:
Originally Posted by Erica View Post
Thanks but didnt have to fix that since i never added to my shard till i made my own fix so its not necessary for me to do that.
Yeah, I figured that would have been the case for you.

I was kinda just showing that for everyone else's benefit, not for you specifically.

Thanks again.
Lokai is offline   Reply With Quote
Old 06-12-2007, 02:22 AM   #71 (permalink)
Account Terminated
 
Join Date: Jan 2004
Posts: 99
Default

The problem with the animation sometimes working and sometimes not is, first, you are trying to cycle through 4 frames:

Code:
AnimateTimer = Timer.DelayCall(TimeSpan.FromSeconds(animationSpeed), TimeSpan.FromSeconds((double)Length[GetSong()]), new TimerStateCallback(Tick), this);
However, what this does is it only changes twice, one at TimeSpan.FromSeconds(animationSpeed), another at TimeSpan.FromSeconds((double)Length[GetSong()]).

It should have been
Code:
AnimateTimer = Timer.DelayCall(TimeSpan.FromSeconds(animationSpeed), TimeSpan.FromSeconds(animationSpeed), (int)((double)Length[GetSong()]/animationSpeed), new TimerStateCallback(Tick), this);
This will cycle through the four frames at interval of TimeSpan.FromSeconds(animationSpeed), and stops after TimeSpan.FromSeconds((double)Length[GetSong()]).

Second, 0x29fa is an animated frame, the other three are static frames. So when it appears the animation is on, is really when the box is switched to this frame, not the actual 4 frame switching you intended. So if you just want the animation to show when it is locked down, what you can do is really just switching between the animated frame and one of the static frame (any one of them) when the box turns on and off, and using the Timer.Delaycall to switch to that static frame when the music stops. However if you also want the animation to show when it is inside a player's backpack or an container, you will have to do the four frame cycling using the correct code segment as mentioned above. The interval however have to be shorter than the speed of the animated frame itself, or you will see some strange effect when it switches to that frame.

Hope this explains why the animation sometime works and sometimes not.

Rocko

Last edited by Rocko Wang; 06-12-2007 at 02:36 AM.
Rocko Wang is offline   Reply With Quote
Old 06-12-2007, 07:07 AM   #72 (permalink)
Forum Expert
 
Lokai's Avatar
 
Join Date: Aug 2003
Location: Bergen, NY (Rochester)
Age: 42
Posts: 1,493
Send a message via ICQ to Lokai Send a message via MSN to Lokai Send a message via Yahoo to Lokai
Default

Quote:
Originally Posted by Rocko Wang View Post
The problem with the animation sometimes working and sometimes not is, first, you are trying to cycle through 4 frames:

Code:
AnimateTimer = Timer.DelayCall(TimeSpan.FromSeconds(animationSpeed), TimeSpan.FromSeconds((double)Length[GetSong()]), new TimerStateCallback(Tick), this);
However, what this does is it only changes twice, one at TimeSpan.FromSeconds(animationSpeed), another at TimeSpan.FromSeconds((double)Length[GetSong()]).

It should have been
Code:
AnimateTimer = Timer.DelayCall(TimeSpan.FromSeconds(animationSpeed), TimeSpan.FromSeconds(animationSpeed), (int)((double)Length[GetSong()]/animationSpeed), new TimerStateCallback(Tick), this);
This will cycle through the four frames at interval of TimeSpan.FromSeconds(animationSpeed), and stops after TimeSpan.FromSeconds((double)Length[GetSong()]).
Thank you for explaining this.

Quote:
Originally Posted by Rocko Wang
Second, 0x29fa is an animated frame, the other three are static frames. So when it appears the animation is on, is really when the box is switched to this frame, not the actual 4 frame switching you intended.
*DOH!* That explains why I see the animation running when I log in to the shard!

Quote:
Originally Posted by Rocko Wang
So if you just want the animation to show when it is locked down, what you can do is really just switching between the animated frame and one of the static frame (any one of them) when the box turns on and off, and using the Timer.Delaycall to switch to that static frame when the music stops. However if you also want the animation to show when it is inside a player's backpack or an container, you will have to do the four frame cycling using the correct code segment as mentioned above. The interval however have to be shorter than the speed of the animated frame itself, or you will see some strange effect when it switches to that frame.

Hope this explains why the animation sometime works and sometimes not.

Rocko
This has helped. I have modified my version. Once I have tested, I will re-post the script.

Thanks!
Lokai is offline   Reply With Quote
Old 06-24-2007, 09:10 PM   #73 (permalink)
Forum Expert
 
Lokai's Avatar
 
Join Date: Aug 2003
Location: Bergen, NY (Rochester)
Age: 42
Posts: 1,493
Send a message via ICQ to Lokai Send a message via MSN to Lokai Send a message via Yahoo to Lokai
Default

Please enjoy latest update to this just posted:


- New and Improved version posted.
- Includes new files. Now, you can obtain a MusicBox from an Addon Deed.
- MusicBoxEastDeed and MusicBoxSouthDeed.
- Better Animation and Timing handling.
- Animation stops when supposed to. If song loops, Animation stops after first loop.
- Name of Music Box changes appropriately when Stopped or Playing, including listing the Title of the song.
- When played by GM and above, will play the song to surrounding players, and will stop their MusicBoxes too.

RC1 NOTE - all you need to do is comment out this line:

#define SVN
Lokai is offline   Reply With Quote
Old 06-26-2007, 03:03 PM   #74 (permalink)
Lurker
 
Join Date: Jun 2006
Posts: 7
Default

I inzipped these scripts in my custom folder and recieved the error,s below did i miss a step? Errors:
+ scripts1/Music Box/MusicBox.cs:
CS0115: Line 56: 'Server.Items.MusicBox.MusicBox.DisplayWeight': no suitable
method found to override
+ scripts1/Music Box/MusicBoxComponent.cs:
CS0115: Line 60: 'Server.Items.MusicBox.MusicBoxComponent.DisplayWe ight': no
suitable method found to override
strattman_2006 is offline   Reply With Quote
Old 06-26-2007, 03:18 PM   #75 (permalink)
Forum Expert
 
Lokai's Avatar
 
Join Date: Aug 2003
Location: Bergen, NY (Rochester)
Age: 42
Posts: 1,493
Send a message via ICQ to Lokai Send a message via MSN to Lokai Send a message via Yahoo to Lokai
Default

Quote:
Originally Posted by strattman_2006 View Post
I inzipped these scripts in my custom folder and recieved the error,s below did i miss a step? Errors:
+ scripts1/Music Box/MusicBox.cs:
CS0115: Line 56: 'Server.Items.MusicBox.MusicBox.DisplayWeight': no suitable
method found to override
+ scripts1/Music Box/MusicBoxComponent.cs:
CS0115: Line 60: 'Server.Items.MusicBox.MusicBoxComponent.DisplayWe ight': no
suitable method found to override
Yes:

RC1 NOTE - all you need to do is comment out this line:

#define SVN
Lokai is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5