RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

MWDrink Bottle

MWDrink Bottle

hi there, im trying to make a drink bottle, for my shard. as its a wonderland shard. lol
i want to put +25 str and -25 str, when used witch bottle. for bigger and getting smaller. but i dont no where to start. also when i load my script i have so far i get


Code:
Scripts: Compiling C# scripts...failed (1 errors, 0 warnings)
- Error: Scripts\Customs\trys\DrinkMe.cs: CS1513: (line 36, column 5) } expected
this is my script. thanks to all.

Code:
using System;
namespace Server.Items

{
[FlipableAttribute( 0x99F, 0x99F )]
public class DrinkMe : BaseBeverage
{
// int hi = 0; // 
[Constructable]
public DrinkMe() : base( 0x99F )
{
Name = "Drink Me!";
this.Weight = 0.1;
}

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

public override void OnDoubleClick( Mobile from )
{
Container pack = from.Backpack;
if (pack != null && pack.ConsumeTotal( typeof( DrinkMe ), 1 ) )
{
if ( from.Body.IsHuman && !from.Mounted )
{
from.SendMessage( "You drink the liquid and feel small enough to fit throught the door!" );
from.PlaySound( 0x2D6 );

if ( Highness >= 6 )
{
from.Say( "*" + "Hic" );
Highness = 0;
}
}
}

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

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

i notice its on the } bit ive removed that and so on. and so on it keeps saying that same .
im sorry to bother you all.
thanks again. :)
 

Phantom

Knight
Download a C# editor.

Anything that will highlight the C# syntax should help you find this error.

Your missing a } you should fix that.
 
WonderlandADnc

Load your script into SharpDevelop and right click on the script. A menu will pop up. Select "Indent" and it will (in most cases) fix your bracket issues.
 

Kamron

Knight
The missing brace is in red :) I just shoved this into VS and it gave me red swiggly where it needed to go :)

Code:
using System;
namespace Server.Items

{
	[FlipableAttribute( 0x99F, 0x99F )]
	public class DrinkMe : BaseBeverage
	{
		// int hi = 0; // 
		[Constructable]
		public DrinkMe() : base( 0x99F )
		{
			Name = "Drink Me!";
			this.Weight = 0.1;
		}

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

		public override void OnDoubleClick( Mobile from )
		{
			Container pack = from.Backpack;
			if (pack != null && pack.ConsumeTotal( typeof( DrinkMe ), 1 ) )
			{
				if ( from.Body.IsHuman && !from.Mounted )
				{
					from.SendMessage( "You drink the liquid and feel small enough to fit throught the door!" );
					from.PlaySound( 0x2D6 );

					if ( Highness >= 6 )
					{
						from.Say( "*" + "Hic" );
						Highness = 0;
					}
				}
			}
		[COLOR=RED]}[/COLOR]

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

		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );
			int version = reader.ReadInt();
		}
	}
}
 
ok thanks all. i loaded it into SD and right clicked on the script and clicked indent,. but it didnt do anything. this is on the old one i mean. lol. also whats the best way i can add int - +, ive been looking for a script with it but i dont seem to be getting anywhere. lol

also im doing this

Code:
using System;
using System.Collections;
using Server;
using Server.Network;

namespace Server.Items
{
	public class MWMushroom : Food
	{

		[Constructable]
		public MWMushroom() : this( 1 )
		{
		}
		
		[Constructable]
		public MWMushroom( int amount ) : base( 0xF8F, amount )
		{
			this.Hue = 2502;
			this.Name = "A Piece Mushroom";
			this.Stackable = true;
			this.Movable = true;
			this.ItemID = 0x97D;
			this.Amount = amount;
			this.FillFactor = 2;
			this.Weight = 1;	
		}

		public MWMushroom( Serial serial ) : base( serial )
		{
		}
                
