request for set all to true button for item

Discuss and post your mods and scenarios here for others to download.

Moderator: Vic

Post Reply
bwheatley
Posts: 3654
Joined: Mon Dec 13, 2004 4:08 pm
Contact:

request for set all to true button for item

Post by bwheatley »

in items add a set all to true button..set all to false is annoying because an accident click and then 600+ clicks to fix everything. :)
-Alpha Tester Carrier Force
-Beta Tester ATG
- Mod Maintainer (past) for ATG's WAW mod
- Mod Maintainer (past) for ATG's GPW mod
-Beta Tester WITE
-Alpha Tester WITW
-Alpha Tester WITE2
-Alpha Tester Wif
-Beta Tester Command
bwheatley
Posts: 3654
Joined: Mon Dec 13, 2004 4:08 pm
Contact:

RE: request for set all to true button for item

Post by bwheatley »

I made an event script to do it but a button would be handy. :)
-Alpha Tester Carrier Force
-Beta Tester ATG
- Mod Maintainer (past) for ATG's WAW mod
- Mod Maintainer (past) for ATG's GPW mod
-Beta Tester WITE
-Alpha Tester WITW
-Alpha Tester WITE2
-Alpha Tester Wif
-Beta Tester Command
User avatar
Jeffrey H.
Posts: 3154
Joined: Fri Apr 13, 2007 6:39 pm
Location: San Diego, Ca.

RE: request for set all to true button for item

Post by Jeffrey H. »

ORIGINAL: bwheatley

I made an event script to do it but a button would be handy. :)

Are you a coder IRL ? Just wondering.
History began July 4th, 1776. Anything before that was a mistake.

Ron Swanson
bwheatley
Posts: 3654
Joined: Mon Dec 13, 2004 4:08 pm
Contact:

RE: request for set all to true button for item

Post by bwheatley »

ORIGINAL: Jeffrey H.

ORIGINAL: bwheatley

I made an event script to do it but a button would be handy. :)

Are you a coder IRL ? Just wondering.

Yea a programmer/developer. Even though i can write the script doesn't mean a button would be easier. :)

Oh here is the event you can use to set it all to true if you want.
Just change 400 to whatever your maxitem # is or you will get errors.

Code: Select all

0)    ' We should loop and find a way to allow all items to be built by all peoplegroups
 1)    LOOPER: TempVar0 FROM 0 TO 400
 2)      EXECUTE: ExecSetItemByPeopleGroup(TempVar0, -1, 1)
 3)    END LOOPER
 
-Alpha Tester Carrier Force
-Beta Tester ATG
- Mod Maintainer (past) for ATG's WAW mod
- Mod Maintainer (past) for ATG's GPW mod
-Beta Tester WITE
-Alpha Tester WITW
-Alpha Tester WITE2
-Alpha Tester Wif
-Beta Tester Command
User avatar
Jeffrey H.
Posts: 3154
Joined: Fri Apr 13, 2007 6:39 pm
Location: San Diego, Ca.

RE: request for set all to true button for item

Post by Jeffrey H. »

Question for you. In the example above does tempvar0 hold a value of 400 after execution of the exent or does the editor clear the value after the end looper ?

History began July 4th, 1776. Anything before that was a mistake.

Ron Swanson
bwheatley
Posts: 3654
Joined: Mon Dec 13, 2004 4:08 pm
Contact:

RE: request for set all to true button for item

Post by bwheatley »

ORIGINAL: Jeffrey H.

Question for you. In the example above does tempvar0 hold a value of 400 after execution of the exent or does the editor clear the value after the end looper ?


All tempvars are scoped to their own event. So event 1 & event 2 can both use tempvar0 and it won't cause a problem.

Now if you wanted to do modules like i do you can use
CallFunction(FUNCTIONNAME) tempvar900-999 as well as tempstring900-999 are passed into the function you call and are returned back to the calling function. Tempvar 0,1,4,5 are sent into the function when using callfunction but are not returned.

I use callfunction for a lot of my stuff to allow things to be a little more modular. :)

Hopefully that answers your question feel free to ask more if needed.
-Alpha Tester Carrier Force
-Beta Tester ATG
- Mod Maintainer (past) for ATG's WAW mod
- Mod Maintainer (past) for ATG's GPW mod
-Beta Tester WITE
-Alpha Tester WITW
-Alpha Tester WITE2
-Alpha Tester Wif
-Beta Tester Command
bwheatley
Posts: 3654
Joined: Mon Dec 13, 2004 4:08 pm
Contact:

