SevenEleven
Sorceror
Cannot implicitly convert type 'string' to 'int'
Ok, so i am going throuhg this, and i do the normal edits and such.
But, it wont let me use 'string' ? why not? heres the script
Error Logs:
You've all helped so much..i just dont know what else to switch this too =[
**Btw this is for 1.0
Ok, so i am going throuhg this, and i do the normal edits and such.
But, it wont let me use 'string' ? why not? heres the script
Code:
using System;
using Server;
using Server.Multis;
using Server.Targeting;
using Server.Items;
using Server.Prompts;
using System.Collections;
using Server.ContextMenus;
namespace Server.Items
{
public class ItemItemIDTarget : Target // Create our targeting class (which we derive from the base target class)
{
private ItemItemIDDeed m_Deed;
private BaseArmor m_speaktargs;
private BaseJewel m_speaktargss;
private BaseClothing m_speaktargsss;
public ItemItemIDTarget(ItemItemIDDeed deed): base(1, false, TargetFlags.None)
{
m_Deed = deed;
}
protected override void OnTarget(Mobile from, object targeted) // Override the protected OnTarget() for our feature
{
if (targeted is BaseArmor)
{
BaseArmor item = (BaseArmor)targeted;
m_speaktargs = item;
if (!from.InRange(m_Deed.GetWorldLocation(), 2) || !from.InRange(item.GetWorldLocation(), 2))
from.SendLocalizedMessage(500446); // That is too far away.
else
{
if (item.RootParent != from) // Make sure its in their pack or they are wearing it
{
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
}
else
{
from.Prompt = new ItemIDArmorPrompt(m_speaktargs);
from.SendMessage("What item would you like to ItemID ?");
from.SendMessage("You use your ItemID deed.");
m_Deed.Delete(); // Delete the bless deed
}
}
}
else if (targeted is BaseJewel)
{
BaseJewel item = (BaseJewel)targeted;
m_speaktargss = item;
if (!from.InRange(m_Deed.GetWorldLocation(), 2) || !from.InRange(item.GetWorldLocation(), 2))
from.SendLocalizedMessage(500446); // That is too far away.
else
{
if (item.RootParent != from) // Make sure its in their pack or they are wearing it
{
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
}
else
{
from.Prompt = new ItemIDJewelPrompt(m_speaktargss);
from.SendMessage("What item would you like to ItemID ?");
from.SendMessage("You use your ItemID deed.");
m_Deed.Delete(); // Delete the bless deed
}
}
}
else if (targeted is BaseClothing)
{
BaseClothing item = (BaseClothing)targeted;
m_speaktargsss = item;
if (!from.InRange(m_Deed.GetWorldLocation(), 2) || !from.InRange(item.GetWorldLocation(), 2))
from.SendLocalizedMessage(500446); // That is too far away.
else
{
if (item.RootParent != from) // Make sure its in their pack or they are wearing it
{
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
}
else
{
from.Prompt = new ItemIDClothingPrompt(m_speaktargsss);
from.SendMessage("What item would you like to ItemID ?");
from.SendMessage("You use your ItemID deed.");
m_Deed.Delete(); // Delete the bless deed
}
}
}
else
from.SendMessage("You cannot ItemID that.");
}
}
public class ItemItemIDDeed : Item // Create the item class which is derived from the base item class
{
[Constructable]
public ItemItemIDDeed() : base(0x0FBF)
{
Name = "Item ItemID Deed";
Weight = 1.0;
Hue = 1979;
ItemID = 0x14F0;
LootType = LootType.Blessed;
}
public ItemItemIDDeed(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();
}
public override void OnDoubleClick(Mobile from)
{
if (!IsChildOf(from.Backpack)) // Make sure its in their pack
{
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
}
else
{
from.SendMessage("Target the item you wish to ItemID.");
from.Target = new ItemItemIDTarget(this);
}
}
}
}
namespace Server.Prompts
{
public class ItemIDArmorPrompt : Prompt
{
private BaseArmor m_speaktargs;
public ItemIDArmorPrompt(BaseArmor marmor)
{
m_speaktargs = marmor;
}
public override void OnResponse[COLOR="Red"](Mobile from, string text)[/COLOR]
{
m_speaktargs.ItemID = text;
from.SendMessage("You have changed ItemID of the item.");
}
}
public class ItemIDJewelPrompt : Prompt
{
private BaseJewel m_speaktargss;
public ItemIDJewelPrompt(BaseJewel mjewel)
{
m_speaktargss = mjewel;
}
public override void OnResponse[COLOR="Red"](Mobile from, string text)[/COLOR]
{
m_speaktargss.ItemID = text;
from.SendMessage("You have ItemIDd the item.");
}
}
public class ItemIDClothingPrompt : Prompt
{
private BaseClothing m_speaktargsss;
public ItemIDClothingPrompt(BaseClothing mclothing)
{
m_speaktargsss = mclothing;
}
public override void OnResponse[COLOR="Red"](Mobile from, string text)[/COLOR]
{
m_speaktargsss.ItemID = text;
from.SendMessage("You have ItemIDd the item.");
}
}
}
Error Logs:
Code:
Scripts: Compiling C# scripts...failed (3 errors, 0 warnings)
- Error: Scripts\ItemIDDeed2.cs: CS0029: (line 157, column 35) Cannot implicitl
y convert type 'string' to 'int'
- Error: Scripts\ItemIDDeed2.cs: CS0029: (line 171, column 36) Cannot implicitl
y convert type 'string' to 'int'
- Error: Scripts\ItemIDDeed2.cs: CS0029: (line 185, column 37) Cannot implicitl
y convert type 'string' to 'int'
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.
You've all helped so much..i just dont know what else to switch this too =[
**Btw this is for 1.0