                public override void OnDoubleClick( Mobile from ) 
                { 
                    Container pack = from.Backpack; 
                    if (pack != null && pack.ConsumeTotal( typeof( MWMushroom ), 1 ) ) 
                     { 
                         if ( from.Body.IsHuman && !from.Mounted ) 
                         { 
                             from.Animate( 34, 5, 1, true, false, 0 ); 
                             from.PlaySound( Utility.Random( 0x3A, 3 ) ); // random eating noise 
                             from.SendMessage( "You pick a piece." ); 
                             from.SendMessage( "You eat the mushroom and feel bigger!"); 
                         } 
                         else 
                         { 
                             from.SendMessage( "You Have no more!" ); 
                             return; 
                         } 
                         }   
} 

		public override Item Dupe( int amount )
		{
			return base.Dupe( new MWMushroom( amount ), amount );
		}
		
		public override void Serialize( GenericWriter writer )
		{
			base.Serialize( writer );

			writer.Write( (int) 0 ); // version
		}

		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();
		}
	}
}
        public override void Serialize( GenericWriter writer ) 
        { 
            base.Serialize( writer );
 
            writer.Write( (int) 0 ); // version 
        } 

        public override void Deserialize( GenericReader reader ) 
        { 
            base.Deserialize( reader ); 

            int version = reader.ReadInt(); 
        } 
    } 
}

and runro tells me,
Code:
RunUO - [www.runuo.com] Version 1.0.0, Build 36918
Scripts: Compiling C# scripts...failed (3 errors, 0 warnings)
 - Error: Scripts\Customs\fortowns\AlicesWon\MWMushroom.cs: CS1518: (line 73, co
lumn 25) Expected class, delegate, enum, interface, or struct
 - Error: Scripts\Customs\fortowns\AlicesWon\MWMushroom.cs: CS1518: (line 80, co
lumn 25) Expected class, delegate, enum, interface, or struct
 - Error: Scripts\Customs\fortowns\AlicesWon\MWMushroom.cs: CS1022: (line 86, co
lumn 5) Type or namespace definition, or end-of-file expected
Scripts: One or more scripts failed to compile or no script files were found.
 - Press return to exit, or R to try again.

i put it into SD
and it didnt do much just move it about.

View attachment 9367
View attachment 9368
View attachment 9369
sorry about that it was the ownly way i could do it. lol
thanks for any help.

---------------------------------------------------------
Edit.
hi there i tryed the drinkme but runuo came up with
Code:
RunUO - [www.runuo.com] Version 1.0.0, Build 36918
Scripts: Compiling C# scripts...failed (2 errors, 0 warnings)
 - Error: Scripts\Customs\trys\DrinkMe.cs: CS0534: (line 6, column 15) 'Server.I
tems.DrinkMe' does not implement inherited abstract member 'Server.Items.BaseBev
erage.ComputeItemID()'
 - Error: Scripts\Customs\trys\DrinkMe.cs: CS0534: (line 6, column 15) 'Server.I
tems.DrinkMe' does not implement inherited abstract member 'Server.Items.BaseBev
erage.MaxQuantity.get'
Scripts: One or more scripts failed to compile or no script files were found.
 - Press return to exit, or R to try again.
so i guess it dont like the BaseBeverage part. i cant think if what to put i could put item but its a drink. lol
thanks again
 

Attachments

  • 1.JPG
    1.JPG
    48.6 KB · Views: 19
  • 2.JPG
    2.JPG
    50.2 KB · Views: 6
  • 3.JPG
    3.JPG
    33.6 KB · Views: 7

KnitePrince

Sorceror
Lucid Nagual and XxSpiderxX those are the replys I like to see, they help morons like me imensely. A learning experiance that wont be forgotten without hours of struggling to get there. Ive had that error before and spent a long time counting brackets to find where it went....
 

Jeff

Lord
Code:
public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();
		}
	}
}

hmm those last 2 } dont look right :)
 
Yeah sometimes it won't work if things are way out of place. I will look at this real quick for you. But when u use SD as you type in brackets it automatically adds the other below where you are typing. And it is good for aligning the code.

