Go Back   RunUO - Ultima Online Emulation > RunUO > Script Support

Script Support Get support for modifying RunUO Scripts, or writing your own!

Reply
 
Thread Tools Display Modes
Old 09-17-2008, 11:53 AM   #1 (permalink)
Newbie
 
Join Date: Jul 2006
Age: 18
Posts: 17
Post end of file?

it keeps telling me that i need a type or namespace definition, or end of file on the last line... ive tried adding extra brackets... but more then likely im missing something... anyone have advice?

Code:
using System;
using System.Collections;
using Server.Items;
using Server.Targeting;
using Server.ContextMenus;
using Server.Gumps;
using Server.Misc;
using Server.Network;
using Server.Spells;
using System.Collections.Generic;

namespace Server.Mobiles
{
    [CorpseName("Corpse Of HarpySlayer")]
    public class HarpySlayer : BaseCreature
    {
        [Constructable]
	public HarpySlayer() : base( AIType.AI_Melee, FightMode.Aggressor, 10, 1, 0.2, 0.4 ) 
        {
           	Name = "Jack";
            Title = "the harpy slayer";

            Body = 400;
            Hue = 1801;
		Female = false;

		SetStr( 100, 130 );
		SetDex( 130, 145 );
		SetInt( 170, 190 );

		SetHits( 2100, 2300 );

	    	Item hair = new Item( 8260 );
			
	    	hair.Hue = 44;
	    	hair.Layer = Layer.Hair;
	    	hair.Movable = true;
	    	AddItem( hair );

	    	Sandals feet = new Sandals();
	    	feet.Hue = 1175;
  	    	feet.Movable = true;
          	AddItem(feet);

            LeatherNinjaPants legs = new LeatherNinjaPants();
	    	legs.Hue = 0;
            legs.Movable = true;
            AddItem(legs);
        }

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

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

        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);
            writer.Write((int)0);
        }

        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();
        }

        public class HarpySlayerQuestEntry : ContextMenuEntry
        {
            private Mobile m_Mobile;
            private Mobile m_Giver;

            public override void OnClick()
            {
                if (!(m_Mobile is PlayerMobile))
                    return;

                PlayerMobile mobile = (PlayerMobile)m_Mobile;

                if (!mobile.HasGump(typeof(HarpyQuestGump)))
                {
                    mobile.SendGump(new HarpyQuestGump(mobile));
                }
	    }
	}

        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            PlayerMobile m = from as PlayerMobile;

           			if ( mobile != null)
			{
				if( dropped is ToadSkin )
         		{
         			if(dropped.Amount!=20)
         			{
                        mobile.SendGump(new HarpyQuestGump1(m));
				mobile.AddToBackpack( new JacksRegards() );
                        mobile.SendMessage("This is going to turn out nicely!");
                        dropped.Delete();
                        return true;
                    }

                    return false;
                }
                else if (dropped is QuestSyrup)
                {
                    Container pack = from.Backpack;

                    if (pack != null)
                    {
                        m.SendGump(new HarpyQuestGump2(m));
                        m.SendMessage("Excellent!");
                        dropped.Delete();
                        return true;
                    }
                    return false;
		}
                else if (dropped is HarpyClaw)
                {
                    Container pack = from.Backpack;

                    if (pack != null)
                    {
                        m.AddToBackpack(new HarpyTalons());
                        m.SendMessage("I hope you enjoy your new peice of armor!");
                        dropped.Delete();
                        return true;
                    }
                    return false;
                }
                else
                {
                    this.PrivateOverheadMessage(MessageType.Regular, 1153, false, "Bring me what I asked for!", m.NetState);
                }
            }
		return false;
			}
		}
	}
}
}
Joel007 is offline   Reply With Quote
Old 09-17-2008, 12:15 PM   #2 (permalink)
Forum Expert
 
Vorspire's Avatar
 
Join Date: Jan 2005
Location: Newcastle, United Kingdom
Age: 21
Posts: 2,298
Send a message via ICQ to Vorspire Send a message via MSN to Vorspire Send a message via Skype™ to Vorspire
Default

Take 2 of the closing braces off the very end of your script you have 2 too many :P
__________________

WWW.RPK-UO.COM - The WoW-UO Cross-Over Shard
Vorspire is offline   Reply With Quote
Old 09-17-2008, 12:18 PM   #3 (permalink)
Newbie
 
