Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 09-17-2011, 06:47 AM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
Making A Gps

Iv made the base script im just wondering how to get the x and y's right and moving here is the base
what im wonding how to do is making the markers x in the centre of the background and the dot centered when the player writes /setgps then when the player moves the dot will move either down up right left or diagonally depending where the player is to where the marker is.
i cant figure out how to make the max dots x and y depending on how big the gmap is and making it only move a tiny bit.
PHP Code:
//#CLIENTSIDE


function onCreated() {
    new 
GuiBitmapCtrl("GPS_Background") {
        
210;
        
10;
        
width 100;
        
height 100;
        
bitmap "GPS_Background.png";
    }
    new 
GuiBitmapCtrl("GPS_Marker") {
        
240;
        
40;
        
width 10;
        
height 10;
        
bitmap "GPS_Marker.png";
    }
    new 
GuiBitmapCtrl("GPS_Dot") {
        
255;
        
55;
        
width 10;
        
height 10;
        
bitmap "GPS_Dot.png";
    }
    new 
GuiTextCtrl("GPS_X") {
        
profile GuiBlueTextProfile;
        
height 20;
        
width 200;
        
315;
        
65;
        
red 1;
        
green 1;
        
blue 1;
    }
    new 
GuiTextCtrl("GPS_Y") {
        
profile GuiBlueTextProfile;
        
height 20;
        
width 200;
        
315;
        
80;
        
red 1;
        
green 1;
        
blue 1;
    }
    
onTimeout();
}

function 
onTimeout() {
    
GPS_X.text "X:  "@client.gpsx;
    
GPS_Y.text "Y:  "@client.gpsy;
    
settimer(0.05);
}

function 
onPlayerChats() {
    if (
player.chat == "/setgps") {
        
player.chat "GPS Marker Set!";
        
client.gpsx player.x;
        
client.gpsy player.y;
    }

__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion

Last edited by Gunderak; 09-17-2011 at 07:02 AM..
Reply With Quote
  #2  
Old 09-17-2011, 06:55 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
For the nth time, please style your code before posting it in the scripting forums.

If the map is to be 100x100 pixels, and the actual map is 12x12 levels, you can calculate that the map is 768x768 tiles (64 tiles in a row/column per level). is the number of pixels each tile represents on your map horizontally (the same vertically if it's a square).

Then, to figure out where to draw markers,

PHP Code:
function getMarkerPosition(temp.tileXtemp.tileY) {
  return {
    (
100 768) * temp.tileX,
    (
100 768) * temp.tileY
  
};

All you're doing is multiplying the number of pixels each tile represents, , by the number of tiles.
__________________

Last edited by cbk1994; 09-17-2011 at 07:02 AM.. Reason: updating to reflect changes to OP
Reply With Quote
  #3  
Old 09-17-2011, 06:59 AM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
I have to go out on public transport so i finished writing my goal while being on the bus, which i sill am on.
also sorry for not styling it. il try to do so now on my idevice if i can.
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote
  #4  
Old 09-19-2011, 03:31 AM
jamitsu89 jamitsu89 is offline
Registered User
Join Date: Jun 2011
Posts: 27
jamitsu89 is an unknown quantity at this point
Style your code!

*EDIT*
Or I shall become enraged!
Reply With Quote
  #5  
Old 09-19-2011, 09:48 AM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
Quote:
Originally Posted by jamitsu89 View Post
Style your code!

*EDIT*
Or I shall become enraged!
lol.
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote
Reply


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 Off

Forum Jump


All times are GMT +2. The time now is 12:40 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.