|
||
|
|||||||
| Script Support Get support for modifying RunUO Scripts, or writing your own! |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#26 (permalink) | |
|
Forum Novice
Join Date: Sep 2007
Posts: 367
|
Quote:
ahh... just an American-ism for "oh," or "hmm." |
|
|
|
|
|
|
#27 (permalink) | |
|
Forum Novice
Join Date: Sep 2007
Posts: 367
|
Quote:
Declare another private variable in your gump... Code:
private int RetainedHue; Add the hue as another argument when you call your gump... Code:
public ChristianMenuGump(object obj, Item OldFlippableItem, Item NewFlippedItem, int oldhue): base(0, 0) Code:
RetainedHue = oldhue; Code:
public override void OnResponse(NetState state, RelayInfo info)
{
if (info.ButtonID == 1)
{
m_Obj.SendMessage("Vous tournez le lit");
Item item = NewItem;
item.Hue = RetainedHue;
item.MoveToWorld(OldItem.Location, OldItem.Map);
OldItem.Delete();
//It is here that I need to "send" a bool or change or I don't know
//C'est ici que j'ai besoin "d'envoyer" un bool ou changer ou je sais pas
}
In your item script... pass this.Hue as an argument. |
|
|
|
|
|
|
#28 (permalink) |
|
Newbie
Join Date: Aug 2008
Location: Québec
Posts: 45
|
Thank you, it worked without problem. I'll also be able to use that for other properties.
EDIT: But now I have to get the world location.here's what I did and it doesn't want to work. Code:
using System;
using System.Collections;
using Server;
using Server.Misc;
using Server.Gumps;
using Server.Network;
using Server.Mobiles;
namespace Server.Items
{
public class SmallBedSouthAddon2 : BaseAddon2
{
AddonComponent2 ac;
AddonComponent2 ac2;
[Constructable]
public SmallBedSouthAddon2()
{
AddonComponent2 ac;
ac = new AddonComponent2(0xa63);
ac.Movable = true;
ac.Name = "Petit lit";
AddComponent2(ac, 0, 0, 0);
AddonComponent2 ac2;
ac2 = new AddonComponent2(0xA5C);
ac2.Movable = true;
ac2.Name = "Petit lit";
AddComponent2(ac2, 0, 1, 0);
}
public override void OnDoubleClick(Mobile from)
{
Mobile o;
o = from;
Item x;
x = this;
Item y;
y = new SmallBedEastAddon2();
int z;
z = this.Hue;
int w;
w = from.GetWorldLocation;
if (!from.InRange(GetWorldLocation(), 2))
{
from.SendMessage("vous êtes trop loin du lit");
}
else
{
from.SendGump(new ChristianMenuGump(o, x, y, z, w));
}
}
public SmallBedSouthAddon2(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();
}
}
Code:
sing System;
using System.Collections;
using Server;
using Server.Misc;
using Server.Gumps;
using Server.Network;
using Server.Mobiles;
using Server.Items;
namespace Server.Gumps
{
public class ChristianMenuGump : Gump
{
Mobile m_Obj;
private Item NewItem;
private Item OldItem;
private int RetainedHue;
private int WorldPlace;
public ChristianMenuGump(Mobile obj, Item OldFlippableItem, Item NewFlippedItem, int oldhue, int world): base(0, 0)
{
m_Obj = obj;
NewItem = NewFlippedItem;
OldItem = OldFlippableItem;
RetainedHue = oldhue;
WorldPlace = world;
AddBackground( 265, 205, 320, 290, 5054 );
Closable = true;
Disposable = true;
Dragable = true;
Resizable = false;
AddPage( 0 );
AddImageTiled( 225, 175, 50, 45, 0xCE ); //Top left corner
AddImageTiled( 267, 175, 315, 44, 0xC9 ); //Top bar
AddImageTiled( 582, 175, 43, 45, 0xCF ); //Top right corner
AddImageTiled( 225, 219, 44, 270, 0xCA ); //Left side
AddImageTiled( 582, 219, 44, 270, 0xCB ); //Right side
AddImageTiled( 225, 489, 44, 43, 0xCC ); //Lower left corner
AddImageTiled( 267, 489, 315, 43, 0xE9 ); //Lower Bar
AddImageTiled( 582, 489, 43, 43, 0xCD ); //Lower right corner
AddPage(1);
AddHtml(260, 254, 300, 140, "Voulez-vous tourner cet addon?", false, false);
AddButton(260, 300, 0xFA5, 0xFA7, 1, GumpButtonType.Reply, 1);
AddHtml(300, 300, 300, 50, "Oui", false, false);
AddButton(360, 300, 0xFA5, 0xFA7, 2, GumpButtonType.Reply, 0);
AddHtml(400, 300, 300, 50, "Non", false, false);
}
public override void OnResponse(NetState state, RelayInfo info)
{
if (info.ButtonID == 1)
{
if (m_Obj.InRange(GetWorldLocation(WorldPlace), 2))
{
m_Obj.SendMessage("Vous tournez le lit");
Item item = NewItem;
item.Hue = RetainedHue;
item.MoveToWorld(OldItem.Location, OldItem.Map);
OldItem.Delete();
}
if (!m_Obj.InRange(GetWorldLocation(WorldPlace), 2))
m_Obj.SendMessage("vous êtes trop loin du lit");
}
if (info.ButtonID == 2)
return;
}
}
}
![]() Last edited by Pantoute; 08-25-2008 at 09:57 AM. |
|
|
|
|
|
#29 (permalink) |
|
Forum Novice
Join Date: Sep 2007
Posts: 367
|
Check out the GetWorldLocation() method.
Well, you're having a problem with variable types. GetWorldLocation() returns a three-part variable consisting of (X, Y, and Z) coordinates. It returns a Point3D. How do I know this? Google "runuo documenation getworldlocation". It doesn't return an integer (like 1, 5, 23, 93, 2). Therefore, you're using the wrong variable type here: Code:
public ChristianMenuGump(Mobile obj, Item OldFlippableItem, Item NewFlippedItem, int oldhue, int world) Code:
public ChristianMenuGump(Mobile obj, Item OldFlippableItem, Item NewFlippedItem, int oldhue, Point3D world): base(0, 0) So... change this... Code:
public override void OnResponse(NetState state, RelayInfo info)
{
if (info.ButtonID == 1)
{
if (m_Obj.InRange(GetWorldLocation(WorldPlace), 2))
{
m_Obj.SendMessage("Vous tournez le lit");
Item item = NewItem;
item.Hue = RetainedHue;
item.MoveToWorld(OldItem.Location, OldItem.Map);
OldItem.Delete();
}
if (!m_Obj.InRange(GetWorldLocation(WorldPlace), 2))
m_Obj.SendMessage("vous êtes trop loin du lit");
}
Code:
public override void OnResponse(NetState state, RelayInfo info)
{
if (info.ButtonID == 1)
{
if (m_Obj.InRange(WorldPlace, 2))
{
m_Obj.SendMessage("Vous tournez le lit");
Item item = NewItem;
item.Hue = RetainedHue;
item.MoveToWorld(OldItem.Location, OldItem.Map);
OldItem.Delete();
}
if (!m_Obj.InRange(WorldPlace, 2))
m_Obj.SendMessage("vous êtes trop loin du lit");
}
Code:
bool InRange( Point3D p, int range ) These changes should sove your problem. Last edited by Tassyon T; 08-25-2008 at 04:46 PM. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|