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

oh come on u have to give it to me, i am trying. and this is the best way for me. i no its not all full own scripting
but im getting into looking at other scripts.
this is the html file i found

Code:
BaseMagicFish : Item, IEntity, IPoint3D, IPoint2D, IHued
Derived Types: PeculiarFish, PrizedFish, TrulyRareFish, WondrousFish
(ctor) BaseMagicFish( Serial serial )
(ctor) BaseMagicFish( int hue )
int Bonus( get; )
StatType Type( get; )
virtual bool Apply( Mobile from )
virtual void Deserialize( GenericReader reader )
virtual void OnDoubleClick( Mobile from )
virtual void Serialize( GenericWriter writer )

so i think i need, i told i was right

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

and

Code:
int Bonus( get; )
StatType Type( get; )
:)
 

Packer898

Knight
WonderlandADnc said:
emmmmmmmmmm

Code:
public class PrizedFish : BaseMagicFish
    {

Code:
int version = reader.ReadInt();

Huh? lol

What method... like:
Code:
		public virtual bool Apply( Mobile from )

or.......

		public override void OnDoubleClick( Mobile from )

Thats where it actually applies the stat mods...
 
can someone plese look at this
it not got the int on it. as i cant sort it out/
but its the working one.
but when u add it.
it says nothing. but then i try another char and it do.

Code:
using System;
namespace Server.Items

{
	[FlipableAttribute( 0x99F, 0x99F )]
	public class DrinkMe : Item
	{
		// 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 );
					
					{
						from.Say( "*" + "Hic" + "*" );
					}
				}
			}
		}

		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();
		}
	}
}
 

daat99

Moderator
Staff member
WonderlandADnc said:
can someone plese look at this
it not got the int on it. as i cant sort it out/
but its the working one.
but when u add it.
it says nothing. but then i try another char and it do.
Explain please.
 

daat99

Moderator
Staff member
Code:
[COLOR="Red"]{[/COLOR]
	from.Say( "*" + "Hic" + "*" );
[COLOR="Red"]}[/COLOR]
Why do you have the code block for 1 line without any if statement or loop before it???

Also why are you checking if the body is human?
Try without it.
 
ok so like this


Code:
public override void OnDoubleClick( Mobile from )
		{
			Container pack = from.Backpack;
			if (pack != null && pack.ConsumeTotal( typeof( DrinkMe ), 1 ) )
			{
				{
					from.SendMessage( "You drink the liquid and feel small enough to fit throught the door!" );
					from.PlaySound( 0x2D6 );
					
					[B]{[/B]
						from.Say( "*" + "Hic" + "*" );
					[B]}[/B]

the bold bits i dont understand sorry. :(
 

Packer898

Knight
WonderlandADnc said:
the bold bits i dont understand sorry. :(

The reason when you make a script its so hard for you is because you wont take the time to read over basic tutorials. Everytime you want to script something its an uphill battle for you to even get the basic syntax correct.

Why are you enclosing something in brackets when it clearly doesnt need to be? The only reason to use brackets on that particular piece of code is if you want to add a check to see whether or not the code would be executed. Since your not wanting to check anything further then delete the brackets.
 

Packer898

Knight
I really hate myself for even starting to read this post =/

Code:
public override void OnDoubleClick( Mobile from )
		{
			Container pack = from.Backpack;
			if (pack != null && pack.ConsumeTotal( typeof( DrinkMe ), 1 ) )
			{
				{[COLOR="Red"]<--- what is this for?[/COLOR]
					from.SendMessage( "You drink the liquid and feel small enough to fit throught the door!" );
					from.PlaySound( 0x2D6 );
					
					{[COLOR="red"]<-- Why do you need this?[/COLOR]
						from.Say( "*" + "Hic" + "*" );
					}[COLOR="red"]<-- Why do you need this?[/COLOR]
 

milt

Knight
Another question:

Why do you have
Code:
from.Say( "*" + "Hic" + "*" );

When you can just
Code:
from.Say( "*Hic*" );
 
please dont be like that pack898. i like having you on the team.
i do thank you. and all. for you help. :)

-----EDIT----------------------------------

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

tophyr

Wanderer
Oh my god, I feel bad, I literally just laughed out loud @ those two closing braces.

Wonderland, the { and } signify chunks or "blocks" of code. Each code block needs an opening { and a closing }. Think of the braces and blocks like doors and rooms. Each time you enter a new room, you need to open { the door to it, and then every time you leave the room you need to close } the door. When there's mismatched {'s and }'s, you'll run into trouble.
 
yes i understand that thanks. but to me it looks right now.
it has a in and out.

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

i no it cant still be right as i get this
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\DrinkMe.cs: CS1518: (line 34, colum
n 19) Expected class, delegate, enum, interface, or struct
 - Error: Scripts\Customs\fortowns\AlicesWon\DrinkMe.cs: CS1518: (line 40, colum
n 19) Expected class, delegate, enum, interface, or struct
 - Error: Scripts\Customs\fortowns\AlicesWon\DrinkMe.cs: CS1022: (line 45, colum
n 2) 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.

lol
 
Top