Graal Forums  

Go Back   Graal Forums > Development Forums > Future Improvements
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 01-22-2003, 04:03 AM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
onImage(filename,x,y)

Returns true if the point you specified is on the image and false if it falls on one of the transparent regions. I guess there are multiple this could be implemented:

1) The coordinates are given relative to the top-left corner of the image so the image doesn't need to be shown to be checked.
2) Instead of 'filename', the function takes image index (as used in showimg) and subsequently interprets the x and y as level or screen coordinates (depending on the draw layer of the given image).

Good for inventory systems - I can check if the player clicked on the apple rather than just checking against its bounding box. It opens up a few possibilities (systems like Ultima's, for example) and refines others. Let me know if the description wasn't clear enough.
__________________
Reply With Quote
  #2  
Old 01-22-2003, 04:09 AM
tlf288 tlf288 is offline
Registered User
tlf288's Avatar
Join Date: Nov 2001
Location: new account: Trevor
Posts: 0
tlf288 is on a distinguished road
Send a message via AIM to tlf288 Send a message via Yahoo to tlf288
I like the idea. I could see it being very usefull.

Maybe even something that returns the ID or filename of the image the mouse is on would be even better?
__________________
new account: Trevor
Reply With Quote
  #3  
Old 01-22-2003, 05:04 AM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
Quote:
Originally posted by tlf288
I like the idea. I could see it being very usefull.

Maybe even something that returns the ID or filename of the image the mouse is on would be even better?
Easier to use, but not necessarily as flexible. Plus image index doesn't always directly correlate to object indices.
__________________
Reply With Quote
  #4  
Old 01-22-2003, 05:22 AM
G_yoshi G_yoshi is offline
Forbidden
G_yoshi's Avatar
Join Date: Mar 2001
Posts: 7,206
G_yoshi will become famous soon enough
Send a message via AIM to G_yoshi
Re: onImage(filename,x,y)

Quote:
Originally posted by Kaimetsu
Returns true if the point you specified is on the image and false if it falls on one of the transparent regions. I guess there are multiple this could be implemented:

1) The coordinates are given relative to the top-left corner of the image so the image doesn't need to be shown to be checked.
2) Instead of 'filename', the function takes image index (as used in showimg) and subsequently interprets the x and y as level or screen coordinates (depending on the draw layer of the given image).

Good for inventory systems - I can check if the player clicked on the apple rather than just checking against its bounding box. It opens up a few possibilities (systems like Ultima's, for example) and refines others. Let me know if the description wasn't clear enough.
I'm all for it. Better than doing if (mousex in |a,b|....) {}. Thats kind of how triggeraction works if I'm not mistaken (your proposed idea)?
__________________
Reply With Quote
  #5  
Old 01-22-2003, 05:28 AM
Butz Butz is offline
Foxy
Butz's Avatar
Join Date: May 2001
Location: New York State
Posts: 2,831
Butz is on a distinguished road
Send a message via AIM to Butz
It could be used for collision detection for other things too.
__________________

FoxKelfonne @ DeviantART(updated: Dec 14, 2010)
Many Thanks to konidias for my avatar



Shawn Kelfonne - Aegis Mage of Dustari
Reply With Quote
  #6  
Old 01-22-2003, 05:48 AM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
Re: Re: onImage(filename,x,y)

Quote:
Originally posted by G_yoshi


I'm all for it. Better than doing if (mousex in |a,b|....) {}. Thats kind of how triggeraction works if I'm not mistaken
I think triggeraction works that way, yeah. So I'm sure there must be code in the engine that already does something like this - it just needs to be tied to a script command.
__________________
Reply With Quote
  #7  
Old 01-22-2003, 01:18 PM
CheeToS2 CheeToS2 is offline
That Guy
CheeToS2's Avatar
Join Date: Dec 2001
Location: Seattle, WA
Posts: 2,528
CheeToS2 will become famous soon enough
Send a message via AIM to CheeToS2
good idea, making ranges is a pain -_-
__________________

Reply With Quote
  #8  
Old 01-22-2003, 10:23 PM
tlf288 tlf288 is offline
Registered User
tlf288's Avatar
Join Date: Nov 2001
Location: new account: Trevor
Posts: 0
tlf288 is on a distinguished road
Send a message via AIM to tlf288 Send a message via Yahoo to tlf288
Quote:
Originally posted by CheeToS2
making ranges is a pain
Pain isn't even the half of it. It is horrible finding the x\y the whole thing takes up. This is a great suggestion and should be implemented without a doubt.
__________________
new account: Trevor
Reply With Quote
  #9  
Old 01-24-2003, 05:58 AM
tlf288 tlf288 is offline
Registered User
tlf288's Avatar
Join Date: Nov 2001
Location: new account: Trevor
Posts: 0
tlf288 is on a distinguished road
Send a message via AIM to tlf288 Send a message via Yahoo to tlf288
I was thinking while in the shower....

Wouldn't testimg(x,y) be not only more constant to the graal scripting language, but more practical? It would return the index of the image located at the given x and y position and you could test if it was true.

edit: Sorry for double post
__________________
new account: Trevor
Reply With Quote
  #10  
Old 01-24-2003, 06:09 AM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
Quote:
Originally posted by tlf288
Wouldn't testimg(x,y) be not only more constant to the graal scripting language, but more practical? It would return the index of the image located at the given x and y position and you could test if it was true.
More consistent, yes, but certainly not more practical. It would limit what we could do. What if we want to check this stuff before drawing the image? Maybe the intended position of the image depends on the result of the function. What if we have overlapping images? We don't want the front ones to mask out the back. Things like that, y'know? It just makes the function too high-level, and obliterates some of its functionality.
__________________
Reply With Quote
  #11  
Old 01-24-2003, 06:11 AM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Both testimg and isonimg would be good I think. The function isonimg would be more efficient if you want to only check a few things and don't want to care about overlapping images.
The functions testimg, testnpc etc. should be changed to give the index of the first object found, and also fill an array with the indexes of all objects found on the given position, sorted by the drawing order.
(since the variables can be normal variables and arrays at the same time it might be useful, and it would be compatible with old scripts).
Reply With Quote
  #12  
Old 01-24-2003, 06:26 AM
Python523 Python523 is offline
Banned
Join Date: Aug 2001
Location: Illinois
Posts: 3,498
Python523 is on a distinguished road
Quote:
Originally posted by Stefan
Both testimg and isonimg would be good I think. The function isonimg would be more efficient if you want to only check a few things and don't want to care about overlapping images.
The functions testimg, testnpc etc. should be changed to give the index of the first object found, and also fill an array with the indexes of all objects found on the given position, sorted by the drawing order.
(since the variables can be normal variables and arrays at the same time it might be useful, and it would be compatible with old scripts).
sounds great I think i suggested making an array of all found indexes awhile ago, I'm glad to see it might be added
Reply With Quote
  #13  
Old 02-03-2003, 06:05 AM
tlf288 tlf288 is offline
Registered User
tlf288's Avatar
Join Date: Nov 2001
Location: new account: Trevor
Posts: 0
tlf288 is on a distinguished road
Send a message via AIM to tlf288 Send a message via Yahoo to tlf288
Stefan: I was wondering if you are going to implement this feature anytime soon. If you are I will wait to do this project I am ready to start on that with these new functions would make it a lot easier.
__________________
new account: Trevor
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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:45 AM.


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