Edit:
Code:
using System;
using System.Collections;
using Server;
using Server.Network;

namespace Server.Items
{
	public class MWMushroom : Food
	{
		
		[Constructable]
		public MWMushroom() : this( 1 )
		{
		}
		
		[Constructable]
		public MWMushroom( int amount ) : base( 0xF8F, amount )
		{
			this.Hue = 2502;
			this.Name = "A Piece Mushroom";
			this.Stackable = true;
			this.Movable = true;
			this.ItemID = 0x97D;
			this.Amount = amount;
			this.FillFactor = 2;
			this.Weight = 1;
		}
		
		public MWMushroom( Serial serial ) : base( serial )
		{
		}
		
		public override void OnDoubleClick( Mobile from )
		{
			Container pack = from.Backpack;
			
			if (pack != null && pack.ConsumeTotal( typeof( MWMushroom ), 1 ) )
			{
				if ( from.Body.IsHuman && !from.Mounted )
				{
					from.Animate( 34, 5, 1, true, false, 0 );
					from.PlaySound( Utility.Random( 0x3A, 3 ) ); // random eating noise
					from.SendMessage( "You pick a piece." );
					from.SendMessage( "You eat the mushroom and feel bigger!");
				}
				else
				{
					from.SendMessage( "You Have no more!" );
					return;
				}
			}
		}
		
		public override Item Dupe( int amount )
		{
			return base.Dupe( new MWMushroom( amount ), amount );
		}
		
		public override void Serialize( GenericWriter writer )
		{
			base.Serialize( writer );
			writer.Write( (int) 0 ); // version
		}
		
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );
			int version = reader.ReadInt();
		}
	}
}

You had too many serial and deserialization methods. I took them out.
 
well im getting there. now have to sort out the adding ofr int - + 15. i dont no where to start. i understand a potion script to look at wold work. but i dont no what to look for. lol thanks again
 
ok i found it in, my runuo folder. eny help on what im looking for.

Code:
	public class PrizedFish : BaseMagicFish
	{
		public override int Bonus{ get{ return 5; } }
		public override StatType Type{ get{ return StatType.Int; } }

		public override int LabelNumber{ get{ return 1041073; } } // prized fish

		[Constructable]
		public PrizedFish() : base( 51 )
		{
		}

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

		public override void Serialize( GenericWriter writer )
		{
			base.Serialize( writer );

			writer.Write( (int) 0 ); // version
		}

		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			if ( Hue == 151 )
				Hue = 51;
		}
	}

i also found a link on here trying to update it. do i use that.

this is what i think i need .

[/CODE]public override int Bonus{ get{ return 5; } }
public override StatType Type{ get{ return StatType.Int; } }[/CODE]
 

Packer898

Knight
Against my better judgement to not offer advice to you anymore based on past experiences, If you will also look at BaseMagicFish this will give you the answers your looking for. SImply adding the int Bonus and StatType will not be enough. It will need to know how to use them as well.
 

Kamron

Knight
Code:
    public class PrizedFish : [COLOR=GREEN]BaseMagicFish[/COLOR]
    {
[COLOR=BLUE]
        public override int Bonus{ get{ return 5; } }
        public override StatType Type{ get{ return StatType.Int; } }
[/COLOR]
 
        public override int LabelNumber{ get{ return 1041073; } } // prized fish
 
        [Constructable]
        public PrizedFish() : base( 51 )
        {
        }
 
        public PrizedFish( Serial serial ) : base( serial )
        {
        }
 
        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );
 
            writer.Write( (int) 0 ); // version
        }
 
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );
 
            int version = reader.ReadInt();
 
            if ( Hue == 151 )
                Hue = 51;
        }
    }

Look at the blue stuff, in the green class. You were on the right track with what you posted, but there was no information on how that was used, so you needed to go into the parent class, which I highlighted in green. So keep digging :)

EDIT: Damn you Packer! You beat me to it....:p oh well
 
Top