Go Back   RunUO - Ultima Online Emulation > RunUO > RunUO Post Archive

RunUO Post Archive The Archvie

Reply
 
Thread Tools Display Modes
Old 05-27-2004, 03:15 PM   #1 (permalink)
 
Join Date: Mar 2003
Location: Near a lava pool
Age: 8
Posts: 1,012
Default Addon Script Generator

Summary:
This script exports a structure built in game with static items to a working addon script. The output script will create both the addon and the addon deed. Hue and light information will be exported as well.


Description:
I wrote this little script to help me out in a bigger project (maybe someone else did this before, I was too lazy to search for it ). It basically creates a fully working script for an addon based on a structure built in game (the script extracts static items, which is what the deco section of Pandora's Box creates, and I believe also UOArchitect). The script preserves hue and light type for light sources.

It's very easy to use, the command is:

[AddonGen <name> [<namespace>]

<name> is the name of your object. It should not contain spaces (so if you want your structure called Tower Of Chaos, name would be TowerOfChaos - the script will then generated two items: TowerOfChaosAddon and TowerOfChaosAddonDeed).

<namespace> this is optional. By default the script will place the classes it creates into Server.Items, unless this parameter is specified.

Once the command is executed, you get an area picker to select the region you wish to export. The structure you're exporting will NOT be deleted.

The script will be written to ...\RunUO\TheBox\<name>Addon.cs.

Installation:
Just put AddonGenerator.cs anywhere in your Scripts folder.

Update May 29:
  • Fixed the error occurring when the output folder doesn't exit
  • Added an option to specify a custom output path at the beginning of the file

Update June 1:
I have added a gump interface to the command. Access the gump by using no arguments (in other words just type [AddonGen).

Through the gump you can specify whether you wish to export items and/or statics, and also a Z range. Keep in mind that when exporting statics hue information will be lost because RunUO doesn't load hue information from the statics*.mul files.
Attached Files
File Type: cs AddonGenerator.cs (12.7 KB, 2751 views)
__________________
Oxygen should be regarded as a drug.
Arya is offline   Reply With Quote
Old 05-27-2004, 03:25 PM   #2 (permalink)
Newbie
 
Join Date: Oct 2002
Location: Brazil
Age: 21
Posts: 74
Send a message via ICQ to Matador Doidao Send a message via MSN to Matador Doidao
Default

wow



awesome
__________________
=)
Matador Doidao is offline   Reply With Quote
Old 05-27-2004, 03:30 PM   #3 (permalink)
Tru
Forum Expert
 
Tru's Avatar
 
Join Date: Jan 2003
Location: California
Age: 39
Posts: 3,260
Default

Quote:
Originally Posted by Matador Doidao
wow



awesome
I concur
Tru is offline   Reply With Quote
Old 05-27-2004, 03:48 PM   #4 (permalink)
Forum Expert
 
flowerbudd's Avatar
 
Join Date: Jul 2003
Location: Missouri
Age: 31
Posts: 701
Send a message via ICQ to flowerbudd Send a message via AIM to flowerbudd Send a message via MSN to flowerbudd Send a message via Yahoo to flowerbudd
Default

I'm not worthy to even say your name out loud. You are just amazing. I am so thankful we have such talents in this community, thank you for sharing this
__________________
Med-Surg Nurse, Full time Pittsburg State Univ Sophmore, and FT Mother to 5 kids
flowerbudd is offline   Reply With Quote
Old 05-27-2004, 04:59 PM   #5 (permalink)
 
Join Date: Mar 2003
Location: Near a lava pool
Age: 8
Posts: 1,012
Default

Quote:
Originally Posted by wraith
I assume this doesnt work on a structure frozen in the map?
No it doesn't, but I don't think it would be much trouble to do that. I'll try to add it if I have some free time.
__________________
Oxygen should be regarded as a drug.
Arya is offline   Reply With Quote
Old 05-27-2004, 05:32 PM   #6 (permalink)
Forum Expert
 
flowerbudd's Avatar
 
Join Date: Jul 2003
Location: Missouri
Age: 31
Posts: 701
Send a message via ICQ to flowerbudd Send a message via AIM to flowerbudd Send a message via MSN to flowerbudd Send a message via Yahoo to flowerbudd
Default

I'm sorry Arya, I am having a problem. I use PB to add items from the deco tab, ( for example a coffin, and when i try to do [addongen CoffinS and i target the boundaries it either tells me no items selected, or error writing file
__________________
Med-Surg Nurse, Full time Pittsburg State Univ Sophmore, and FT Mother to 5 kids
flowerbudd is offline   Reply With Quote
Old 05-27-2004, 06:13 PM   #7 (permalink)
 
Join Date: Mar 2003
Location: Near a lava pool
Age: 8
Posts: 1,012
Default

Quote:
Originally Posted by flowerbudd
I'm sorry Arya, I am having a problem. I use PB to add items from the deco tab, ( for example a coffin, and when i try to do [addongen CoffinS and i target the boundaries it either tells me no items selected, or error writing file
The first issue occurs because you probably target an area which is only 1 tile wide (and the script thinks it's empty...). I could work around this, but if you specify an area slightly wider (at least 2 tiles) it will still work correctly. The script calculates the bounds according to the items it finds, not the area picked, so it's safe to select an area larger than the item itself.

The file writing error needs some investigating on the other hand. Please open the script and go to line 250. Change the block from:

Code:
catch
{
	from.SendMessage( 0x40, "An error occurred when writing the file." );
	fail = true;
}
to:

Code:
catch ( Exception err )
{
	Console.WriteLine( err.ToString() );
	from.SendMessage( 0x40, "An error occurred when writing the file." );
	fail = true;
}
Then please let me know what kind of error is reported on the console and I'll see if it's something I can fix in the script.
__________________
Oxygen should be regarded as a drug.
Arya is offline   Reply With Quote
Old 05-27-2004, 06:17 PM   #8 (permalink)
Forum Expert
 
Join Date: Jan 2004
Posts: 1,377
Default

Arya, you are being loved :-)
__________________
Dracarys
retired - consider me dead to these boards
Dracarys is offline   Reply With Quote
Old 05-27-2004, 06:18 PM   #9 (permalink)
 
Join Date: Mar 2003
Location: Near a lava pool
Age: 8
Posts: 1,012
Default

No, I'm just being overestimated
__________________
Oxygen should be regarded as a drug.
Arya is offline   Reply With Quote
Old 05-27-2004, 06:25 PM   #10 (permalink)
Forum Expert
 
Join Date: Jan 2004
Posts: 1,377
Default

Overestimated? Nah...

Maybe a lot of people could have coded it.

But you DID code it. That's what matters.

So you are being loved now. Deal with it! *cough*
__________________
Dracarys
retired - consider me dead to these boards
Dracarys is offline   Reply With Quote
Old 05-27-2004, 06:48 PM   #11 (permalink)
 
Join Date: Oct 2003
Posts: 15
Send a message via ICQ to shorty12 Send a message via Yahoo to shorty12
Default

*BOWS TO ARYA* i've been looking for something like this for along time, thanks again for another wonderful script!
shorty12 is offline   Reply With Quote
Old 05-27-2004, 07:12 PM   #12 (permalink)
Faustrealms Co-Owner
 
Join Date: Jul 2003
Age: 26
Posts: 155
Default

Quote:
Originally Posted by flowerbudd
I'm sorry Arya, I am having a problem. I use PB to add items from the deco tab, ( for example a coffin, and when i try to do [addongen CoffinS and i target the boundaries it either tells me no items selected, or error writing file

I had the same error and fixed it by creating a new folder in the main RunUO directory labeled "TheBox"
Kizozen is offline   Reply With Quote
Old 05-27-2004, 07:19 PM   #13 (permalink)
Newbie
 
Join Date: Oct 2002
Location: Brazil
Age: 21
Posts: 74
Send a message via ICQ to Matador Doidao Send a message via MSN to Matador Doidao
Default

or you can change the folder inside the script
;p
__________________
=)
Matador Doidao is offline   Reply With Quote
Old 05-27-2004, 07:19 PM   #14 (permalink)
Moderate
 
David's Avatar
 
Join Date: Nov 2002
Location: USA
Posts: 6,598
Default

Quote:
Originally Posted by Arya
No, I'm just being overestimated
nah, I'd say your pretty awesome... simple enough really.
__________________
David Forum Moderator
The RunUO.com Forum Moderator Team

Forum Rules and Guidelines
RunUO Forum Search Engine
Download RunUO 2.0 RC2
David is offline   Reply With Quote
Old 05-27-2004, 07:23 PM   #15 (permalink)
Moderate
 
David's Avatar
 
Join Date: Nov 2002
Location: USA
Posts: 6,598
Default

Hey come on guys! Rate these submissions!

This is like awesome stuff here and with 15 posts and over 40 downloads I was the first one to rate it? Come on, snap to it!
__________________
David Forum Moderator
The RunUO.com Forum Moderator Team

Forum Rules and Guidelines
RunUO Forum Search Engine
Download RunUO 2.0 RC2
David is offline   Reply With Quote
Old 05-27-2004, 09:28 PM   #16 (permalink)
 
Final Realms's Avatar
 
Join Date: Jun 2003
Location: Third Rock from the sun ( Europe, Portugal )
Posts: 108
Talking

Quote:
Originally Posted by David
Hey come on guys! Rate these submissions!

This is like awesome stuff here and with 15 posts and over 40 downloads I was the first one to rate it? Come on, snap to it!
True... *snaps to it* wish more people would rate scripts... I know I rate those i truly enjoy *insert shameless plug here for people to go rate their favourite scripts * *end plug*

Now back to Arya... Where exactly did you say you wanted the candles at, oh holy goddess of code?
Final Realms is offline   Reply With Quote
Old 05-28-2004, 04:35 AM   #17 (permalink)
 
Join Date: Mar 2003
Location: Near a lava pool
Age: 8
Posts: 1,012
Default

I fixed the (stupid) error occurring when the output folder didn't exist, and also added an option to change the default output location at the beginning of the file.
__________________
Oxygen should be regarded as a drug.
Arya is offline   Reply With Quote
Old 05-28-2004, 05:11 AM   #18 (permalink)
Newbie
 
Join Date: Jan 2004
Location: Inverness, FL, USA
Age: 52
Posts: 24
Send a message via Yahoo to Zigamus
Default

I dont write scripts, yet, but I have been programming in basic for many years. Scanning your script I didnt see any mention of a MAX size this can handle. is it limited? and if so to what size plz? Also, does this handle ALL Z levels in the bounded box?
Zigamus is offline   Reply With Quote
Old 05-28-2004, 05:34 AM   #19 (permalink)
 
Join Date: Mar 2003
Location: Near a lava pool
Age: 8
Posts: 1,012
Default

Quote:
Originally Posted by Zigamus
I dont write scripts, yet, but I have been programming in basic for many years. Scanning your script I didnt see any mention of a MAX size this can handle. is it limited? and if so to what size plz? Also, does this handle ALL Z levels in the bounded box?
I'm not sure I understand excatly what you mean by max size. If you're talking about the number of items you can put in the addon, I didn't set any limits. I don't think it's realistically possible to create an addon that will make the computer run out of memory. It would probably take more items than the client can handle anyway, so that shouldn't be an issue.

If you're talking about array sizes, I'm using an ArrayList object which is similar to an array but can grow in size when needed, therefore you don't have to specify a maximum size.

And yes, it does handle all Z levels.
__________________
Oxygen should be regarded as a drug.
Arya is offline   Reply With Quote
Old 05-29-2004, 12:36 AM   #20 (permalink)
 
Join Date: Aug 2003
Location: Omaha, Nebraska
Age: 54
Posts: 42
Send a message via ICQ to Styla Send a message via MSN to Styla
Cool

Thanks. Now my wife won't kill me because I can't move her house from B36 to RCO 1.0. I bow to a true code master (and savior of marriages).
Styla is offline   Reply With Quote
Old 05-29-2004, 12:52 PM   #21 (permalink)
Forum Expert
 
Join Date: Oct 2003
Location: Calhoun, Ga
Age: 44
Posts: 1,008
Send a message via AIM to roadmaster
Default

Quote:
I fixed the (stupid) error occurring when the output folder didn't exist, and also added an option to change the default output location at the beginning of the file.

Sir this is an excellent script, I would like to make a humble suggestion if i may...

In your Summary for your Custom Path:

Code:
/// <summary>
/// Set this value if you wish the scripts to be output somewhere else rather than in the default RunUO\TheBox
/// directory. This should be a full valid path on your computer 
/// ( Ex.  C:\Program Files\RunUO\Scripts\Custom\Addons)
/// </summary>
could you add to your example path to let newbies know that they will need to add a @ and " " symbols in order for the custom path to not throw an "Unrecognized escape sequence" error on compile when trying to use a custom path.

while intermediate to advanced programmers will know what this means, newbs wont.


roadmaster
roadmaster is offline   Reply With Quote
Old 05-29-2004, 02:32 PM   #22 (permalink)
 
Join Date: Mar 2003
Location: Near a lava pool
Age: 8
Posts: 1,012
Default

Good point roadmaster, I'll make sure it's done in the next revision. Thanks
Arya is offline   Reply With Quote
Old 05-29-2004, 03:07 PM   #23 (permalink)
 
Join Date: Aug 2003
Location: Omaha, Nebraska
Age: 54
Posts: 42
Send a message via ICQ to Styla Send a message via MSN to Styla
Cool

Quote:
Originally Posted by roadmaster
could you add to your example path to let newbies know that they will need to add a @ and " " symbols in order for the custom path to not throw an "Unrecognized escape sequence" error on compile when trying to use a custom path.

while intermediate to advanced programmers will know what this means, newbs wont.
roadmaster
Excuse me, but I am newbie enough to not know where these go. Could you plz post a code snippet using this?
Styla is offline   Reply With Quote
Old 05-29-2004, 03:16 PM   #24 (permalink)
Forum Novice
 
Join Date: Mar 2004
Location: Germany
Age: 23
Posts: 301
Default

Quote:
Originally Posted by Styla
Excuse me, but I am newbie enough to not know where these go. Could you plz post a code snippet using this?
I don't have the script on front of me, so I can't quote from it.
But what he means is something like:

string MyVariable = @"C:\Program Files\RunUO\MyOutput";
floppydisc is offline   Reply With Quote
Old 05-29-2004, 03:54 PM   #25 (permalink)
Forum Novice
 
Join Date: Jun 2003
Posts: 165
Default

Seriously Arya, you are like a scripting goddess. You are great plus you are nice to people. I think I am going to add you on the Credits section of my shard web hahaha!

Seriously, 3 5-Star scripts in a few days... plus pandora's box... Incredible :_)
joantinet is offline   Reply With Quote
Reply

Bookmarks


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