User avatar
lodilefty
Posts: 7616
Joined: Sat Aug 11, 2007 3:27 pm
Location: Finger Lakes, NY GMT -5 US Eastern

Selecting a unit at a location

Mon Mar 03, 2008 7:13 pm

I'm trying to writ an event that chacks a specific area [or region] for a specific unit. If that unit exists at that location, then actions ensue.

My latest effort grabbed 'Cotton' from aywhere on the entire map and removed it, rather than selecting only cotton at $West Indies:

[INDENT]SelectFaction = $CSA
StartEvent = cotton_event2|999|1|NULL|NULL|NULL|NULL

Conditions
MinDate = 1861/04/01
MaxDate = 1866/12/31
PickUnit = $West Indies;1;$uni_CSA_Mer
GenMsg
EvalUnitSel = NULL

Actions
ChangeWSUPool = 15
SelUnqSubUnit = Cotton
RemoveCuSubUnit = Cotton

EndEvent
[/INDENT]

Atached screenshot is my next thought, but I'm not sure of syntax and use of the commands...

Any thoughts?
Always ask yourself: "Am I part of the Solution?" If you aren't, then you are part of the Problem!
[CENTER][/CENTER]
[CENTER]Visit AGEWiki - your increasingly comprehensive source for information about AGE games[/CENTER]

[CENTER]Rules for new members[/CENTER]
[CENTER]Forum Rules[/CENTER]

[CENTER]Help desk: support@slitherine.co.uk[/CENTER]

User avatar
Pocus
Posts: 25673
Joined: Wed Oct 19, 2005 7:37 am
Location: Lyon (France)

Tue Mar 04, 2008 9:21 am

PickUnit = $West Indies;1;$uni_CSA_Mer

won't work, you need a UnitType (category) not a specific UnitUID.

You are better using that:

SelectSubUnits Region <RgnUID>|Area <AreaUID>|Families <Fam1> <Fam2> ..|Models <Mdl1> <Mdl2> ..|FactionTags <Tag1> <Tag2> ..|Domains <_domLand> <_domNav> <_domAir>

in the Conditions block, with a EvalSubUnitSel to trigger the Actions block.

and you forgot a space between Area and the Area alias.
Image


Hofstadter's Law: "It always takes longer than you expect, even when you take into account Hofstadter's law."

User avatar
lodilefty
Posts: 7616
Joined: Sat Aug 11, 2007 3:27 pm
Location: Finger Lakes, NY GMT -5 US Eastern

Tue Mar 04, 2008 12:32 pm

Thank you again! :king:
Always ask yourself: "Am I part of the Solution?" If you aren't, then you are part of the Problem!
[CENTER][/CENTER]

[CENTER]Visit AGEWiki - your increasingly comprehensive source for information about AGE games[/CENTER]



[CENTER]Rules for new members[/CENTER]

[CENTER]Forum Rules[/CENTER]



[CENTER]Help desk: support@slitherine.co.uk[/CENTER]

User avatar
lodilefty
Posts: 7616
Joined: Sat Aug 11, 2007 3:27 pm
Location: Finger Lakes, NY GMT -5 US Eastern

Tue Mar 04, 2008 2:18 pm

I'd love to add this to Wiki, but I have no clue how to add a new section.....

:bonk: :bonk:
Always ask yourself: "Am I part of the Solution?" If you aren't, then you are part of the Problem!
[CENTER][/CENTER]

[CENTER]Visit AGEWiki - your increasingly comprehensive source for information about AGE games[/CENTER]



[CENTER]Rules for new members[/CENTER]

[CENTER]Forum Rules[/CENTER]



[CENTER]Help desk: support@slitherine.co.uk[/CENTER]

User avatar
lodilefty
Posts: 7616
Joined: Sat Aug 11, 2007 3:27 pm
Location: Finger Lakes, NY GMT -5 US Eastern

Still stuck!

Tue Mar 04, 2008 2:51 pm

I'm trying to model 'create cotton at times, pick it up with a brig or transport, take it to West Indies and get WSU and Money'. I've unlocked the West Indies successfully in my mod, but still have issues:

[INDENT]
  1. The 'cotton' appears as 'static, can't leave the region'. Why? {I added the unit type to the pool, to pursue a theory that static units like this are static because they exceed pool size - this appears to disprove that, at least if the pool is increased the same turn as the uni appears.....} See screenshot.
  2. My cotton2 event properly identifies the lack of a unit inWest Indies, but then gives a 'true' result and executes the actions anyway.
[/INDENT]

Here's the events and the script report:

SelectFaction = $CSA

SelectFaction = $CSA
StartEvent = merch_pool|1|0|NULL|NULL|NULL|NULL

Conditions
MinDate = 1861/04/01

Actions
ChangeUnitPool = $uni_CSA_Mer;1

EndEvent

SelectFaction = $CSA
StartEvent = cotton_event1|999|1|NULL|NULL|NULL|NULL

Conditions
MinDate = 1861/04/01
MaxDate = 1866/12/31
TurnIndex = 10;16;22;
Probability = 75

Actions
AddToRegList = $Iberville, LA;$Mobile, AL;$Galveston, TX;$New Hanover, NC;$Charleston, SC;
PickFromRegList = NotEnemy
GenMsg

SelectFaction = $CSA
CreateGroup
Posture = $Defensive
SetKind = $Land
InCS = 1
FixType = 0
SetName = Cotton
Apply
CreateUnit
SetType = $uni_CSA_Mer
SetName = Cotton
Apply

EndEvent

SelectFaction = $CSA
StartEvent = cotton_event2|999|1|NULL|NULL|NULL|NULL

Conditions
MinDate = 1861/04/01
MaxDate = 1866/12/31
SelectSubUnits = Area $OMB_WestIndies;Models $mdl_CSA_Mer
EvalSubUnitSel = NULL

Actions
ChangeMoneyPool = 10
ChangeWSUPool = 10
SelectSubUnits = Area $OMB_WestIndies;Models $mdl_CSA_Mer
AlterCuSubUnit = ApplyToList;Model $mdl_CSA_Mer;Kill

EndEvent

------------------------------
Line 20565: SelectFactions, 1 Faction selected: Confederate States of America
Line 20566: Started processing event: cotton_event2
Line 20566: Event already referenced, current occurences 0 Max allowed: 999 <<Active>>
Line 20569: Min date evaluated: 1861/04/01 converted to turn 2671 current turn 2675 True
Line 20570: Max date evaluated: 1866/12/31 converted to turn 2809 current turn 2675 True
Line 20571: SelectSubUnits finished Regions Selected: 1 SubUnits Selected: 0
Line 20572: Evaluate Sub Unit Selected : True
Line 20574: Entering triggered actions for event cotton_event2
Line 20575: ChangeMoneyPool Confederate States of America New money reserve is 14
Line 20576: ChangeWSUPool Confederate States of America New WSU pool is 38
Line 20577: SelectSubUnits finished Regions Selected: 1 SubUnits Selected: 0
Line 20578: [WARNING] AlterCuSubUnit: Selection is empty (Apply To List)
Line 20580: Finished processing event: cotton_event2
Line 20580: ------------------------------

What am I missing?
Always ask yourself: "Am I part of the Solution?" If you aren't, then you are part of the Problem!
[CENTER][/CENTER]

[CENTER]Visit AGEWiki - your increasingly comprehensive source for information about AGE games[/CENTER]



[CENTER]Rules for new members[/CENTER]

[CENTER]Forum Rules[/CENTER]



[CENTER]Help desk: support@slitherine.co.uk[/CENTER]

User avatar
Rafiki
Posts: 5811
Joined: Thu Aug 24, 2006 9:19 am
Location: Oslo, Norway

Tue Mar 04, 2008 2:57 pm

lodilefty wrote:I'd love to add this to Wiki, but I have no clue how to add a new section.....

:bonk: :bonk:

I'll see what I can do to get you started later today

In the meantime, feel free to add me to your messenger contact list, if you use that kind fo thing :)
[CENTER]Latest patches: AACW :: NCP :: WIA :: ROP :: RUS :: PON :: AJE
Visit AGEWiki - your increasingly comprehensive source for information about AGE games
[SIGPIC][/SIGPIC]
[/CENTER]

User avatar
Jabberwock
Posts: 2204
Joined: Thu May 31, 2007 12:12 am
Location: Weymouth, MA
Contact: ICQ

Tue Mar 04, 2008 2:59 pm