Join Date: Jul 2006
Age: 18
Posts: 17
Default

my bad... forgot i had added those, it still didnt work...

that was just me getting mad that it was telling me i needed one... =P
Joel007 is offline   Reply With Quote
Old 09-17-2008, 01:39 PM   #4 (permalink)
ConnectUO Creator
 
Jeff's Avatar
 
Join Date: Jan 2004
Age: 28
Posts: 4,891
Default

Code:
using System;
using System.Collections;
using Server.Items;
using Server.Targeting;
using Server.ContextMenus;
using Server.Gumps;
using Server.Misc;
using Server.Network;
using Server.Spells;
using System.Collections.Generic;

namespace Server.Mobiles
{
    [CorpseName("Corpse Of HarpySlayer")]
    public class HarpySlayer : BaseCreature
    {
        [Constructable]
        public HarpySlayer()
            : base(AIType.AI_Melee, FightMode.Aggressor, 10, 1, 0.2, 0.4)
        {
            Name = "Jack";
            Title = "the harpy slayer";

            Body = 400;
            Hue = 1801;
            Female = false;

            SetStr(100, 130);
            SetDex(130, 145);
            SetInt(170, 190);

            SetHits(2100, 2300);

            Item hair = new Item(8260);

            hair.Hue = 44;
            hair.Layer = Layer.Hair;
            hair.Movable = true;
            AddItem(hair);

            Sandals feet = new Sandals();
            feet.Hue = 1175;
            feet.Movable = true;
            AddItem(feet);

            LeatherNinjaPants legs = new LeatherNinjaPants();
            legs.Hue = 0;
            legs.Movable = true;
            AddItem(legs);
        }

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

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

        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);
            writer.Write((int)0);
        }

        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();
        }

        public class HarpySlayerQuestEntry : ContextMenuEntry
        {
            private Mobile m_Mobile;
            private Mobile m_Giver;

            public override void OnClick()
            {
                if (!(m_Mobile is PlayerMobile))
                    return;

                PlayerMobile mobile = (PlayerMobile)m_Mobile;

                if (!mobile.HasGump(typeof(HarpyQuestGump)))
                {
                    mobile.SendGump(new HarpyQuestGump(mobile));
                }
            }
        }

        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            PlayerMobile m = from as PlayerMobile;

            if (mobile != null)
            {
                if (dropped is ToadSkin)
                {
                    if (dropped.Amount != 20)
                    {
                        mobile.SendGump(new HarpyQuestGump1(m));
                        mobile.AddToBackpack(new JacksRegards());
                        mobile.SendMessage("This is going to turn out nicely!");
                        dropped.Delete();
                        return true;
                    }

                    return false;
                }
                else if (dropped is QuestSyrup)
                {
                    Container pack = from.Backpack;

                    if (pack != null)
                    {
                        m.SendGump(new HarpyQuestGump2(m));
                        m.SendMessage("Excellent!");
                        dropped.Delete();
                        return true;
                    }
                    return false;
                }
                else if (dropped is HarpyClaw)
                {
                    Container pack = from.Backpack;

                    if (pack != null)
                    {
                        m.AddToBackpack(new HarpyTalons());
                        m.SendMessage("I hope you enjoy your new peice of armor!");
                        dropped.Delete();
                        return true;
                    }
                    return false;
                }
                else
                {
                    this.PrivateOverheadMessage(MessageType.Regular, 1153, false, "Bring me what I asked for!", m.NetState);
                }
            }
            return false;
        }
    }
}
if you are still having issues you need to post the new errors, cause this file shouldnt cause that same error now.
__________________
Jeff Boulanger
ConnectUO - Core Developer

Want to help make ConnectUO better? Click here to submit your ideas/requests
Use your talent to compete against other community members in RunUO hosted coding competitions

If you know XNA (even if its just a little) or are a good artist(2d or 3d) and are interested in making games for a hobby send me a pm or drop by #xna in irc.runuo.com. I'm looking to put together a small game development team.


Please do not pm me for support. If you are having issues please post in the appropriate forum. Thanks for your continued support of both ConnectUO and RunUO
Jeff is offline   Reply With Quote
Old 09-17-2008, 02:14 PM   #5 (permalink)
Newbie
 
Join Date: Jul 2006
Age: 18
Posts: 17
Post

2 errors... line 60, and 75.

