Creating meta rules via a script

Unofficial support for the creating and editing of metas.
HittingSmoke
Posts: 28

Creating meta rules via a script

Post #1 »

This is for the same crafting meta I've been working on for the last few days and the logic of it is more or less completed. It runs. I just need recipes.

What I'd like to do is take the XML recipe list from Silo's archive for the Make It! extension and use a script to import them into my meta file.

I know how to parse XML with Python well enough, but even after reading Virindi's description of how meta files are layed out I'm still at a loss as to how to get that data into the meta file as new rules. I see basically how some of the data is constructed but there are some odd things.

I created a simple test meta. It has a single rule in the Default state. A Chat Condition and a Chat Command Action just say which is the condition and which is the action to make it clear in the source:

Code: Select all

1
CondAct
5
CType
AType
CData
AData
State
n
n
n
n
n
1
i
4
i
2
s
This is the condition
s
This is the action
s
Default
I made this into a table for a visual assist:

Image

According to the column names they should go, from left to right, Condition Type, Action Type, Condition Data, Action Data, State.

However, down where the rule rows are it's clearly from left to right a Condition Type, Condition Data, Action Type, Action Data, State.

I'm also not sure what line 1 and 2 are. Virindi's post here says the table count name should be up there. CondAct is the table name? What's the "1"? They seem to be the same across all my metas but some have more than one nested table it appears.

The Record Count row also doesn't make sense based on my understanding of the file layout. I see, from left to right, i, 4, i, 2, s. That's saying there's 4 records for Condition and 2 for Action? And why do the i's and s's not fall in the same column? Should they not all be in the type fields?

What do I have wrong here? Are there any existing scripts to easily manipulate and add or remove data from meta files?

Widgeon
Posts: 2

Post #2 »

Here's how to read that meta:

Code: Select all

1
CondAct
5                       5 columns
CType                   5 column names
AType
CData
AData
State
n                       5 column index flags
n
n
n
n
1                       1 rule
i                       CType is an integer, with value 4.  4 represents Condition: Chat
4
i                       AType is an integer, with value 2.  2 represents Action: Chat command
2
s                       CData is a string, with value "This is the condition"
This is the condition
s                       AData is a string, with value "This is the action"
This is the action
s                       State is a string, with value "Default"
Default
It looks like you've already managed to add the rest of the recipes to your meta, but here's a python script I wrote to generate a meta for making level 8 scrolls: https://github.com/nygard/miscac/blob/m ... nspells.py

It only supports the conditions and actions that I needed, but it would be pretty straightforward to add the missing ones -- I just haven't had time to do that.

Virindi
Posts: 11

Post #3 »

Here are the current condition and action ids:

enum eMetaActionTypeID
{
None = 0,
SetState = 1,
ChatCommand = 2,
Multiple = 3,
EmbeddedNavRoute = 4,
CallState = 5,
ReturnFromCall = 6,
ExpressionAct = 7,
ChatWithExpression = 8,
WatchdogSet = 9,
WatchdogClear = 10,
GetVTOption = 11,
SetVTOption = 12,
}

enum eMetaConditionTypeID
{
None = 0,
Always = 1,
MultipleALL = 2,
MultipleANY = 3,
ChatMessage = 4,
MainPackSlotsLE = 5,
SecondsInStateGE = 6,
NavrouteEmpty = 7,
Died = 8,
VendorOpen = 9,
VendorClosed = 10,
ItemCountLE = 11,
ItemCountGE = 12,
MonsterCountWithinDistance = 13,
MonstersWithPriorityWithinDistance = 14,
NeedToBuff = 15,
NoMonstersWithinDistance = 16,
LandBlockE = 17,
LandCellE = 18,
PortalspaceEnter = 19,
PortalspaceExit = 20,
Not = 21,
SecondsInStatePersistGE = 22,
TimeLeftOnSpellGE = 23,
BurdenPercentGE = 24,
DistanceToAnyRoutePointGE = 25,
Expression = 26,
ClientDialogPopup = 27,
ChatMessageCapture = 28,
}

HittingSmoke
Posts: 28

Post #4 »

Widgeon wrote:Here's how to read that meta:

Code: Select all

1
CondAct
5                       5 columns
CType                   5 column names
AType
CData
AData
State
n                       5 column index flags
n
n
n
n
1                       1 rule
i                       CType is an integer, with value 4.  4 represents Condition: Chat
4
i                       AType is an integer, with value 2.  2 represents Action: Chat command
2
s                       CData is a string, with value "This is the condition"
This is the condition
s                       AData is a string, with value "This is the action"
This is the action
s                       State is a string, with value "Default"
Default
It looks like you've already managed to add the rest of the recipes to your meta, but here's a python script I wrote to generate a meta for making level 8 scrolls: https://github.com/nygard/miscac/blob/m ... nspells.py

