View Full Version : [Q] XY Coordinates on Map


Ambreville
Aug 09, 2007, 04:31 PM
Is there a way to get X/Y coordinates to show on the map in worldbuilder by any chance?? Thanks!

JeBuS27
Aug 09, 2007, 04:34 PM
I would also like to know if there's a way to find the coordinates of a plot in the WB. I usually end up getting out of WB to find the coordinate then going back in, which is a pain in the neck after a while.

Zebra 9
Aug 09, 2007, 05:21 PM
I'll see if it's possible. It should be.

JeBuS27
Aug 09, 2007, 05:28 PM
Well, I've not done any UI modding, but I imagine it shouldn't be impossible to display a line of text somewhere that tells where the cursor is pointed.

NNCSavage
Aug 09, 2007, 06:07 PM
I believe if you have WorldBuilder enabled - holding shift and mousing over the plot in question will show the x,y coords.

JeBuS27
Aug 09, 2007, 06:12 PM
That only works when I'm not in WorldBuilder.

Ambreville
Aug 09, 2007, 06:58 PM
It doesn't seem to work in either modes for me... :(

NNCSavage
Aug 09, 2007, 07:50 PM
I guess I should say that by WorldBuilder I meant if I turn the cheats on (CheatCode = chipotle) the shift function works for me.
With cheats enabled and I hit Ctrl-W it doesnt show there.
Ctrl-Q to toggle back out and it's back to working.
I went and tested and if I change the .ini back to "CheatCode = 0" i get nothing when pressing shift.

JeBuS27
Aug 09, 2007, 08:45 PM
WB and console are not the same. ;)

Ambreville
Aug 10, 2007, 05:37 PM
I guess I should say that by WorldBuilder I meant if I turn the cheats on (CheatCode = chipotle) the shift function works for me.
With cheats enabled and I hit Ctrl-W it doesnt show there.
Ctrl-Q to toggle back out and it's back to working.
I went and tested and if I change the .ini back to "CheatCode = 0" i get nothing when pressing shift.

Maybe I'm speaking in a foreign language here, but I tried your approach and saw no coordinates anywhere...

wotan321
Nov 21, 2007, 09:10 PM
Did anyone figure out how this works? I can go back and forth in and out of worldbuilder, and the ONLY time I see plot info down in the lower left is when I am OUTSIDE worldbuilder, when the world is still covered in darkness.... pretty darned useless then! Any way to reveal the whole map? Or get the plot info while in worldbuilder where the world is revealed?

Any help is appreciated.

CharlieM
Dec 30, 2007, 10:36 AM
Did anyone figure out how this works? I can go back and forth in and out of worldbuilder, and the ONLY time I see plot info down in the lower left is when I am OUTSIDE worldbuilder, when the world is still covered in darkness.... pretty darned useless then! Any way to reveal the whole map? Or get the plot info while in worldbuilder where the world is revealed?

Any help is appreciated.

I would LOVE to know the answer to this. Any way to reveal X/Y coordinates in the World Builder?

Dale
Jan 04, 2008, 06:00 AM
Well, the SIMPLEST way is to edit ..\Assets\Python\Screens\CvWorldBuilderScreen.py

Find the function mouseOverPlot and add the following code:


def mouseOverPlot (self, argsList):

##### Dale - WB X-Y Plot Show START
message = "Plot: %s %s" %(CyInterface().getMouseOverPlot().getX(), CyInterface().getMouseOverPlot().getY())
CyInterface().addImmediateMessage(message,"")
##### Dale - WB X-Y Plot Show END


This put the plot x, y in the message area (you may have to move a window to view it correctly).

none
Sep 11, 2008, 08:27 AM
Well, the SIMPLEST way is to edit ..\Assets\Python\Screens\CvWorldBuilderScreen.py

Find the function mouseOverPlot and add the following code:


def mouseOverPlot (self, argsList):

##### Dale - WB X-Y Plot Show START
message = "Plot: %s %s" %(CyInterface().getMouseOverPlot().getX(), CyInterface().getMouseOverPlot().getY())
CyInterface().addImmediateMessage(message,"")
##### Dale - WB X-Y Plot Show END


This put the plot x, y in the message area (you may have to move a window to view it correctly).

I tried to do that but I didn't succeed (it didn't show but I'm not sure I added the code at the right place).

Here's what I've got:

