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!

[RunUO 2.0 RC1] SendTo

Ortanith

Wanderer
SendTo

This script was made for Runuo 1.0 but with the Help of Kenko and b0b01 I was able to convert it (thanks guys)
I thought it only fair to share it with the community

Basicly what this script does is you type the command [sendto and like [go it will open a gump, you then select the location. It will give you a target with which you target the person you want to send to the location you selected. I have done some testing with it and thus far no crashes and it works seems stable, please post if you get any errors.

This script is easy to edit when it comes to adding maps just see line 220 and 281 for the locations to add to/examples

Just drop it in your scripts folder and your good to go.
 

Attachments

  • SendTo.cs
    14.1 KB · Views: 229

milvaen

Wanderer
Code:
Server Crash Report
===================

RunUO Version 2.0, Build 2959.20979
Operating System: Microsoft Windows NT 5.1.2600 Service Pack 2
.NET Framework: 2.0.50727.1433
Time: 27.04.2008 10:17:35
Mobiles: 2431
Items: 101897
Exception:
System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
   at System.ThrowHelper.ThrowKeyNotFoundException()
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at SendTo.SendToGump.DisplayTo(Mobile from)
   at SendTo.SendTo_OnCommand(CommandEventArgs e)
   at Server.Commands.CommandSystem.Handle(Mobile from, String text, MessageType type)
   at Server.Mobile.DoSpeech(String text, Int32[] keywords, MessageType type, Int32 hue)
   at Server.Mobiles.PlayerMobile.DoSpeech(String text, Int32[] keywords, MessageType type, Int32 hue)
   at Server.Network.PacketHandlers.UnicodeSpeech(NetState state, PacketReader pvSrc)
   at Server.Network.MessagePump.HandleReceive(NetState ns)
   at Server.Network.MessagePump.Slice()
   at Server.Core.Main(String[] args)

Clients:
- Count: 1
+ 127.0.0.1: (account = admin) (mobile = 0x22 'Lithium')
 

.Lithium

Wanderer
Code:
Server Crash Report
===================

RunUO Version 2.0, Build 3339.39459
Operating System: Microsoft Windows NT 5.2.3790 Service Pack 2
.NET Framework: 2.0.50727.42
Time: 07.03.2009 01:41:13
Mobiles: 21507
Items: 120046
Exception:
System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
   at System.ThrowHelper.ThrowKeyNotFoundException()
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at SendTo.SendToGump.DisplayTo(Mobile from)
   at SendTo.SendTo_OnCommand(CommandEventArgs e)
   at Server.Commands.CommandSystem.Handle(Mobile from, String text, MessageType type)
   at Server.Mobile.DoSpeech(String text, Int32[] keywords, MessageType type, Int32 hue)
   at Server.Mobiles.PlayerMobile.DoSpeech(String text, Int32[] keywords, MessageType type, Int32 hue)
   at Server.Network.PacketHandlers.UnicodeSpeech(NetState state, PacketReader pvSrc)
   at Server.Network.MessagePump.HandleReceive(NetState ns)
   at Server.Network.MessagePump.Slice()
   at Server.Core.Main(String[] args)
 
I know I'm not an expert but i'm assuming there is on one of the top lines something that goes like system.collections and yous do not have ML enabled there for you will probably need to remove that line.
 
also noticed on this script, he is missing a very important part at the top (and a } at the end then too to match it)

Code:
using Server.Commands;
using Server.Commands.Generic;
using System.Collections.Generic;

[COLOR="Red"]namespace Server.Commands
{[/COLOR]
	public class SendTo
	{

part in red
then last line of the script add
}

i am not even sure how it managed to compile with out them in there
 

.Lithium

Wanderer
I did what u said. still it gives this error when using it
Code:
Server Crash Report
===================

RunUO Version 2.0, Build 3344.39098
Operating System: Microsoft Windows NT 5.2.3790 Service Pack 2
.NET Framework: 2.0.50727.42
Time: 05.04.2009 02:01:20
Mobiles: 36791
Items: 223532
Exception:
System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
   at System.ThrowHelper.ThrowKeyNotFoundException()
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at Server.Commands.SendTo.SendToGump.DisplayTo(Mobile from)
   at Server.Commands.SendTo.SendTo_OnCommand(CommandEventArgs e)
   at Server.Commands.CommandSystem.Handle(Mobile from, String text, MessageType type)
   at Server.Mobile.DoSpeech(String text, Int32[] keywords, MessageType type, Int32 hue)
   at Server.Mobiles.PlayerMobile.DoSpeech(String text, Int32[] keywords, MessageType type, Int32 hue)
   at Server.Engines.PartySystem.Chat3Guild.UnicodeSpeechChat3(NetState state, PacketReader pvSrc)
   at Server.Network.MessagePump.HandleReceive(NetState ns)
   at Server.Network.MessagePump.Slice()
   at Server.Core.Main(String[] args)
 
do you have all 5 maps in the directory \data\locations?
if one iof those is missing might be causing the problem

also is it any one that you chose? or only a specific one each time?

and does you [go command also work or cause crashes

have you modified your xml files at all?
 

.Lithium

Wanderer
1. yes i have all
2. [go cmd works great
3. no i didn't modified
4. here is a error code with -debug

Code:
Server Crash Report
===================

RunUO Version 2.0, Build 3344.39098
Operating System: Microsoft Windows NT 5.2.3790 Service Pack 2
.NET Framework: 2.0.50727.42
Time: 05.04.2009 02:20:41
Mobiles: 36735
Items: 222855
Exception:
System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
   at System.ThrowHelper.ThrowKeyNotFoundException()
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at Server.Commands.SendTo.SendToGump.DisplayTo(Mobile from) in c:\Documents and Settings\Administrator\Desktop\runuomondains\Scripts\Customs\customs\tekiller\SendTo.cs:line 295
   at Server.Commands.SendTo.SendTo_OnCommand(CommandEventArgs e) in c:\Documents and Settings\Administrator\Desktop\runuomondains\Scripts\Customs\customs\tekiller\SendTo.cs:line 34
   at Server.Commands.CommandSystem.Handle(Mobile from, String text, MessageType type)
   at Server.Mobile.DoSpeech(String text, Int32[] keywords, MessageType type, Int32 hue)
   at Server.Mobiles.PlayerMobile.DoSpeech(String text, Int32[] keywords, MessageType type, Int32 hue) in c:\Documents and Settings\Administrator\Desktop\runuomondains\Scripts\Mobiles\PlayerMobile.cs:line 2241
   at Server.Engines.PartySystem.Chat3Guild.UnicodeSpeechChat3(NetState state, PacketReader pvSrc) in c:\Documents and Settings\Administrator\Desktop\runuomondains\Scripts\Customs\customs\Knives Chat 3.0 Beta 9\General\Chat3Guild.cs:line 122
   at Server.Network.MessagePump.HandleReceive(NetState ns)
   at Server.Network.MessagePump.Slice()
   at Server.Core.Main(String[] args)

THEN I MODIFIED IT LIKE THIS, NOW IT'S NOT GIVING CRASH BUT... THERE IS NO GUMP, I CAN ONLY USE [SENDTO LUNA AND ETC...

Code:
			[COLOR="Red"]/*[/COLOR]public static void DisplayTo( Mobile from )
			{
				LocationTree tree;

				if ( from.Map == Map.Ilshenar )
					tree = Ilshenar;
				else if ( from.Map == Map.Felucca )
					tree = Felucca;
				else if ( from.Map == Map.Trammel )
					tree = Trammel;
				else if (from.Map == Map.Malas )
					tree = Malas;
				else
				    tree = Tokuno;

				ParentNode branch = (ParentNode)tree.LastBranch[from];

				if ( branch == null )
					branch = tree.Root;

				if ( branch != null )
					from.SendGump( new SendToGump( 0, from, tree, branch ) );
			}[COLOR="#ff0000"]*/[/COLOR]
 
Code:
System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.



I do beleave I said this before. But i could be wrong But what does it hurt to try? At the top of the script there is a line that says:

Code:
using System.Collections.Generic;


What that is saying is that you have the ML Collections enabled on your server EG. You Installed one of the ML packages floating around.

If your getting that error it means you didn't install ML and you need to remove that line.


Try it and see what happens if need be you can tell me i'm a wack job and it didn't work.
 

.Lithium

Wanderer
I removed that line and... using System.Collections.Generic; btw my server supports ML and its installed
Code:
Errors:
 + Customs/customs/tekiller/SendTo.cs:
    CS0118: Line 107: 'Server.Commands.SendTo.List' is a 'field' but is used lik
e a 'type'
    CS0118: Line 107: 'Server.Commands.SendTo.List' is a 'field' but is used lik
e a 'type'
    CS0021: Line 112: Cannot apply indexing with [] to an expression of type 'Li
st<Server.Region>'
 
Top