Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   Tiles covertion to Image formula! [help?] (https://forums.graalonline.com/forums/showthread.php?t=81255)

Devenio 08-16-2008 12:53 AM

Tiles covertion to Image formula! [help?]
 
Example..
Image/Tile | ingame x,y| image x,y
black tile | 8,39 | 384,112
pics1.png | 15,255 | 2048,512

NPC Code:

//Forumla
temp.tile = tiles[int(mousex),int(mousey)];
temp.tx = BLAH;
temp.ty = BLAH;

//Display of tile
showimg( 200, "pics1.png", screenwidth/2, screenheight/2);
changeimgvis( 200, 4);
changeimgpart( 200, temp.tx, temp.ty, 16, 16);



Basically I need help figuring out what I need to put in temp.tx and temp.ty to get the correct coords to get the image to display the tile the mouse is over.

I've been trying to do this for 2 days now, and I just can't figure out the correct formula ... So could anyone help me ..

Programmer 08-16-2008 01:28 AM

I use this formula a lot when I'm doing external (or even internal!) programs/scripts that deal with Graal levels.

PHP Code:

base64 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";

temp.data "aa";
temp.letters = {data.substring(01), data.substring(12)};

temp.tile int((base64.pos(letters[0]) << 6) + base64.pos(letters[1]));

temp.tX = ((tile # 16) * 16) + (int(tile / 512) * 256);
temp.tY tile # 512; 

(Please replace # with a percent sign).

Devenio 08-16-2008 01:53 AM

Quote:

Originally Posted by Programmer (Post 1414772)
I use this formula a lot when I'm doing external (or even internal!) programs/scripts that deal with Graal levels.

PHP Code:

base64 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";

temp.data "aa";
temp.letters = {data.substring(01), data.substring(12)};

temp.tile int((base64.pos(letters[0]) << 6) + base64.pos(letters[1]));

temp.tX = ((tile # 16) * 16) + (int(tile / 512) * 256);
temp.tY tile # 512; 

(Please replace # with a percent sign).

Hmm, I havn't been scripting in a while .. but how is that going to help me?

Programmer 08-16-2008 02:13 AM

Quote:

Originally Posted by Devenio (Post 1414780)
Hmm, I havn't been scripting in a while .. but how is that going to help me?

Your problem is a bit confusing, explain a little more in detail?

Devenio 08-16-2008 02:37 AM

Thanks for the ingame help :p


All times are GMT +2. The time now is 09:22 AM.

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