I think I know how the family dog feels.
Sort of:
"Blah blah blah PICKLE blah blah blah FUNCTION blah blah blah OUT blah blah blah blah DISH blah blah blah TREAT blah blah blah GOOD BOY!"
Sounds like my German class...
I think I know how the family dog feels.
Sort of:
"Blah blah blah PICKLE blah blah blah FUNCTION blah blah blah OUT blah blah blah blah DISH blah blah blah TREAT blah blah blah GOOD BOY!"
If you could get more specific about what you are trying to do we may be able to suggest other ways to do it without using that nasty pickle.
def spellLoadZone2():
caster=CyInterface().getHeadSelectedUnit()
iOcean = gc.getInfoTypeForString('TERRAIN_OCEAN')
iCoast = gc.getInfoTypeForString('TERRAIN_COAST')
iGrass = gc.getInfoTypeForString('TERRAIN_GRASS')
iPlains = gc.getInfoTypeForString('TERRAIN_PLAINS')
iDesert = gc.getInfoTypeForString('TERRAIN_DESERT')
iTundra = gc.getInfoTypeForString('TERRAIN_TUNDRA')
iSnow = gc.getInfoTypeForString('TERRAIN_SNOW')
iBorder = gc.getInfoTypeForString('TERRAIN_BORDER')
terrainList = [
20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,
20,70,70,70,70,70,20,20,20,20,20,20,20,20,20,20,20,20,20,20,
20,70,20,20,20,70,20,20,20,20,20,20,20,20,20,20,20,20,20,20,
20,70,20,20,20,70,20,20,20,20,20,20,20,20,20,20,20,20,20,20,
20,70,20,20,20,70,20,20,20,20,20,20,20,20,20,20,20,20,20,20,
20,70,70,70,70,70,20,20,20,20,20,20,20,20,20,20,20,20,20,20,
20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,
20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,
20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,
20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,
20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,
20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,
20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,
20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,
20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,
20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,
20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,
20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,
20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,
20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,
]
iWallTall = gc.getInfoTypeForString('FEATURE_BULKHEAD')
iWallShort = gc.getInfoTypeForString('FEATURE_BULKHEAD2')
iDoorClosed = gc.getInfoTypeForString('FEATURE_HATCH_CLOSED')
iDoorOpen = gc.getInfoTypeForString('FEATURE_HATCH_OPEN')
featureList = [
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,10,20,10,20,10,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,20,00,00,00,20,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,10,00,00,00,30,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,20,00,00,00,20,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,10,20,10,20,10,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
]
elevationList = [
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
]
rr20 = [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00]
rr19 = [00,50,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00]
rr18 = [00,50,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00]
rr17 = [00,50,02,02,02,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00]
rr16 = [00,00,00,00,50,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00]
rr15 = [00,00,00,00,50,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00]
rr14 = [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00]
rr13 = [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00]
rr12 = [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00]
rr11 = [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00]
rr10 = [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00]
rr09 = [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00]
rr08 = [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00]
rr07 = [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00]
rr06 = [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00]
rr05 = [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00]
rr04 = [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00]
rr03 = [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00]
rr02 = [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00]
rr01 = [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00]
riverList = rr01 + rr02 + rr03 + rr04 + rr05 + rr06 + rr07 + rr08 + rr09 + rr10 + rr11 + rr12 + rr13 + rr14 + rr15 + rr16 + rr17 + rr18 + rr19 + rr20
for i in range (CyMap().numPlots()):
pPlot = CyMap().plotByIndex(i)
pTerrain = terrainList[i]
if pTerrain == 00:
pPlot.setTerrainType(iOcean,True,True)
if pTerrain == 10:
pPlot.setTerrainType(iCoast,True,True)
if pTerrain == 20:
pPlot.setTerrainType(iGrass,True,True)
if pTerrain == 30:
pPlot.setTerrainType(iPlains,True,True)
if pTerrain == 40:
pPlot.setTerrainType(iDesert,True,True)
if pTerrain == 50:
pPlot.setTerrainType(iTundra,True,True)
if pTerrain == 60:
pPlot.setTerrainType(iSnow,True,True)
if pTerrain == 70:
pPlot.setTerrainType(iBorder,True,True)
pFeature = featureList[i]
if pFeature == 00:
pPlot.setFeatureType(-1, -1)
if pFeature == 10:
pPlot.setFeatureType(iWallTall, -1)
if pFeature == 20:
pPlot.setFeatureType(iWallShort, -1)
if pFeature == 30:
pPlot.setFeatureType(iDoorClosed, -1)
if pFeature == 40:
pPlot.setFeatureType(iDoorOpen, -1)
pElevation = elevationList[i]
if pElevation == 00:
pPlot.setPlotType(PlotTypes.PLOT_LAND, True, True)
if pElevation == 10:
pPlot.setPlotType(PlotTypes.PLOT_HILLS, True, True)
if pElevation == 20:
pPlot.setPlotType(PlotTypes.PLOT_PEAK, True, True)
if pElevation == 30:
pPlot.setPlotType(PlotTypes.PLOT_OCEAN, True, True)
pRiver = riverList[i]
if pRiver == 00:
pPlot.setNOfRiver(False, CardinalDirectionTypes.CARDINALDIRECTION_EAST)
pPlot.setNOfRiver(False, CardinalDirectionTypes.CARDINALDIRECTION_WEST)
pPlot.setWOfRiver(False, CardinalDirectionTypes.CARDINALDIRECTION_NORTH)
pPlot.setWOfRiver(False, CardinalDirectionTypes.CARDINALDIRECTION_SOUTH)
if pRiver >= 50:
pPlot.setWOfRiver(True, CardinalDirectionTypes.CARDINALDIRECTION_SOUTH)
pRiver = (pRiver - 50)
if pRiver >= 30:
pPlot.setWOfRiver(True, CardinalDirectionTypes.CARDINALDIRECTION_NORTH)
pRiver = (pRiver - 30)
if pRiver == 05:
pPlot.setNOfRiver(True, CardinalDirectionTypes.CARDINALDIRECTION_WEST)
if pRiver == 02:
pPlot.setNOfRiver(True, CardinalDirectionTypes.CARDINALDIRECTION_EAST)
# gc.getMap().updateMinimapColor()
# CyGInterfaceScreen( "MainInterface", CvScreenEnums.MAIN_INTERFACE ).updateMinimapVisibility()
What is it you have against pickle? It's come up before in this thread, but no one could say what you don't like about it.
@Kael:
Dynamically switchable maps. etc...
We have a form of dynamically switchable maps, the scenario screen.
Basically its just an ingame way to load up a worldbuilder save (your static dungeons). Plus we can switch game options, players, pretty much anything.
The only thing we dont do is save the state of the old game to return to it (because thats not required in "Ice"). But I can definitly see how that would be helpful for you.
If you wanted to return to the state of the game before the map change you could just use the worldbuilder save process to write the game state off to a text file. Then reload when you cant to go back (the ingame reload is the real magic, but I already have that all tested and working).
If you want to bypass pickle entirely I can give you the ingame scenario load code.
Spoiler :Code:rr20 = [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00] rr19 = [00,50,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00] rr18 = [00,50,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00] rr17 = [00,50,02,02,02,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00] rr16 = [00,00,00,00,50,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00] rr15 = [00,00,00,00,50,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00] rr14 = [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00] rr13 = [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00] rr12 = [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00] rr11 = [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00] rr10 = [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00] rr09 = [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00] rr08 = [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00] rr07 = [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00] rr06 = [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00] rr05 = [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00] rr04 = [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00] rr03 = [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00] rr02 = [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00] rr01 = [00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00] riverList = rr01 + rr02 + rr03 + rr04 + rr05 + rr06 + rr07 + rr08 + rr09 + rr10 + rr11 + rr12 + rr13 + rr14 + rr15 + rr16 + rr17 + rr18 + rr19 + rr20
One minor point I realized while reading your code: A leading zero is how python (currently) marks octal literals.
In your code it makes no difference, but it could surprise you later when you try to write 09, or if you decide to make your mapping three digits.
Yes, please! The more examples I have to look at of stuff that actually works, the better off I'll be.
But you already have a version of in-game WB read and write access working? You magnificent bast*rd, you! That would be exactly what we all need! (And much better than my old-school DOS shell matrix nonsense.)
If you would be kind enough to post the code here or send it to me, I would truly appreciate it.![]()
That IS good to know, and thank you. I put in the leading zeros to make the in-code matrices perfect squares. It makes it easier to design levels when the entries are justified in this way, and look like a closer approximation of the game screen.
As long as I treat these as straight integers I should be okay, though, right?
edit: I suppose I could switch to an alpha string, like single letters, but I had problems getting that to work earlier.
@Kael:
It seems we are thinking along similar lines:
1. World Switching -- The graphics engine IS a dog. But apparantly a dog that doesn't mind learning new tricks.The switch on a 20x20 map is instant using the matrix method. I will try it with a much bigger map and see what type of lag results.
Moreover, I do not envision a parallel world that players can shift in and out of whenever they want. My method (and also mitigation) is exactly as you suggest. Players need to get to a certain feature like a staircase, mountain pass, or town tile before they can move to a new map. My scenarios also focus on a relatively few units being in play at any given time.
2. AI -- Only one map active at a time, so the AI only has to think about the current map. No way could I train the AI to deal with multiple layers!
3. Event Tracking -- well this would be nice to do with scriptdata or something. Otherwise I have to use those stupid "parking lot" tiles for unique units and cities, and use goofy workarounds like piling special promotions onto the player's main unit to keep track of important events.
4. Multiplayer -- Alas, there are so many things that we cannot do with multiplayer. Not even on the radar screen for DA or any other of my mods.
@xienwolf:
I had some bad initial experiences with C++ from which I am still traumatized.Maybe it is time for me to get over it, but I shudder at the thought of having to learn another language from scratch.
Everyone says that C++ stuff is faster than the Python. How much faster? And in this case, hardcoding maps the maps in the C++ would still result in static maps, wouldn't it? I guess I am leery of bollixing up my DLL files, but that's what backups are for, right?