It only supports the conditions and actions that I needed, but it would be pretty straightforward to add the missing ones -- I just haven't had time to do that.
Thanks! That script will be super helpful in the future as I was thinking about making a script to easily add rules.
Virindi wrote:Here are the current condition and action ids:

enum eMetaActionTypeID
{
None = 0,
SetState = 1,
ChatCommand = 2,
Multiple = 3,
EmbeddedNavRoute = 4,
CallState = 5,
ReturnFromCall = 6,
ExpressionAct = 7,
ChatWithExpression = 8,
WatchdogSet = 9,
WatchdogClear = 10,
GetVTOption = 11,
SetVTOption = 12,
}

enum eMetaConditionTypeID
{
None = 0,
Always = 1,
MultipleALL = 2,
MultipleANY = 3,
ChatMessage = 4,
MainPackSlotsLE = 5,
SecondsInStateGE = 6,
NavrouteEmpty = 7,
Died = 8,
VendorOpen = 9,
VendorClosed = 10,
ItemCountLE = 11,
ItemCountGE = 12,
MonsterCountWithinDistance = 13,
MonstersWithPriorityWithinDistance = 14,
NeedToBuff = 15,
NoMonstersWithinDistance = 16,
LandBlockE = 17,
LandCellE = 18,
PortalspaceEnter = 19,
PortalspaceExit = 20,
Not = 21,
SecondsInStatePersistGE = 22,
TimeLeftOnSpellGE = 23,
BurdenPercentGE = 24,
DistanceToAnyRoutePointGE = 25,
Expression = 26,
ClientDialogPopup = 27,
ChatMessageCapture = 28,
}
Thanks, Virindi! I was hoping you'd find one of my posts. What I ended up doing is just copy/pasting an existing recipe rule, reformatting it to replace the values with variables and have Python create the proper output, then appending them to the meta. Then when opening the meta the first time VTank automatically alphabetizes them by state name.

I'll keep this bookmarked for later as it will be super helpful if I need to change anything.

Almedes
Posts: 15

Post #5 »

A little late to the party, but I made this awhile back, this is a basic breakdown of a meta file:

File Header___________________________________________________________
1 Table Count
CondAct Table Name
5 Number of Columns in Table
CType Column 1 Name
AType Column 2 Name
CData Column 3 Name
AData Column 4 Name
State Column 5 Name
n Is Column 1 Indexed? (y/n)
n Is Column 2 Indexed? (y/n)
n Is Column 1 Indexed? (y/n)
n Is Column 1 Indexed? (y/n)
n Is Column 1 Indexed? (y/n)
7 Number of Records in File/Table (# of rows?) & End of Header
Record #1__________________________________________________________________________
i Column 1 – Line 1 of Record - Condition Type Variable Code (Integer,String,etc… )
4 Column 1 – Line 2 of Record - Condition Type Variable Value (ex. 4=Chat Message)
i Column 2 – Line 3 of Record - Action Type Variable Code (Double,Integer,String,etc… )
1 Column 2 – Line 4 of Record - Action Type Variable Value (ex. 1=Set Meta State)
s Column 3 – 'Line 5 of Record - Condition Data Variable Code (Integer,String,etc… )
^.*(You).* (say), \"!doTestWave\"$ Column 3 - Line 6 of Record - Condition Data Variable Value
s Column 4 – Line 7 of Record - Action Data Variable Code (Integer,String,etc…
doTestWave Column 4 – Line 8 of Record - Action Data Variable Value
s Column 5 – Line 9 of Record - State Variable Code (String, Haven’t seen it any other way yet)
Default Column 5 – Line 10 of Record - State Variable Value (Name of State)
Record #2____________________________________________________________________________
i
4
i
1
s
^.*(You).* (say), \"!doMBTestNav\"$
s
doMBTestNav
s
Default
Record #3___________________________________________________________________________
i
0
i
3
i
0
Nested Table Start_________________________________________________________________________
TABLE
2
K
V
n
n
0
Nested Table End___________________________________________________________________________
s
Default
Record #4__________________________________________________________________________
i
0
i
4
i
0
ba
155
Nested Table Embedded Nav Route______________________________________________
[None]
2
uTank2 NAV 1.2
1
2
0
33.8422872543335
42.1556655963262
0.391687520345052
0
0
33.8007881164551
42.1481605847677
0.391687520345052
0
Nested Table Embedded Nav Route________________________________________________
s
doMBTestNav