Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 03-16-2008, 05:50 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
worldx() and worldy() - pretty slow?

The conversion from screen coordinates to woorld coordinates via worldx() and worldy() seem to happen pretty slow. For example, when I'm showing an image on the tile layer, but its supposed to look like its on the screen layer, it would lag behind if I move. This is not the case btw.
Though, it would be useful if there was some other way that wouldnt be so damn slow and laggy. To be certain, I actually need something that returns the level x and y at the edges of your screen. Any ideas?
Reply With Quote
  #2  
Old 03-16-2008, 06:05 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Ya, it definitely lags behind... making doing things like GUI's and such a pain... since they lag behind the player.
Reply With Quote
  #3  
Old 03-16-2008, 06:08 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by DustyPorViva View Post
Ya, it definitely lags behind... making doing things like GUI's and such a pain... since they lag behind the player.
If that was saracastic, I guess you didnt get my point D: The main focus is the end of my post.
Reply With Quote
  #4  
Old 03-16-2008, 06:10 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
I don't fully read stuff... so you want a substitute formula or something for it?
Reply With Quote
  #5  
Old 03-16-2008, 06:38 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Yea. Currently I'm using worldx(GraalControl.width, 0) to get the level x of the right window border of the client window, for example. But I need another way, because worldx() lags.
Reply With Quote
  #6  
Old 03-16-2008, 08:46 PM
Tolnaftate2004 Tolnaftate2004 is offline
penguin.
Join Date: Jul 2004
Location: Berkeley, CA
Posts: 534
Tolnaftate2004 is a jewel in the roughTolnaftate2004 is a jewel in the rough
Send a message via AIM to Tolnaftate2004
tx = mousex + (screenwidth-mousescreenx)/16
ty = mousey + (screenheight-mousescreeny)/16

I did not test this extensively, but it seems to me that it would work at least while the mouse is in the client window.
__________________
◕‿‿◕ · pfa · check yer syntax! · src

Killa Be: when i got that locker in 6th grade the only thing in it was a picture of a midget useing a firehose :/

Last edited by Tolnaftate2004; 03-16-2008 at 09:35 PM..
Reply With Quote
  #7  
Old 03-16-2008, 09:34 PM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
worldx lags? Are you sure you aren't just implementing it wrong?
__________________
Do it with a DON!
Reply With Quote
  #8  
Old 03-16-2008, 09:41 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
It doesn't 'lag' per say... but it doesn't update smoothly.
Reply With Quote
  #9  
Old 03-16-2008, 10:09 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by Tolnaftate2004 View Post
tx = mousex + (screenwidth-mousescreenx)/16
ty = mousey + (screenheight-mousescreeny)/16

I did not test this extensively, but it seems to me that it would work at least while the mouse is in the client window.
I tested it. It still lags behind, but its not as bad as worldx() and worldy().
Though, since it still lags behind...I think I'm doing something wrong.
Reply With Quote
  #10  
Old 03-16-2008, 10:16 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
If this is in a custom movement script, try moving it before the change of the player's coordinates(or after... I forget), and it should make a big difference.
Reply With Quote
  #11  
Old 03-16-2008, 10:21 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
I guess its close. Its somewhat related to the player, maybe thats the reason. Though I cant place it inside the movement, its a gani script.

Edit: Actually, I guess I should have told you what I need this for exactly. I wonder why I didnt, should make things easier. I'm trying to mimic the behavior of the default nicks to not leave the Graal window if the player is still visible, so you will even see it if you are at the level edge or somebody is at the edge of your Graal window.

Edit2: What I got also works perfectly clientside, just other players see it lagging behind a bit if what I'm trying to mimic (see above) is "happening" or however you want to call that.
Reply With Quote
  #12  
Old 03-16-2008, 11:08 PM
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
Quote:
Originally Posted by Crow View Post
What I got also works perfectly clientside, just other players see it lagging behind a bit if what I'm trying to mimic (see above) is "happening" or however you want to call that.
Yes, I've always had this problem.
__________________
Reply With Quote
  #13  
Old 03-17-2008, 06:24 AM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
I find gani scripts to buggy for nick/chat display. I just use a for (temp.p : players) loop that does a showimg for each player (on the level of course). The function for this I always call from my Movement script's onTimeout so I don't have to worry about that lag issue.
__________________
Do it with a DON!
Reply With Quote
  #14  
Old 03-17-2008, 04:07 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by zokemon View Post
I find gani scripts to buggy for nick/chat display. I just use a for (temp.p : players) loop that does a showimg for each player (on the level of course). The function for this I always call from my Movement script's onTimeout so I don't have to worry about that lag issue.
Hm. Well, might try that later.
Reply With Quote
  #15  
Old 04-14-2008, 08:16 AM
Langford Langford is offline
Registered User
Join Date: Apr 2008
Posts: 4
Langford is on a distinguished road
What about if you use the player's x, y, and screenwidth to determine the x and y of the bounds of the current 'viewport'

ie. player's coords are (30,30), screenwidth is 1024, 30*16=480, the left bound should be playerx - 480 (give or take 16), and + 480 (or so) for the right hand bound. This could be locally run in a loop i think, though I am new to this language so I am not sure of it's loop/speed capabilities yet.

idk.. just an idea, hope you caught what I mean
Reply With Quote
  #16  
Old 04-14-2008, 11:16 AM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
I thought about using screenwidth and screenheight, but this wouldnt work when the player is near the level border and not centered anymore.
Reply With Quote
  #17  
Old 04-14-2008, 03:41 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Or on a gmap.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #18  
Old 04-14-2008, 06:46 PM
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
The screen is moved depending on the player, so it's natural that worldx/y are not same as at the end of the frame depending on in which gani script you are retrieving them. For stuff like nicknames (things displayed for all players) it can actually be faster to use a weapon script and cycle through the player list and display it manually, instead of running a separate gani script for all the players.
Reply With Quote
  #19  
Old 04-14-2008, 07:22 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by Stefan View Post
The screen is moved depending on the player, so it's natural that worldx/y are not same as at the end of the frame depending on in which gani script you are retrieving them. For stuff like nicknames (things displayed for all players) it can actually be faster to use a weapon script and cycle through the player list and display it manually, instead of running a separate gani script for all the players.
Tried, images lag behind. Read forums, added after the lines where the player.x and player.y are updated. Logically doesnt update when the movement isnt used to move the player. Recommend something else D:
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 07:36 PM.


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