request for set all to true button for item (Full Version)

All Forums >> [New Releases from Matrix Games] >> Advanced Tactics Series >> Mods and Scenarios



Message


bwheatley -> request for set all to true button for item (9/22/2012 2:07:18 AM)

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. :)




bwheatley -> RE: request for set all to true button for item (9/22/2012 1:36:11 PM)

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




Jeffrey H. -> RE: request for set all to true button for item (9/22/2012 5:37:44 PM)


quote:

ORIGINAL: bwheatley

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


Are you a coder IRL ? Just wondering.




bwheatley -> RE: request for set all to true button for item (9/23/2012 6:02:11 PM)


quote:

ORIGINAL: Jeffrey H.


quote:

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.

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




Jeffrey H. -> RE: request for set all to true button for item (9/23/2012 6:37:07 PM)

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 ?





bwheatley -> RE: request for set all to true button for item (9/23/2012 10:10:43 PM)


quote:

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.




bwheatley -> RE: request for set all to true button for item (9/23/2012 10:11:42 PM)

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.




Jeffrey H. -> RE: request for set all to true button for item (9/24/2012 3:23:03 AM)


quote:

ORIGINAL: bwheatley


quote:

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.






anonymous1 -> RE: request for set all to true button for item (9/24/2012 1:18:55 PM)

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 -> RE: request for set all to true button for item (9/24/2012 2:05:59 PM)


quote:

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

quote:

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"

quote:

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"

quote:

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.

quote:

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

quote:

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.




Jeffrey H. -> RE: request for set all to true button for item (9/25/2012 7:54:09 PM)


quote:

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.





bwheatley -> RE: request for set all to true button for item (9/26/2012 5:29:04 AM)


quote:

ORIGINAL: Jeffrey H.


quote:

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.




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
1