Its pretty complex.

1. Log in.
2. Go to the modding section.
3. Click on a sub-section.
4. Click on one of the links in yellow (not the edit links - one of the titles)
5. Scroll down, you should see a template. (under Usage)
6. Copy it to the clipboard.
7. Hit the back button to get back to the sub-section you want.
8. Now hit the edit link for the sub-section.
9. Paste the template in the appropriate place, and use it as a guide to create the new entry.
10. Check your work. You will probably have made a mess by this point.
11. Get ahold of Rafiki.

That's what I did.
[color="DimGray"] You deserve to be spanked[/color]

Image

User avatar
lodilefty
Posts: 7616
Joined: Sat Aug 11, 2007 3:27 pm
Location: Finger Lakes, NY GMT -5 US Eastern

Tue Mar 04, 2008 3:01 pm

Jabberwock wrote:Its pretty complex.

1. Log in.
2. Go to the modding section.
3. Click on a sub-section.
4. Click on one of the links in yellow (not the edit links - one of the titles)
5. Scroll down, you should see a template.
6. Copy it to the clipboard.
7. Hit the back button to get back to the sub-section you want.
8. Now hit the edit link for the sub-section.
9. Paste the template in the appropriate place, and use it as a guide to create the new entry.
10. Check your work. You will probably have made a mess by this point.
11. Get ahold of Rafiki.

That's what I did.


OK! I see I started with #11. I'm noted for skipping the fluff and getting to the answer.... :niark:
Always ask yourself: "Am I part of the Solution?" If you aren't, then you are part of the Problem!
[CENTER][/CENTER]

[CENTER]Visit AGEWiki - your increasingly comprehensive source for information about AGE games[/CENTER]



[CENTER]Rules for new members[/CENTER]

[CENTER]Forum Rules[/CENTER]



[CENTER]Help desk: support@slitherine.co.uk[/CENTER]

User avatar
lodilefty
Posts: 7616
Joined: Sat Aug 11, 2007 3:27 pm
Location: Finger Lakes, NY GMT -5 US Eastern

Tue Mar 04, 2008 3:31 pm

Did 1-10, and it didn't look bad in preview.

When I saved changes, it went into Wolkenkuckucksheim.... :p leure:

back to step 11
Always ask yourself: "Am I part of the Solution?" If you aren't, then you are part of the Problem!
[CENTER][/CENTER]

[CENTER]Visit AGEWiki - your increasingly comprehensive source for information about AGE games[/CENTER]



[CENTER]Rules for new members[/CENTER]

[CENTER]Forum Rules[/CENTER]



[CENTER]Help desk: support@slitherine.co.uk[/CENTER]

User avatar
Rafiki
Posts: 5811
Joined: Thu Aug 24, 2006 9:19 am
Location: Oslo, Norway

Tue Mar 04, 2008 8:03 pm

As far as I can see, you haven't saved anything? What went wrong?

Jabberwock's guide is good :) One further tip I'd give is that if you come over something that you want to copy/emulate in an edit you want to do, simply click "edit" on the thing you want to copy/emulate, which will show you the syntax behind it all, that you can copy/paste/modify as much as you like. (I have no idea how many edits I have made on various wikis based on syntax I've found & copied from elsewhere)
[CENTER]Latest patches: AACW :: NCP :: WIA :: ROP :: RUS :: PON :: AJE

Visit AGEWiki - your increasingly comprehensive source for information about AGE games

[SIGPIC][/SIGPIC]

[/CENTER]

User avatar
lodilefty
Posts: 7616
Joined: Sat Aug 11, 2007 3:27 pm
Location: Finger Lakes, NY GMT -5 US Eastern

Tue Mar 04, 2008 11:06 pm

Rafiki wrote:As far as I can see, you haven't saved anything? What went wrong?

Jabberwock's guide is good :) One further tip I'd give is that if you come over something that you want to copy/emulate in an edit you want to do, simply click "edit" on the thing you want to copy/emulate, which will show you the syntax behind it all, that you can copy/paste/modify as much as you like. (I have no idea how many edits I have made on various wikis based on syntax I've found & copied from elsewhere)


AAAARGh! I've created an empty edit, and wiped out EvalUnqUnit at the same time...... :p leure:

Edit: I'm getting the new one filled, but still lost the one I thought I was copying...

Sigh..... :bonk:
Always ask yourself: "Am I part of the Solution?" If you aren't, then you are part of the Problem!
[CENTER][/CENTER]

[CENTER]Visit AGEWiki - your increasingly comprehensive source for information about AGE games[/CENTER]



[CENTER]Rules for new members[/CENTER]

[CENTER]Forum Rules[/CENTER]



[CENTER]Help desk: support@slitherine.co.uk[/CENTER]

User avatar
Rafiki
Posts: 5811
Joined: Thu Aug 24, 2006 9:19 am
Location: Oslo, Norway

Tue Mar 04, 2008 11:08 pm

No worries. It was easily reversed :)

Keep trying; there is now way you can do permanent harm, and you'll get the hang of things in short time :cwboy:
[CENTER]Latest patches: AACW :: NCP :: WIA :: ROP :: RUS :: PON :: AJE

Visit AGEWiki - your increasingly comprehensive source for information about AGE games

[SIGPIC][/SIGPIC]

[/CENTER]

User avatar
lodilefty
Posts: 7616
Joined: Sat Aug 11, 2007 3:27 pm
Location: Finger Lakes, NY GMT -5 US Eastern

Gone! Wiki hates me!

Tue Mar 04, 2008 11:47 pm

Rafiki wrote:No worries. It was easily reversed :)

