Go Back   RunUO - Ultima Online Emulation > RunUO > Script Support

Script Support Get support for modifying RunUO Scripts, or writing your own!

Reply
 
Thread Tools Display Modes
Old 07-03-2003, 06:23 PM   #1 (permalink)
Forum Expert
 
flipside's Avatar
 
Join Date: Nov 2002
Location: the city of angels
Age: 20
Posts: 661
Send a message via ICQ to flipside
Default Sign Generation!

I wish to edit the [SignGen command to only spawn signs for felucca, britain here is my current signgen script:
[code:1]
using System;
using System.Collections;
using System.IO;
using Server;
using Server.Items;

namespace Server.Scripts.Commands
{
public class SignParser
{
private class SignEntry
{
public string m_Text;
public Point3D m_Location;
public int m_ItemID;
public int m_Map;

public SignEntry( string text, Point3D pt, int itemID, int mapLoc )
{
m_Text = text;
m_Location = pt;
m_ItemID = itemID;
m_Map = mapLoc;
}
}

public static void Initialize()
{
Server.Commands.Register( "SignGen", AccessLevel.Administrator, new CommandEventHandler( SignGen_OnCommand ) );
}

[Usage( "SignGen" )]
[Description( "Generates signs from an input file (signs.cfg)" )]
public static void SignGen_OnCommand( CommandEventArgs c )
{
Parse( c.Mobile );
}

public static void Parse( Mobile from )
{
string cfg = Path.Combine( Core.BaseDirectory, "Data/signs.cfg" );

if ( File.Exists( cfg ) )
{
ArrayList list = new ArrayList();
from.SendMessage( "Generating signs, please wait." );

using ( StreamReader ip = new StreamReader( cfg ) )
{
string line;

while ( (line = ip.ReadLine()) != null )
{
string[] split = line.Split( ' ' );

SignEntry e = new SignEntry(
line.Substring( split[0].Length + 1 + split[1].Length + 1 + split[2].Length + 1 + split[3].Length + 1 + split[4].Length + 1 ),
new Point3D( Utility.ToInt32( split[2] ), Utility.ToInt32( split[3] ), Utility.ToInt32( split[4] ) ),
Utility.ToInt32( split[1] ), Utility.ToInt32( split[0] ) );

list.Add( e );
}
}

Map[] fel = new Map[]{ Map.Felucca };

for ( int i = 0; i < list.Count; ++i )
{
SignEntry e = (SignEntry)list[i];
Map[] maps = null;

switch ( e.m_Map )
{
case 1: maps = fel; break; // Felucca
}

for ( int j = 0; maps != null && j < maps.Length; ++j )
Add_Static( e.m_ItemID, e.m_Location, maps[j], e.m_Text );
}

from.SendMessage( "Sign generating complete." );
}
else
{
from.SendMessage( "{0} not found!", cfg );
}
}

private static Queue m_ToDelete = new Queue();

public static void Add_Static( int itemID, Point3D location, Map map, string name )
{
IPooledEnumerable eable = map.GetItemsInRange( location, 0 );

foreach ( Item item in eable )
{
if ( item is Sign && item.Z == location.Z && item.ItemID == itemID )
m_ToDelete.Enqueue( item );
}

eable.Free();

while ( m_ToDelete.Count > 0 )
((Item)m_ToDelete.Dequeue()).Delete();

Item sign;

if ( name.StartsWith( "#" ) )
{
sign = new LocalizedSign( itemID, Utility.ToInt32( name.Substring( 1 ) ) );
}
else
{
sign = new Sign( itemID );
sign.Name = name;
}

sign.MoveToWorld( location, map );
}
}
}
[/code:1]
Currently it only spawns felucca but how can I make it do britain only?
flipside is offline   Reply With Quote
Old 07-03-2003, 06:25 PM   #2 (permalink)
Account Terminated
 
Join Date: Sep 2002
Age: 26
Posts: 3,846
Send a message via ICQ to Phantom Send a message via AIM to Phantom Send a message via MSN to Phantom
Default

Ummmmm

That would be really hard to do. You could try editing the signs.cfg to only have Britain Signs :-)

That most likely would be the best way for your skill level.
Phantom is offline   Reply With Quote
Old 07-03-2003, 06:35 PM   #3 (permalink)
Forum Expert
 
flipside's Avatar
 
Join Date: Nov 2002
Location: the city of angels
Age: 20
Posts: 661
Send a message via ICQ to flipside
Default

Im sure your right, but .cfg's are even more confusing to me than gumps ops:
flipside is offline   Reply With Quote
Old 07-03-2003, 06:44 PM   #4 (permalink)
Account Terminated
 
Join Date: Sep 2002
Age: 26
Posts: 3,846
Send a message via ICQ to Phantom Send a message via AIM to Phantom Send a message via MSN to Phantom
Default

Quote:
Originally Posted by flipdside
Im sure your right, but .cfg's are even more confusing to me than gumps ops:
Ummm Why do you say that?

0 3032 373 904 -1 #1016093

Map ID X Y Z Localized Message

Just get rid of all the signs that are not on felucca, and not near the britain region.
Phantom is offline   Reply With Quote
Old 07-03-2003, 06:53 PM   #5 (permalink)
Forum Expert
 
flipside's Avatar
 
Join Date: Nov 2002
Location: the city of angels
Age: 20
Posts: 661
Send a message via ICQ to flipside
Default

How can you tell which ones are in felucca and which arent in britain's region?
flipside is offline   Reply With Quote
Old 07-03-2003, 06:54 PM   #6 (permalink)
Forum Expert
 
flipside's Avatar
 
Join Date: Nov 2002
Location: the city of angels
Age: 20
Posts: 661
Send a message via ICQ to flipside
Default

Such as, what is map 0, 1, 2 ,3 and 4?
flipside is offline   Reply With Quote
Old 07-04-2003, 02:16 PM   #7 (permalink)
Account Terminated
 
Join Date: Sep 2002
Age: 26
Posts: 3,846
Send a message via ICQ to Phantom Send a message via AIM to Phantom Send a message via MSN to Phantom
Default

Quote:
Originally Posted by flipdside
How can you tell which ones are in felucca and which arent in britain's region?
Well if the location is in the town or not.

Your going to have to figure that out yourself, sorry for taking so long to reply went to bed after I went out last night.

To be honest without going to the locations and spending 20 minutes myself to figure out I can't tell you what order the map id's go.
Phantom is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5