def mouseOverPlot (self, argsList):
if (self.m_bReveal):
if (self.m_pCurrentPlot != 0):
self.showMultipleReveal()
self.m_pCurrentPlot = CyInterface().getMouseOverPlot()
if (CyInterface().isLeftMouseDown() and self.m_bLeftMouseDown):
self.setMultipleReveal(True)
elif(CyInterface().isRightMouseDown() and self.m_bRightMouseDown):
self.setMultipleReveal(False)
else: #if ((self.m_tabCtrlEdit == 0) or (not self.m_tabCtrlEdit.isEnabled())):
self.m_pCurrentPlot = CyInterface().getMouseOverPlot()
self.m_iCurrentX = self.m_pCurrentPlot.getX()
self.m_iCurrentY = self.m_pCurrentPlot.getY()
if (CyInterface().isLeftMouseDown() and self.m_bLeftMouseDown):
if (self.useLargeBrush()):
self.placeMultipleObjects()
else:
self.placeObject()
elif (CyInterface().isRightMouseDown() and self.m_bRightMouseDown):
if (not (self.m_bCityEdit or self.m_bUnitEdit)):
if (self.useLargeBrush()):
self.removeMultipleObjects()
else:
self.removeObject()
return


Is there any other way to get coordinates for placing starting points for different civs (using the notepad) when editing a map?

I'd sure would appreciate some help with that. Thanks.

EmperorFool
Sep 11, 2008, 08:11 PM
I think the problem is in the string formatting. Integers (X and Y coordinates) need "%d" instead of "%s". Try this:


def mouseOverPlot (self, argsList):

##### Dale - WB X-Y Plot Show START
message = "Plot: %d %d" %(CyInterface().getMouseOverPlot().getX(), CyInterface().getMouseOverPlot().getY())
CyInterface().addImmediateMessage(message,"")
##### Dale - WB X-Y Plot Show END

Dresden
Sep 11, 2008, 11:02 PM
This is a neat idea; I'm glad this topic was bumped. ;) I went the following way with mine, using a similar approach as BUG's NJAGC implementation.

def mouseOverPlot (self, argsList):
szText = "Plot: (%d, %d)" %(CyInterface().getMouseOverPlot().getX(), CyInterface().getMouseOverPlot().getY())
screen = CyGInterfaceScreen( "WorldBuilderScreen", CvScreenEnums.WORLDBUILDER_SCREEN )
screen.setLabel( "WBCoords", "Background", szText, CvUtil.FONT_CENTER_JUSTIFY, screen.getXResolution()/2, 6, -0.3, FontTypes.GAME_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1 )
# rest of function unchanged

EmperorFool
Sep 11, 2008, 11:07 PM
Nice touch switching it to a static text label vs. flooding the message queue. Aren't the plot's coordinates sent in argsList? If you want to see, use %r to dump argsList in list form or %s with str(argsList).

Dresden
Sep 11, 2008, 11:22 PM
The rest of that function does stuff like this (inside an else block so the vars are not always set)
self.m_pCurrentPlot = CyInterface().getMouseOverPlot()
self.m_iCurrentX = self.m_pCurrentPlot.getX()
self.m_iCurrentY = self.m_pCurrentPlot.getY()

so I never even thought to look if the coords were in the args list. Probably a good idea to check though.

EDIT: argsList contains a single argument. I have no idea what the argument is, but it isn't coordinates or even a plot index. On a quick test, it was a constant "23" regardless of what plot I was mousing over.

EmperorFool
Sep 11, 2008, 11:34 PM
I never even thought to look if the coords were in the args list. Probably a good idea to check though.

Oh I wouldn't be surprised if they weren't in there. :crazyeye: I've been accused of premature optimization more than a few times, but that doesn't seem to stop me. ;) In this case it's more a matter of curiosity.

Dresden
Sep 11, 2008, 11:44 PM
In case you didn't catch my edit: argsList contains a single argument. I have no idea what the argument is, but it isn't coordinates or even a plot index. On a quick test, it was a constant "23" regardless of what plot I was mousing over.

DanF5771
Sep 12, 2008, 04:38 AM
The (x,y) coordinates of a plot are already part of the <Shift>-mouseover when having chipotle activated.

none
Sep 12, 2008, 08:30 AM
Thanks for the help. I activated chipotle. It gives me the coordinates when in game (with shift) but it doesn't work in the WB. I'm too lazy to edit the py file again so I decided to add Satellites so I can pick up the locations I want for my starting civs 4000 BC... Anyway it works.

DanF5771
Sep 12, 2008, 10:45 AM
You can just press Ctrl+Z to enter the real chipotle spy-mode = reveal complete map, enter AI cities, see their advisor screens...

none
Sep 12, 2008, 12:01 PM
You can just press Ctrl+Z to enter the real chipotle spy-mode = reveal complete map, enter AI cities, see their advisor screens...

Thanks for the tip. Much appreciated.