Matrix Games Forums

Forums  Register  Login  Photo Gallery  Member List  Search  Calendars  FAQ 

My Profile  Inbox  Address Book  My Subscription  My Forums  Log Out

How to Count?

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [New Releases from Matrix Games] >> Advanced Tactics Series >> Mods and Scenarios >> How to Count? Page: [1]
Login
Message << Older Topic   Newer Topic >>
How to Count? - 4/25/2014 2:41:27 AM   
GunnyJarhead


Posts: 27
Joined: 7/16/2012
Status: offline
I am trying to figure out how to count the number of a particular landscape type (or Items or ocations etc...) that a regime owns at the start of there turn.

Added a Regime Slot "Wheat"
Set Each Regime's Slot to Zero

I want to count how many fields a regime owns at the start of its turn and add 1 to the regime slot wheat for each field hex owned

Any Help will be appreciated!





_____________________________

Some people are still alive only because it is illegal to kill them.
Post #: 1
RE: How to Count? - 4/25/2014 3:08:10 AM   
ernieschwitz

 

Posts: 3893
Joined: 9/15/2009
From: Denmark
Status: offline
You want to know how many fields (that is how many of the landscape type fields) is owned?

You need to make a looper, or rather two loopers.

The first looper will go across the board from 0 to mapwidth

The second looper will go down the board from 0 to mapheight

after these you need to set a check for hextype = fields

then a counter (tempvar) that you assign the value +1

end check

end looper

end looper

That is more or less the structure of it.

(in reply to GunnyJarhead)
Post #: 2
RE: How to Count? - 4/25/2014 3:50:11 AM   
GunnyJarhead


Posts: 27
Joined: 7/16/2012
Status: offline
Ok this is what I have

I can Count just cant add to the regimevariable


0) LOOPER: TempVar0 FROM 0 TO CheckMapWidth
1) LOOPER: TempVar1 FROM 0 TO CheckMapHeight
2) CHECK: CheckLandscapeType(TempVar0, TempVar1) == 3
3) SETVAR: ????????????
5) END CHECK
7) END LOOPER
8) END LOOPER

_____________________________

Some people are still alive only because it is illegal to kill them.

(in reply to ernieschwitz)
Post #: 3
RE: How to Count? - 4/25/2014 4:03:35 AM   
ernieschwitz

 

Posts: 3893
Joined: 9/15/2009
From: Denmark
Status: offline
I see where you are having trouble...

Do you want it to be the regimevar for the current regime?

(in reply to GunnyJarhead)
Post #: 4
RE: How to Count? - 4/25/2014 4:13:46 AM   
ernieschwitz

 

Posts: 3893
Joined: 9/15/2009
From: Denmark
Status: offline
If so I imagine you want to add a few lines to your function...

0) SetVar: TempVar2 == CheckTurn
1) LOOPER: TempVar0 FROM 0 TO CheckMapWidth
2) LOOPER: TempVar1 FROM 0 TO CheckMapHeight
3) CHECK: CheckLandscapeType(TempVar0, TempVar1) == 3
4) CHECK: CheckHexOwner(TampVar0, Tempvar1) == TempVar2
5) SETVAR: TempVar3 + 1
6) END CHECK
7) END CHECK
8) END LOOPER
9) END LOOPER
10) SETVAR: TempVar3 + ChechRegimeVar(TempVar2, "WheatVarNr")
11). EXECUTE: ExecSetRegimeVar (TempVar2, "WheatVarNr", TempVar3)

Where "WheatVarNr" is the RegimeVarNr of wheat.

(in reply to ernieschwitz)
Post #: 5
RE: How to Count? - 4/25/2014 4:35:35 AM   
GunnyJarhead


Posts: 27
Joined: 7/16/2012
Status: offline
I kept reading what you wrote and was able to come up with the following:

0) LOOPER: TempVar0 FROM 0 TO CheckMapWidth
1) LOOPER: TempVar1 FROM 0 TO CheckMapHeight
2) ' Check Map for LandTyp 10 Forest Loaf
3) CHECK: CheckLandscapeType(TempVar0, TempVar1) == 10
4) ' I think this checks the LandTyp 10 to see if it belongs to Regime 0
5) CHECK: CheckHexOwner(TempVar0, TempVar1) == 0
6) ' Now I want it to add the number of LandTyp 10 that belongs to Regime 0 to the regime variable "Lumber"
7) SETVAR: Peoples Republic_Lumber(#11) + 1
8) END CHECK
9) END CHECK
10) END LOOPER
11) END LOOPER


It did indeed do what I wanted it to do. It counts the Forest or the Lumber or whatever and it displays the count at the start of the regimes turn.

This works for one regime. Is there a way to:

Set it up so that I dont have to type the code for each individual regime?

Also on top of the main screen where it displays the count at the start of the turn for example 100. When a unit takes control of one more field hex the new count is 101. But the display stays at 100.



Thank you for the help!

_____________________________

Some people are still alive only because it is illegal to kill them.

(in reply to ernieschwitz)
Post #: 6
RE: How to Count? - 4/25/2014 4:42:44 AM   
GunnyJarhead


Posts: 27
Joined: 7/16/2012
Status: offline
I think we crossed posts.

I think I was pretty close to what you had. I also think that you answered my question about having to type the code for each individual regime with the checkturn function.

Im not sure what your lines 10 and 11 are doing but I will copy and add them to test it out!

Thanks..Im getting closer I do believe

_____________________________

Some people are still alive only because it is illegal to kill them.

(in reply to GunnyJarhead)
Post #: 7
RE: How to Count? - 4/25/2014 4:53:29 AM   
GunnyJarhead


Posts: 27
Joined: 7/16/2012
Status: offline
Awesome!! Thanks Ernie.

now I just need to figure out how to get it to display at the top correctly. But that is Minor!



_____________________________

Some people are still alive only because it is illegal to kill them.

(in reply to ernieschwitz)
Post #: 8
RE: How to Count? - 4/25/2014 5:06:15 AM   
ernieschwitz

 

Posts: 3893
Joined: 9/15/2009
From: Denmark
Status: offline
No problem :)

(in reply to GunnyJarhead)
Post #: 9
Page:   [1]
All Forums >> [New Releases from Matrix Games] >> Advanced Tactics Series >> Mods and Scenarios >> How to Count? Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI

2.797