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 08-20-2008, 04:47 PM   #1 (permalink)
Newbie
 
Sir Notez's Avatar
 
Join Date: Aug 2008
Location: Where dreams are born...
Age: 17
Posts: 89
Send a message via AIM to Sir Notez
Default No overload method?

I was trying to make a new currency, that i could use on a vendor stone, and i was trying to make it stackable at the same time..now when i tried to compile i got this error:
Code:
RunUO - [www.runuo.com] Version 2.0, Build 3140.39861
Core: Running on .NET Framework Version 2.0.50727
Core: Optimizing for 2 64-bit processors
Scripts: Compiling C# scripts...failed (1 errors, 0 warnings)
Warnings:
 + 
Errors:
 + Customs/Items/Reward_Ticket_Items/RewardTicket.cs:
    CS1501: Line 17: No overload for method 'Item' takes '2' arguments
Scripts: One or more scripts failed to compile or no script files were found.
 - Press return to exit, or R to try again.
Here is the script:

Code:
/*
 *  Coded by Sir Notez 
 */
using System;
using Server;
using Server.Items;

namespace Server.Items
{
    public class RewardTickets : Item
    {

        public RewardTickets()
            : this(1)
        {
        }
        [Constructable]
        public RewardTickets( int amount )
            : base(0x1F35, amount )
        {
            Name = "Reward Ticket";
            Hue = 1288;
            Weight = 3.0;
            LootType = LootType.Blessed;
        }

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

        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);
            writer.Write((int)1); // version
        }
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();
        }
    }
}
__________________
[CENTERIMG]http://i520.photobucket.com/albums/w326/AnthonyNM12690/WarcryBanner.jpg[/IMG][/center]
Sir Notez is offline   Reply With Quote
Old 08-20-2008, 04:57 PM   #2 (permalink)
Forum Novice
 
Join Date: Dec 2005
Posts: 608
Default

Code:
        [Constructable]
        public RewardTickets( int amount )
            : base(0x1F35, amount )
        {
            Name = "Reward Ticket";
            Hue = 1288;
            Weight = 3.0;
            LootType = LootType.Blessed;
        }
to
Code:
        [Constructable]
        public RewardTickets( int amount )
            : base(0x1F35)
        {
            Name = "Reward Ticket";
            Hue = 1288;
            Weight = 3.0;
            LootType = LootType.Blessed;
Amount = amount;
        }
__________________
Add your scripts!
Script Library for custom RunUO scripts >> sunny-productions.eu
b0b01 is online now   Reply With Quote
Old 08-20-2008, 05:04 PM   #3 (permalink)
Newbie
 
Sir Notez's Avatar
 
Join Date: Aug 2008
Location: Where dreams are born...
Age: 17
Posts: 89
Send a message via AIM to Sir Notez
Default

Quote:
Originally Posted by b0b01 View Post
Code:
        [Constructable]
        public RewardTickets( int amount )
            : base(0x1F35, amount )
        {
            Name = "Reward Ticket";
            Hue = 1288;
            Weight = 3.0;
            LootType = LootType.Blessed;
        }
to
Code:
        [Constructable]
        public RewardTickets( int amount )
            : base(0x1F35)
        {
            Name = "Reward Ticket";
            Hue = 1288;
            Weight = 3.0;
            LootType = LootType.Blessed;
Amount = amount;
        }

Awsome, thanks alot...i knew i was missing something heh
__________________
[CENTERIMG]http://i520.photobucket.com/albums/w326/AnthonyNM12690/WarcryBanner.jpg[/IMG][/center]
Sir Notez is offline   Reply With Quote
Old 08-20-2008, 05:30 PM   #4 (permalink)
Forum Novice
 
Join Date: Dec 2005
Posts: 608
Default

No overload means it doesn't exist. if you see this error, go look in the script and see if what the constructors are.
__________________
Add your scripts!
Script Library for custom RunUO scripts >> sunny-productions.eu
b0b01 is online now   Reply With Quote
Old 08-21-2008, 01:29 AM   #5 (permalink)
Newbie
 
Join Date: Feb 2007
Posts: 69
Default

Quote:
Originally Posted by Sir Notez View Post
I was trying to make a new currency, that i could use on a vendor stone, and i was trying to make it stackable at the same time..now when i tried to compile i got this error:
Code:
RunUO - [www.runuo.com] Version 2.0, Build 3140.39861
Core: Running on .NET Framework Version 2.0.50727
Core: Optimizing for 2 64-bit processors
Scripts: Compiling C# scripts...failed (1 errors, 0 warnings)
Warnings:
 + 
Errors:
 + Customs/Items/Reward_Ticket_Items/RewardTicket.cs:
    CS1501: Line 17: No overload for method 'Item' takes '2' arguments
Scripts: One or more scripts failed to compile or no script files were found.
 - Press return to exit, or R to try again.
Here is the script:

Code:
/*
 *  Coded by Sir Notez 
 */
using System;
using Server;
using Server.Items;

namespace Server.Items
{
    public class RewardTickets : Item
    {

        public RewardTickets()
            : this(1)
        {
        }
        [Constructable]
        public RewardTickets( int amount )
            : base(0x1F35, amount )
        {
            Name = "Reward Ticket";
            Hue = 1288;
            Weight = 3.0;
            LootType = LootType.Blessed;
        }

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

        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);
            writer.Write((int)1); // version
        }
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();
        }
    }
}
To make a child class of Item you would need to have additional arguments in your constructor. I would advise you find a different class to make as your parent class or do some research into what arguments Item class has.

Currently that is your issue, if you don't understand what I just said, I would advise some research into the subject. What your trying to is very simple and your on the right track, if you were to use a different parent class.
DragonBoy is offline   Reply With Quote
Old 08-21-2008, 06:06 AM   #6 (permalink)
Forum Novice
 
Join Date: Dec 2005
Posts: 608
Default

Quote:
Originally Posted by DragonBoy View Post
To make a child class of Item you would need to have additional arguments in your constructor. I would advise you find a different class to make as your parent class or do some research into what arguments Item class has.

Currently that is your issue, if you don't understand what I just said, I would advise some research into the subject. What your trying to is very simple and your on the right track, if you were to use a different parent class.
I don't understand what your talking about....It didn't compile because Item has no constructor for Item(itemid, amount).
__________________
Add your scripts!
Script Library for custom RunUO scripts >> sunny-productions.eu
b0b01 is online now   Reply With Quote
Old 08-25-2008, 07:32 AM   #7 (permalink)
Newbie
 
Join Date: Feb 2007
Posts: 69
Default

Quote:
Originally Posted by b0b01 View Post
I don't understand what your talking about....It didn't compile because Item has no constructor for Item(itemid, amount).
This is exactly what I said...

Do some research into the topic I described, then come back and ask questions.
DragonBoy is offline   Reply With Quote
Old 08-25-2008, 04:19 PM   #8 (permalink)
Forum Novice
 
Tassyon T's Avatar
 
Join Date: Sep 2007
Posts: 367
Default

Quote:
Originally Posted by DragonBoy View Post
This is exactly what I said...

Do some research into the topic I described, then come back and ask questions.
And... here's how to do that research:

search the the documentation files... i.e. item.html

Alternatively, since I believe item.cs is a core file, download the core files from runuo/dowloads and just look at the script
Tassyon T 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