line 60: no overload method for HarpyQuestEntry

line 75: no overload method for ContextMenuEntry

this is one that i messed with a little bit more... but this is the least amount of errors i could get it to... =S

Code:
using System;
using System.Collections;
using Server.Items;
using Server.Targeting;
using Server.ContextMenus;
using Server.Gumps;
using Server.Misc;
using Server.Network;
using Server.Spells;
using System.Collections.Generic;

namespace Server.Mobiles
{
    [CorpseName("Corpse Of HarpySlayer")]
    public class HarpySlayer : BaseCreature
    {
        [Constructable]
        public HarpySlayer()
            : base(AIType.AI_Melee, FightMode.Aggressor, 10, 1, 0.2, 0.4)
        {
            Name = "Jack";
            Title = "the harpy slayer";

            Body = 400;
            Hue = 1801;
            Female = false;

            SetStr(100, 130);
            SetDex(130, 145);
            SetInt(170, 190);

            SetHits(2100, 2300);

            Item hair = new Item(8260);

            hair.Hue = 44;
            hair.Layer = Layer.Hair;
            hair.Movable = true;
            AddItem(hair);

            Sandals feet = new Sandals();
            feet.Hue = 1175;
            feet.Movable = true;
            AddItem(feet);

            LeatherNinjaPants legs = new LeatherNinjaPants();
            legs.Hue = 0;
            legs.Movable = true;
            AddItem(legs);
        }

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

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

        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);
            writer.Write((int)0);
        }

        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();
        }

        public class HarpyQuestEntry : ContextMenuEntry
        {
            private Mobile m_Mobile;
            private Mobile m_Giver;

            public override void OnClick()
            {
                if (!(m_Mobile is PlayerMobile))
                    return;

                PlayerMobile mobile = (PlayerMobile)m_Mobile;

                if (!mobile.HasGump(typeof(HarpyQuestGump)))
                {
                    mobile.SendGump(new HarpyQuestGump(mobile));
                }
            }
        }

        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            PlayerMobile m = from as PlayerMobile;

            if (m != null)
            {
                if (dropped is ToadSkin)
                {
                    if (dropped.Amount != 20)
                    {
                        m.SendGump(new HarpyQuestGump1(m));
                        m.AddToBackpack(new JacksRegards());
                        m.SendMessage("This is going to turn out nicely!");
                        dropped.Delete();
                        return true;
                    }

                    return false;
                }
                else if (dropped is QuestSyrup)
                {
                    Container pack = from.Backpack;

                    if (pack != null)
                    {
                        m.SendGump(new HarpyQuestGump2(m));
                        m.SendMessage("Excellent!");
                        dropped.Delete();
                        return true;
                    }
                    return false;
                }
                else if (dropped is HarpyClaw)
                {
                    Container pack = from.Backpack;

                    if (pack != null)
                    {
                        m.AddToBackpack(new HarpyTalons());
                        m.SendMessage("I hope you enjoy your new peice of armor!");
                        dropped.Delete();
                        return true;
                    }
                    return false;
                }
                else
                {
                    this.PrivateOverheadMessage(MessageType.Regular, 1153, false, "Bring me what I asked for!", m.NetState);
                }
            }
            return false;
        }
    }
}

Last edited by Joel007; 09-17-2008 at 04:40 PM.
Joel007 is offline   Reply With Quote
Old 09-19-2008, 12:09 AM   #6 (permalink)
Newbie
 
Join Date: Jul 2006
Age: 18
Posts: 17
Default

anyone? =S
Joel007 is offline   Reply With Quote
Old 09-19-2008, 01:14 AM   #7 (permalink)
Forum Novice
 
Soteric's Avatar
 
Join Date: Aug 2006
Location: Russia, Rostov-on-Don
Posts: 772
Send a message via ICQ to Soteric
Default

I think you can't declare one public class in another. The HarpyQuestEntry class should be private
Soteric is offline   Reply With Quote
Old 09-19-2008, 03:29 AM   #8 (permalink)
Newbie
 
Join Date: Jul 2006
Age: 18
Posts: 17
Smile

so i found the problem... aparently i was missing this:

Code:
            public HarpyQuestEntry(Mobile from, Mobile giver) : base(6146, 3)
            {
                m_Mobile = from;
                m_Giver = giver;
            }
my fault... but thanks guys =)
Joel007 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 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5