RE: request for set all to true button for item

Post by bwheatley »

Oh and you can just hit the equal = sign yellow button in theeditor to run that script in the editor w/o having to load the game...very handy.

I was able to perfect my weather system w/o ever having to really leave the editor with events being manually run inside the editor.
-Alpha Tester Carrier Force
-Beta Tester ATG
- Mod Maintainer (past) for ATG's WAW mod
- Mod Maintainer (past) for ATG's GPW mod
-Beta Tester WITE
-Alpha Tester WITW
-Alpha Tester WITE2
-Alpha Tester Wif
-Beta Tester Command
User avatar
Jeffrey H.
Posts: 3154
Joined: Fri Apr 13, 2007 6:39 pm
Location: San Diego, Ca.

RE: request for set all to true button for item

Post by Jeffrey H. »

ORIGINAL: bwheatley

ORIGINAL: Jeffrey H.

Question for you. In the example above does tempvar0 hold a value of 400 after execution of the exent or does the editor clear the value after the end looper ?


All tempvars are scoped to their own event. So event 1 & event 2 can both use tempvar0 and it won't cause a problem.

Now if you wanted to do modules like i do you can use
CallFunction(FUNCTIONNAME) tempvar900-999 as well as tempstring900-999 are passed into the function you call and are returned back to the calling function. Tempvar 0,1,4,5 are sent into the function when using callfunction but are not returned.

I use callfunction for a lot of my stuff to allow things to be a little more modular. :)

Hopefully that answers your question feel free to ask more if needed.

Ya that answers the question, (scope of the tempvars) but I admit that the nuance of the callfunction hasn't sunk in yet. So in your example, if tempvar 950 is set to say 10, somewhere outside the calling function, (not sure how that's possible since the scope prohibits carryover outside the function) it goes in and comes out the same value.

I guess I get it but my old brain can't get the utility of it.


History began July 4th, 1776. Anything before that was a mistake.

Ron Swanson
anonymous1
Posts: 33
Joined: Thu Dec 08, 2011 2:21 pm

RE: request for set all to true button for item

Post by anonymous1 »

In event A, set tempvar 950 to 23, then call event B.
In event B, tempvar 950 is 23, change it to 10, and end event B, return to event A.
In event A, tempvar 950 is 10.

But in event C, the unused tempvar 950 is 0 all the time.

Now, you can get information about the execution of a frequently called event.
bwheatley
Posts: 3654
Joined: Mon Dec 13, 2004 4:08 pm
Contact:

RE: request for set all to true button for item

Post by bwheatley »

ORIGINAL: Jeffrey H.


Ya that answers the question, (scope of the tempvars) but I admit that the nuance of the callfunction hasn't sunk in yet. So in your example, if tempvar 950 is set to say 10, somewhere outside the calling function, (not sure how that's possible since the scope prohibits carryover outside the function) it goes in and comes out the same value.

I guess I get it but my old brain can't get the utility of it.



If you look at my "Howto: Complex Zone based weather system" thread it should make sense Thread


But part of that thread here is the main event of the weather system and the only one set to "round event" the rest are "no check" and are called as needed by other functions
Name: Weather Zone Checker
0) ' What month is it
1) SETVAR: TempVar900 = CheckMonth
2) ' Tempvar952 0 = No Weather Change 1 = Weather Change
3) SETVAR: TempVar952 = 0
4) EXECUTE: CallFunction('Open Weather List')
5) ' Check to see if todays weather gets changed
6) EXECUTE: CallFunction('Check for Weather Change')
7) ' Show the Weather Forecast Now
8) EXECUTE: CallFunction('Show Weather Forecast')
9) ' Draw hexes
10) EXECUTE: CallFunction('Draw Weather on Map')
11) ' There are only 2 rows 0 - current turn, 1 next turn..we need to move it up
12) EXECUTE: CallFunction('move weather up to row 0')
13) ' Do the readiness loss based on weather
14) EXECUTE: CallFunction('Apply Weather Readiness Loss')
15) EMPTY


You'll see the whole time through i use tempvar900 as the month. But you'll also see i use tempvar952 to trigger a weather change alert. That var is set to 0 most of the time but 35% of the time due to randomness it's set to 1 to force a weather change.

Then in "Open Weather List"
Name: Open Weather List
0) ' This function opens the appriopriate weather list
1) ' it finds a random row then that row gets dumped into stringlist 0 which is weatherforcecast
2) SETVAR: TempVar902 = 1
3) ' Loop and generate the weather forecast
4) LOOPER: TempVar903 FROM 0 TO 7
5) EXECUTE: CallFunction('Get Random Weather')
6) END LOOPER

