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!

CEO's Yet Another Arya Addon Generator (YAAAG) RC1/RC2

CEO

Sorceror
CEO's Yet Another Arya Addon Generator (YAAAG) RC1/RC2

After taking a look at Hammer's nice waterfall addons I decided to checkout Arya's initial work (brilliant!) and tinker around with it. I pretty much ended up rewriting nearly all of it and also reworking the Addon code that's generated to be more efficient by using static tables. The Gump is also reworked with the ability to export statics, items(new), and tiles each having their own unique ID range(included or excluded). Basically you can now check out a player's artwork in their house and easily create an Addon from it. Also for those that like to create an Addon and check that it's right you also now can generate a test Addon on-the-fly and place it without having to recompile to see it, which should be a great time saving tool! This test Addon has all the components identified by where they are in the generated commented code so you can easily tinker with it. For example here's what Hammer's SmallWaterfallEastAddon looks like with new code(Just the AddOn part):

Code:
	public class SmallWaterfallEastAddon : BaseAddon
	{
        private static int[,] m_AddOnSimpleComponents = new int[,] {
			  {6039, 0, -1, 1}, {6039, 1, -1, 1}, {4944, -1, -1, 1}// 1	2	3	
			, {4932, -2, -1, 1}, {4958, -2, -1, 5}, {4959, -1, -1, 1}// 4	5	6	
			, {4960, 0, -1, 1}, {4963, 0, -1, 3}, {4967, 1, -1, 3}// 7	8	9	
			, {4970, 1, -1, 2}, {4945, -1, -2, 1}, {4973, 2, -1, 5}// 10	11	12	
			, {4963, 2, -1, 1}, {6039, 2, -1, 1}, {4967, 3, -1, 3}// 13	14	15	
			, {4970, 3, -1, 1}, {13422, 1, 0, 2}, {13422, 1, 1, 2}// 16	17	18	
			, {13555, -1, 1, 1}, {13555, -1, 0, 1}, {6002, -3, 1, 2}// 19	20	21	
			, {6006, -2, 0, 3}, {4956, -3, 0, 5}, {4963, -1, 0, 14}// 22	23	24	
			, {13451, 1, 0, 3}, {6009, 3, 0, 3}, {4963, 3, 1, 3}// 25	26	27	
			, {13422, 2, 1, 2}, {13422, 2, 0, 2}, {3248, 3, 0, 8}// 28	29	30	
			, {13573, 0, 1, 1}, {13573, 0, 0, 1}, {4943, -3, 3, 1}// 31	32	35	
			, {4944, -2, 3, 1}, {13422, 1, 2, 2}, {13555, -1, 2, 1}// 36	37	38	
			, {4959, -1, 3, 9}, {4960, 0, 3, 9}, {6002, -2, 2, 5}// 39	40	41	
			, {4963, 0, 3, 1}, {6001, 1, 3, 1}, {4962, -1, 3, 1}// 42	43	44	
			, {4963, -2, 2, 1}, {4970, -1, 3, 19}, {6001, -1, 2, 20}// 45	46	47	
			, {4967, 0, 3, 1}, {3219, -1, 3, 14}, {4967, 3, 2, 3}// 48	49	50	
			, {4970, 3, 3, 7}, {4967, 3, 3, 7}, {13422, 2, 2, 2}// 51	52	53	
			, {4962, 2, 3, 2}, {4963, 3, 3, 2}, {13573, 0, 2, 1}// 54	55	56	
					};

 
        private static int[,] m_AddOnComplexComponents = new int[,] {
			  {6010, -3, 0, 0, 1885, -1 }, {4967, -1, 1, 19, 1891, -1 }// 33	34	
		};

    
		public override BaseAddonDeed Deed
		{
			get
			{
				return new SmallWaterfallEastAddonDeed();
			}
		}

		[ Constructable ]
		public SmallWaterfallEastAddon()
		{

            for (int i = 0; i < m_AddOnSimpleComponents.Length / 4; i++)
                AddComponent( new AddonComponent( m_AddOnSimpleComponents[i,0] ), m_AddOnSimpleComponents[i,1], m_AddOnSimpleComponents[i,2], m_AddOnSimpleComponents[i,3] );

            for (int i = 0; i < m_AddOnComplexComponents.Length / 6; i++)
                AddComplexComponent((BaseAddon)this,  m_AddOnComplexComponents[i,0], m_AddOnComplexComponents[i,1], m_AddOnComplexComponents[i,2], m_AddOnComplexComponents[i,3], m_AddOnComplexComponents[i,4], m_AddOnComplexComponents[i,5] );

		}

		public SmallWaterfallEastAddon( Serial serial ) : base( serial )
		{
		}

        private static void AddComplexComponent(BaseAddon addon, int item, int xoffset, int yoffset, int zoffset, int hue, int lightsource)
        {
            AddComplexComponent(addon, item, xoffset, yoffset, zoffset, hue, lightsource, null);
        }

        private static void AddComplexComponent(BaseAddon addon, int item, int xoffset, int yoffset, int zoffset, int hue, int lightsource, string name)
        {
            AddonComponent ac;
            ac = new AddonComponent(item);
            if (name != null)
                ac.Name = name;
            if (hue != 0)
                ac.Hue = hue;
            if (lightsource != -1)
                ac.Light = (LightType) lightsource;
            addon.AddComponent(ac, xoffset, yoffset, zoffset);
        }

		public override void Serialize( GenericWriter writer )
		{
			base.Serialize( writer );
			writer.Write( 0 ); // Version
		}

		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );
			int version = reader.ReadInt();
		}
	}
