|
|
Re: GPS - Grid
[Re: x10d3]
#205864
05/09/08 08:31
05/09/08 08:31
|
Joined: Jul 2002
Posts: 4,436 Germany, Luebeck
Xarthor
Expert
|
Expert
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
|
Well one possibility would be to have a "simulated" grid (so to speak). You just need to calculate the quadrant from the player position (x, y) and then use an array to replace those. Example: I make a grid where each quadrant is 100 width and 100 height (x, y). Furthermore I set up two string arrays which hold the quadrant_x and quadrant_y name. (can be anything like "Alpha" and "Romeo" or whatever) Then we divide the players x/y position by the width/height of the quadrants and use the integer part of it to get the quadrant name from those string arrays. (NOTE: The following code is C-Script and not tested!)
var quadrant_size[2] = 100,100;
string quadrant_name = "#2";
text quadrant_x
{
strings = "A","B","C","D","E","F","G";
}
text quadrant_y
{
string = "1","2","3","4","5","6","7";
}
function get_quadrant()
{
var _x;
var _y;
_x = int(abs(my.x/quadrant_size.x));
_y = int(abs(my.y/quadrant_size.y));
str_cpy(quadrant_name,quadrant_x.string[_x]);
str_cat(quadrant_name,quadrant_y.string[_y]);
}
Now call the get_quadrant() function from within a while loop of your player or whatever and use the quadrant_name to display the location.
|
|
|
Re: GPS - Grid
[Re: Xarthor]
#208712
05/28/08 23:55
05/28/08 23:55
|
Joined: May 2008
Posts: 27
x10d3
OP
Newbie
|
OP
Newbie
Joined: May 2008
Posts: 27
|
Hey thanx! I am just now able to get back to this. so I tried it out and I get an error with this part during start up
text quadrant_x { strings = "A","B","C","D","E","F","G"; }
text quadrant_y { string = "1","2","3","4","5","6","7"; }
I am getting a syntax error on quadrant_x
|
|
|
Re: GPS - Grid
[Re: x10d3]
#208717
05/29/08 01:30
05/29/08 01:30
|
Joined: Nov 2007
Posts: 1,143 United Kingdom
DJBMASTER
Serious User
|
Serious User
Joined: Nov 2007
Posts: 1,143
United Kingdom
|
I don't think "strings" is part of a text object, it should be "string".
Last edited by DJBMASTER; 05/29/08 01:30.
|
|
|
Re: GPS - Grid
[Re: DJBMASTER]
#208736
05/29/08 08:24
05/29/08 08:24
|
Joined: Jul 2002
Posts: 4,436 Germany, Luebeck
Xarthor
Expert
|
Expert
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
|
Yep. DJBMASTER is correct. It should be "string" just like in quadrant_y, sorry for the typo. @DJBMASTER: "strings" is a part of a text object aswell, but represents the number of strings included in a text object. Example:
text dummy_txt
{
strings = 100;
}
That snippet creates a text object with 100 strings, thus can be used as a string array with 100 elements.
|
|
|
Re: GPS - Grid
[Re: Xarthor]
#210111
06/08/08 01:18
06/08/08 01:18
|
Joined: May 2008
Posts: 27
x10d3
OP
Newbie
|
OP
Newbie
Joined: May 2008
Posts: 27
|
I am not doing something right. I have set string quadrantX = "0";
string quadrantY = "0"; above main() and below it I set a panel and I am trying to display just 0 0 and can't get that. All I seem to get is (null) digits(1100,80,"Latitude: %s",*,2,quadrantX);
digits(1100,90,"Longitude: %s",*,2,quadrantY);
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|