We set Tempvar902 = 1 because typically when we're running get random weather its to replace the next turns weather.

Here is "get random weather"
Name: Get Random Weather
0) ' This function just generates the random weather for a given cell
1) ' it finds a random row then that row gets dumped into stringlist 0 which is weatherforcecast
2) ' Add the row onto the end of the WeatherList
3) ' Loop and generate the weather forecast
4) SETVAR: TempVar901 = CheckRandomRowStringList(TempVar900, TempVar903)
5) SETVAR: TempVar901 = CheckStringList(TempVar900, TempVar901, TempVar903)
6) ' Add the results to the last row in the weatherforecast string
7) EXECUTE: ExecSetStringList(0, TempVar902, TempVar903, TempVar901)


Then "Check for weather change" is called to see if perhaps we might need to change the weather.
Name: Check for Weather Change
0) ' This function will randomly modify weather for the current turn then alert back into tempstring952
1) CHECK: CheckRandomPercent =< 35
2) ' We will override tempvar902 to set the row to update to 0
3) SETVAR: TempVar902 = 0
4) SETVAR: TempVar952 = 1
5) LOOPER: TempVar903 FROM 0 TO 7
6) EXECUTE: CallFunction('Get Random Weather')
7) END LOOPER
8) END CHECK

Notice that we overrive tempvar902 to be 0. That is to show we're going to just redo the weather for the upcoming turn (0) instead of the next turn. Notice we also set tempvar952 (which we set to 0 at the start of the main function) to be 1. That tempvar952 is looked at in "show weather forecast" with this being the only interesting part
10) CHECK: TempVar952 > 0
11) SETVAR: TempString1 + TempString999
12) SETVAR: TempString1 + '**********ALERT WEATHER FORECAST CHANGE**********'
13) SETVAR: TempString1 + TempString999
14) END CHECK


Check out page 5 of this pdf on the design notes it has my tempvars and what i used them for in this system. Then on page 7 you can see how the functions interact with each other and which functions call each other.


The real jist is that you can do things with stringlist & callfunction that would be super complicated to do the way i had to for ATWW2. Basically this same system I'm doing here i did for Waw back in ATWW2. It was iirc somewhere between 800-1100 lines. It was a lot of hard coded checks it was misery. It took me almost 4 weeks just because doing that in the editor is so damn painful. But with this system it probably took me about a week give or take.
-Alpha Tester Carrier Force
-Beta Tester ATG
- Mod Maintainer (past) for ATG's WAW mod
- Mod Maintainer (past) for ATG's GPW mod
-Beta Tester WITE
-Alpha Tester WITW
-Alpha Tester WITE2
-Alpha Tester Wif
-Beta Tester Command
User avatar
Jeffrey H.
Posts: 3154
Joined: Fri Apr 13, 2007 6:39 pm
Location: San Diego, Ca.

RE: request for set all to true button for item

Post by Jeffrey H. »

ORIGINAL: anonymous

In event A, set tempvar 950 to 23, then call event B.
In event B, tempvar 950 is 23, change it to 10, and end event B, return to event A.
In event A, tempvar 950 is 10.

But in event C, the unused tempvar 950 is 0 all the time.

Now, you can get information about the execution of a frequently called event.

OIC, now you can break up the events a bit more, instead of doing everything in one large event.

History began July 4th, 1776. Anything before that was a mistake.

Ron Swanson
bwheatley
Posts: 3654
Joined: Mon Dec 13, 2004 4:08 pm
Contact:

RE: request for set all to true button for item

Post by bwheatley »

ORIGINAL: Jeffrey H.

ORIGINAL: anonymous

In event A, set tempvar 950 to 23, then call event B.
In event B, tempvar 950 is 23, change it to 10, and end event B, return to event A.
In event A, tempvar 950 is 10.

But in event C, the unused tempvar 950 is 0 all the time.

Now, you can get information about the execution of a frequently called event.

OIC, now you can break up the events a bit more, instead of doing everything in one large event.



Yea that helps make it more module and supportable. Also it lets you do loops and such to keep it manageable.
-Alpha Tester Carrier Force
-Beta Tester ATG
- Mod Maintainer (past) for ATG's WAW mod
- Mod Maintainer (past) for ATG's GPW mod
-Beta Tester WITE
-Alpha Tester WITW
-Alpha Tester WITE2
-Alpha Tester Wif
-Beta Tester Command
Post Reply

Return to “Mods and Scenarios”