And here's sample of how the test Addon's components are created and identified:



The 1st number is the corresponding number of where it is in the commented code, the 2nd is its static ID and then its x/y/z displacement. See how quick you can find that component in the comment code. :)

New gump:


Each exported type by default falls within the standard static ID ranges with the checked values. To reverse ranges selection method simply uncheck it and only ID's that fall outside that range are selected for the Addon. Same goes for the Z axis, by default all Z values are included. By using a combo of includes/excludes and narrowed ranges you can ignore certain IDs that you don't want to include in your new Addon. The new Test&Gen button writes the Addon and pops up a target for you to place what you've just defined and IDing each component(see above). Note: When saving an Item in the Addon, it is turned into a Static. As a result no properties are carried over, sorry that's the way Addons work.

About the table formats
The m_AddOnSimpleComponents table is generated with 4 values per component. IE:
Code:
{14284, 1, 2, 3}, {13573, 0, 0, 1}, {13573, 0, 1, 1}// 2	6	7
They are the Static ID, x/y/z displacements.

The m_AddOnComplexComponents table is generated with 6 values per component. IE:
Code:
{6010, -3, 0, 0, 1885, -1 }, {4967, -1, 1, 19, 1891, -1 }// 5	20
They are the Static ID, x/y/z displacements, Hue, and LightSource (-1 if none).

In the case of a component that has a modified Name field, a single line is generated for each component, which will look something like this:
Code:
AddComplexComponent( (BaseAddon) this, 3630, 4, 0, 0, 37, 2, "Red Ball" );// 1
Same order as the complex table, with the Name field added on the end.


Works with both RC1 and RC2, simply remove or comment out the
Code:
#define RC2
line near the top of the code to switch to Arrays vs. List<> (RC2) code.
 

Attachments

  • AddonGenerator.cs
    33.8 KB · Views: 929

Liacs

Sorceror
wow! this is just perfect. I love that you can see the coordinates of the tiles.

BTW: Do you also have an addon2static? :D

Thanks a lot!
 

Hotshot

Sorceror
cant wait to try this out and YES ! it will save alot of time with the test, great work. cant wait for that Awesome Blackjack machine *hint* lol. thanks for the awesome upgrade.
 

Hotshot

Sorceror
well got a Error, I know its gotta be an easy fix.
any Ideas ?
Errors:
+ Custom Scripts/AddonGenerator.cs:
CS0029: Line 265: Cannot implicitly convert type 'System.Collections.ArrayLi
st' to 'System.Collections.Generic.List<Server.Tile>'

Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.
 

ArteGordon

Wanderer
Hotshot;714130 said:
well got a Error, I know its gotta be an easy fix.
any Ideas ?
Errors:
+ Custom Scripts/AddonGenerator.cs:
CS0029: Line 265: Cannot implicitly convert type 'System.Collections.ArrayLi
st' to 'System.Collections.Generic.List<Server.Tile>'

Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.

you must be running RC1
Works with both RC1 and RC2, simply remove or comment out the
Code:
#define RC2
line near the top of the code to switch to Arrays vs. List<> (RC2) code.
 

Hotshot

Sorceror
Ahh see, got ahead of myself and missed that. Then after re-reading it after i posted, i seen my mistake. but thanks for quick response.
 

CEO

Sorceror
Liacs;714104 said:
wow! this is just perfect. I love that you can see the coordinates of the tiles.