Keep trying; there is now way you can do permanent harm, and you'll get the hang of things in short time :cwboy:


Phoo! I edited, hit Save, and poof! gone! nothing! it ignores me! :8o:

Attached is a copy [I'm getting smarter] of my effort..... :siffle:
Always ask yourself: "Am I part of the Solution?" If you aren't, then you are part of the Problem!
[CENTER][/CENTER]

[CENTER]Visit AGEWiki - your increasingly comprehensive source for information about AGE games[/CENTER]



[CENTER]Rules for new members[/CENTER]

[CENTER]Forum Rules[/CENTER]



[CENTER]Help desk: support@slitherine.co.uk[/CENTER]

User avatar
lodilefty
Posts: 7616
Joined: Sat Aug 11, 2007 3:27 pm
Location: Finger Lakes, NY GMT -5 US Eastern

Tue Mar 04, 2008 11:56 pm

hmmm, it shows up in the recent changeslist, but not on the Event Modding page... :tournepas

Does it have to get approved first?????
Always ask yourself: "Am I part of the Solution?" If you aren't, then you are part of the Problem!
[CENTER][/CENTER]

[CENTER]Visit AGEWiki - your increasingly comprehensive source for information about AGE games[/CENTER]



[CENTER]Rules for new members[/CENTER]

[CENTER]Forum Rules[/CENTER]



[CENTER]Help desk: support@slitherine.co.uk[/CENTER]

User avatar
Rafiki
Posts: 5811
Joined: Thu Aug 24, 2006 9:19 am
Location: Oslo, Norway

Wed Mar 05, 2008 12:07 am

You've named the article "SelectSubUnits", while you from "Modding Events" are trying to include an article called "SelSubUnit"

Depending on what is correct, you either need to update "Modding Events" or move the article you have created to "SelSubUnit" :)
[CENTER]Latest patches: AACW :: NCP :: WIA :: ROP :: RUS :: PON :: AJE

Visit AGEWiki - your increasingly comprehensive source for information about AGE games

[SIGPIC][/SIGPIC]

[/CENTER]

User avatar
lodilefty
Posts: 7616
Joined: Sat Aug 11, 2007 3:27 pm
Location: Finger Lakes, NY GMT -5 US Eastern

Wed Mar 05, 2008 12:12 am

Rafiki wrote:You've named the article "SelectSubUnits", while you from "Modding Events" are trying to include an article called "SelSubUnit"

Depending on what is correct, you either need to update "Modding Events" or move the article you have created to "SelSubUnit" :)


Thaar she blows! :bonk: :bonk: :bonk: :bonk: :bonk: :bonk:

I can see it! I can see it! :nuts:

Is there a way to get the syntax box to 'wrap' so it doesn't run off to the right so far?
Always ask yourself: "Am I part of the Solution?" If you aren't, then you are part of the Problem!
[CENTER][/CENTER]

