Thread Tools
Old October 19, 2002, 22:13   #1
ahenobarb
Prince
 
ahenobarb's Avatar
 
Local Time: 09:36
Local Date: November 1, 2010
Join Date: Nov 2001
Posts: 437
Getting the x and Y of a location
How is it possible to get the x and y coordinates of a location and assign them to a variable? I have tried to use location.x and location.y (even location.location), but everytime I use these, CTP2 says "Location is not a structure".

I did a search trough the CTP2 directory and mods and there is not a single line of code that uses location.x or .y. The disasters mod gets the X and Y by using Random(tmpX) and then assigning tmpX to another variable -- pretty clever.

But if you want a city's x and y location you can't use city[0].location.x and city[0].location.y

How do you get these values?

Last edited by ahenobarb; October 20, 2002 at 00:23.
ahenobarb is offline  
Old October 20, 2002, 08:27   #2
Peter Triggs
CTP2 Source Code ProjectCivilization IV Creators
King
 
Local Time: 09:36
Local Date: November 1, 2010
Join Date: Jan 2000
Location: Gone Fishin, Canada
Posts: 1,059
IIRC, you have to have the location variable first: either a builtin "location[0]" or a user defined "tmpLoc" and then use "location[0].x" or "tmploc.x" So try "location[0]=city[0].location;"

BTW, at the time of this post, 6 people have previously viewed this thread. Are there really that many lurkers out there interested in such obscure subjects? If so, more posters are always welcome.
Peter Triggs is offline  
Old October 20, 2002, 12:04   #3
ahenobarb
Prince
 
ahenobarb's Avatar
 
Local Time: 09:36
Local Date: November 1, 2010
Join Date: Nov 2001
Posts: 437
Oh, I forgot the '[0]'. Sometimes you work a problem so much you lose all perspective and someone else has to come along and tell you what you're overlooking.

Thanks, Peter.
ahenobarb is offline  
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 05:36.


Design by Vjacheslav Trushkin, color scheme by ColorizeIt!.
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Apolyton Civilization Site | Copyright © The Apolyton Team