BTW: Do you also have an addon2static? :D

Thanks a lot!
Hmm, I like to coord thing too, I must of copied a different AddOn from the one I used in the picture though. Item 20, doesn't match up with where it should be! lol.. I'll fix that...

Edit: There picture now matches where it should be. Item 35!
 

CEO

Sorceror
Updated to 1.1.

  • Converted AddComplexComponent to private static. (new code generated reflected in original post)

I've also added an explanation of the values in the tables in the original post for those of you that like to tinker with the Addon. :)
 

Hammerhand

Knight
*grumble* You could have told me about that "no need to compile to check the addon" part when I was testing it for you. lol Or did you add that after? Oh well, no worries. Guess I'm gonna have to get back to creating new addons again. :D *starts the thinking (ouch) process (owie, whimper)* ;)
 

CEO

Sorceror
Hammerhand;714167 said:
*grumble* You could have told me about that "no need to compile to check the addon" part when I was testing it for you. lol Or did you add that after? Oh well, no worries. Guess I'm gonna have to get back to creating new addons again. :D *starts the thinking (ouch) process (owie, whimper)* ;)
Yeah, it wasn't in the version I sent to you. I worked on that and other options/gump later.
 

Kamron

Knight
This is fairly practical, I like it.

A tip though for making the code a little simplier:
the names here:
{simplecomponentscode}
{complexcomponentscode}
{namedcomponentscode}
could be replaced with numbers, such as {0} {1}, etc

then you could use
Code:
String.Format( m_Template, arg strings, go, here );

Also, for your callbacks, you use:
Code:
private static void PickerCallback(Mobile from, Map map, Point3D start, Point3D end, object state)
which is proper, but instead of state being an array of objects which need to be casted, you could make state an object with the array components as properties. This would mean that you do not need to make uneeded casting and try/catches.

It would look similar to.

Code:
PickerArguments pickargs = (PickerArguments)state;

bool getStatics = pickargs.GetStatics;
bool getItems = pickargs.GetItems;
...

- Those are my few thoughts/opinions, enjoy.
 

CEO

Sorceror
I think using the template like it is now makes it easier to read as far as what is being replaced into the template (named strings) and where. Probably doesn't make a whole lot of difference for building the Addon itself.

As far as the callback stuff, that's from the original and I didn't really see a big reason to modify how that works except to make it larger for the new arguments. :p

Thx for the feedback, good ideas.
 

nadious

Sorceror
CEO,

I've noticed on this script (and another one... I think it was your Keno board) that I get errors that seem to conflict with Xantho's auction system. I don't have the codes right in front of me (I could generate them if needed...) but it has a LONG list of problems with 'hues.'

Just curious if anyone else has made mention of this problem before to you? I know without the console report, it's hard to really say.... I'll try to see if I can't get that info you.

Btw, our Casino is HOPP'N thanks to your Slot Machines. :D
 

CEO

Sorceror
nadious;714240 said:
CEO,

I've noticed on this script (and another one... I think it was your Keno board) that I get errors that seem to conflict with Xantho's auction system. I don't have the codes right in front of me (I could generate them if needed...) but it has a LONG list of problems with 'hues.'

Just curious if anyone else has made mention of this problem before to you? I know without the console report, it's hard to really say.... I'll try to see if I can't get that info you.

Btw, our Casino is HOPP'N thanks to your Slot Machines. :D
Hmm, first I've heard about that, I'd need the errors generated. PM me a sample. Possibly something named the same, though I think that would be unlikely. I don't use that auction system and I couldn't think of a reason why they would conflict. It's probably something else conflicting, hues shouldn't make any difference.

You're welcome regarding the slots, it's a great gold sink! :rolleyes:
 

CEO

Sorceror
Crowley62;714277 said:
Wow great job thx. Did you give up on adding to your slot machines and on the poker? I sure hope not
Already did Video Blackjack, just haven't released it yet, its been in extended beta on our shard for a few months now. :cool: I'm about 1/5th done with Video Poker. Then will probably do Texas Hold'em if the one that I've heard about hasn't been released or no one else has done it. I hate re-inventing something that's already been done and works well though, so I hope maybe they can see fit to release theirs as they've had it for quite awhile now and they have nothing to worry about shard competition since they're defacto the best anyways! ;)

I have a couple of new themes in mind for the slots, but have been busy with other stuff.
 

Yiffi

Wanderer
Thank you very much CEO it looks like a great update/remake of a well loved script. I will be using this a lot. :D
 
Top