[CENTER]Visit AGEWiki - your increasingly comprehensive source for information about AGE games[/CENTER]



[CENTER]Rules for new members[/CENTER]

[CENTER]Forum Rules[/CENTER]



[CENTER]Help desk: support@slitherine.co.uk[/CENTER]

User avatar
Rafiki
Posts: 5811
Joined: Thu Aug 24, 2006 9:19 am
Location: Oslo, Norway

Wed Mar 05, 2008 12:38 am

Yup, it's the "syntax"-parameter that is wide, since it is rendered as "verbatim". I'll look at it tomorrow, if you don't beat me too it :)
[CENTER]Latest patches: AACW :: NCP :: WIA :: ROP :: RUS :: PON :: AJE

Visit AGEWiki - your increasingly comprehensive source for information about AGE games

[SIGPIC][/SIGPIC]

[/CENTER]

User avatar
lodilefty
Posts: 7616
Joined: Sat Aug 11, 2007 3:27 pm
Location: Finger Lakes, NY GMT -5 US Eastern

Wed Mar 05, 2008 12:44 pm

Now that I'm past the wiki:

It appears that the combination:

SelectSubUnits = Area $OMB_WestIndies;Models $mdl_CSA_Mer
EvalSubUnitSel = NULL


is returning "true, do actions", if either of the conditions in SelectSubUnits is true. [see script report in post #5 of this thread]

That's not what I want!

Is this WAD?
Always ask yourself: "Am I part of the Solution?" If you aren't, then you are part of the Problem!
[CENTER][/CENTER]

[CENTER]Visit AGEWiki - your increasingly comprehensive source for information about AGE games[/CENTER]



[CENTER]Rules for new members[/CENTER]

[CENTER]Forum Rules[/CENTER]



[CENTER]Help desk: support@slitherine.co.uk[/CENTER]

User avatar
Rafiki
Posts: 5811
Joined: Thu Aug 24, 2006 9:19 am
Location: Oslo, Norway

Thu Mar 06, 2008 8:17 pm

Rafiki wrote:Yup, it's the "syntax"-parameter that is wide, since it is rendered as "verbatim". I'll look at it tomorrow, if you don't beat me too it :)

OK, I did some reformatting and added some more text: http://www.ageod.net/aacwwiki/index.php?title=SelectSubUnits&diff=791&oldid=787 :)
[CENTER]Latest patches: AACW :: NCP :: WIA :: ROP :: RUS :: PON :: AJE

Visit AGEWiki - your increasingly comprehensive source for information about AGE games

[SIGPIC][/SIGPIC]

[/CENTER]

User avatar
lodilefty
Posts: 7616
Joined: Sat Aug 11, 2007 3:27 pm
Location: Finger Lakes, NY GMT -5 US Eastern

Thu Mar 06, 2008 8:32 pm

Rafiki wrote:OK, I did some reformatting and added some more text: http://www.ageod.net/aacwwiki/index.php?title=SelectSubUnits&diff=791&oldid=787 :)


OK!

How'd you do that?
I tried to create new line within syntax by hitting <Enter>, but the result was 'outside the box'. Some special secrete key-code, I'm sure! :siffle:
Always ask yourself: "Am I part of the Solution?" If you aren't, then you are part of the Problem!
[CENTER][/CENTER]

[CENTER]Visit AGEWiki - your increasingly comprehensive source for information about AGE games[/CENTER]



[CENTER]Rules for new members[/CENTER]

[CENTER]Forum Rules[/CENTER]



[CENTER]Help desk: support@slitherine.co.uk[/CENTER]

User avatar
Rafiki
Posts: 5811
Joined: Thu Aug 24, 2006 9:19 am
Location: Oslo, Norway

Thu Mar 06, 2008 9:34 pm

lodilefty wrote:Some special secrete key-code, I'm sure! :siffle:

Indeed :D

Lines that start with a space get formatted verbatim, with consecutive lines starting with space being grouped in the same box. The template definition starts of "syntax" with a space.
[CENTER]Latest patches: AACW :: NCP :: WIA :: ROP :: RUS :: PON :: AJE

Visit AGEWiki - your increasingly comprehensive source for information about AGE games

[SIGPIC][/SIGPIC]

[/CENTER]

User avatar
lodilefty
Posts: 7616
Joined: Sat Aug 11, 2007 3:27 pm
Location: Finger Lakes, NY GMT -5 US Eastern

Thu Mar 06, 2008 10:33 pm

Rafiki wrote:Indeed :D

Lines that start with a space get formatted verbatim, with consecutive lines starting with space being grouped in the same box. The template definition starts of "syntax" with a space.


Thank you! :king:

I hate getting 'got' by something I can't see! :fleb:
Always ask yourself: "Am I part of the Solution?" If you aren't, then you are part of the Problem!
[CENTER][/CENTER]

[CENTER]Visit AGEWiki - your increasingly comprehensive source for information about AGE games[/CENTER]



[CENTER]Rules for new members[/CENTER]

[CENTER]Forum Rules[/CENTER]



[CENTER]Help desk: support@slitherine.co.uk[/CENTER]

User avatar
Pocus
Posts: 25673
Joined: Wed Oct 19, 2005 7:37 am
Location: Lyon (France)

Fri Mar 07, 2008 3:14 pm

lodilefty wrote:Now that I'm past the wiki:

It appears that the combination:

SelectSubUnits = Area $OMB_WestIndies;Models $mdl_CSA_Mer
EvalSubUnitSel = NULL


is returning "true, do actions", if either of the conditions in SelectSubUnits is true. [see script report in post #5 of this thread]

That's not what I want!

Is this WAD?


there is only one condition evaluated in the event, which is "does at least one SU has been added in the selection list".

Your event will trigger (and then kill) if 1+ cotton is in the box, whatever the number. I believe you should remove only 1 cotton thus, not all, so you would use RemoveCuSubUnit, and then check a turn later if you can again trigger the event ...
Image


Hofstadter's Law: "It always takes longer than you expect, even when you take into account Hofstadter's law."

User avatar
lodilefty
Posts: 7616
Joined: Sat Aug 11, 2007 3:27 pm
Location: Finger Lakes, NY GMT -5 US Eastern

Fri Mar 07, 2008 5:20 pm

Pocus wrote:there is only one condition evaluated in the event, which is "does at least one SU has been added in the selection list".

Your event will trigger (and then kill) if 1+ cotton is in the box, whatever the number. I believe you should remove only 1 cotton thus, not all, so you would use RemoveCuSubUnit, and then check a turn later if you can again trigger the event ...


Just to be clear, the
SelectSubUnits = Area $OMB_WestIndies;Models $mdl_CSA_Mer

will be true simply becase the area is found? That's what I'm seeing in script report... [I think?]
Line 20565: SelectFactions, 1 Faction selected: Confederate States of America
Line 20566: Started processing event: cotton_event2
Line 20566: Event already referenced, current occurences 0 Max allowed: 999 <<Active>>
Line 20569: Min date evaluated: 1861/04/01 converted to turn 2671 current turn 2675 True
Line 20570: Max date evaluated: 1866/12/31 converted to turn 2809 current turn 2675 True
Line 20571: SelectSubUnits finished Regions Selected: 1 [color="Red"]SubUnits Selected: 0[/color]
Line 20572: [color="red"]Evaluate Sub Unit Selected : True[/color]
Line 20574: Entering triggered actions for event cotton_event2
Line 20575: ChangeMoneyPool Confederate States of America New money reserve is 14
Line 20576: ChangeWSUPool Confederate States of America New WSU pool is 38
Line 20577: SelectSubUnits finished Regions Selected: 1 SubUnits Selected: 0
Line 20578: [WARNING] AlterCuSubUnit: Selection is empty (Apply To List)
Line 20580: Finished processing event: cotton_event2


I get actions even when no $mdl_CSA_Mer exists in West Indies...



I'll change the remove statement as you pointed out.
Thank you, as I want to gain the $$ and WSU for each cotto that arrives...
Always ask yourself: "Am I part of the Solution?" If you aren't, then you are part of the Problem!
[CENTER][/CENTER]

[CENTER]Visit AGEWiki - your increasingly comprehensive source for information about AGE games[/CENTER]



[CENTER]Rules for new members[/CENTER]

[CENTER]Forum Rules[/CENTER]



[CENTER]Help desk: support@slitherine.co.uk[/CENTER]

Return to “Modding AGE engine games”

Who is online

Users browsing this forum: No registered users and 5 guests