Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > New Scripting Engine (GS2)
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 08-16-2008, 12:53 AM
Devenio Devenio is offline
Scripter
Devenio's Avatar
Join Date: Dec 2006
Posts: 28
Devenio is on a distinguished road
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 ..
__________________

"Two things are infinite: the universe and human stupidity, and I'm not sure about the the universe.." -Einstein


Reply With Quote
  #2  
Old 08-16-2008, 01:28 AM
Programmer Programmer is offline
Coder
Programmer's Avatar
Join Date: Jan 2008
Location: -78.464422, 106.837328
Posts: 449
Programmer has a spectacular aura aboutProgrammer has a spectacular aura about
Send a message via AIM to Programmer Send a message via MSN to Programmer Send a message via Yahoo to Programmer
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).
__________________
- Iᴀɴ Zɪᴍᴍᴇʀᴍᴀɴ
Reply With Quote
  #3  
Old 08-16-2008, 01:53 AM
Devenio Devenio is offline
Scripter
Devenio's Avatar
Join Date: Dec 2006
Posts: 28
Devenio is on a distinguished road
Quote:
Originally Posted by Programmer View Post
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?
__________________

"Two things are infinite: the universe and human stupidity, and I'm not sure about the the universe.." -Einstein


Reply With Quote
  #4  
Old 08-16-2008, 02:13 AM
Programmer Programmer is offline
Coder
Programmer's Avatar
Join Date: Jan 2008
Location: -78.464422, 106.837328
Posts: 449
Programmer has a spectacular aura aboutProgrammer has a spectacular aura about
Send a message via AIM to Programmer Send a message via MSN to Programmer Send a message via Yahoo to Programmer
Quote:
Originally Posted by Devenio View Post
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?
__________________
- Iᴀɴ Zɪᴍᴍᴇʀᴍᴀɴ
Reply With Quote
  #5  
Old 08-16-2008, 02:37 AM
Devenio Devenio is offline
Scripter
Devenio's Avatar
Join Date: Dec 2006
Posts: 28
Devenio is on a distinguished road
Thanks for the ingame help
__________________

"Two things are infinite: the universe and human stupidity, and I'm not sure about the the universe.." -Einstein


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 11:03 AM.


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