Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 12-13-2009, 03:17 AM
oo_jazz_oo oo_jazz_oo is offline
Jazz teh Awesome
oo_jazz_oo's Avatar
Join Date: Jul 2006
Location: California
Posts: 596
oo_jazz_oo is a jewel in the roughoo_jazz_oo is a jewel in the rough
Send a message via MSN to oo_jazz_oo
Force Download

I want a function to force a download of a file on the player.

When players edit an image file, it can screw up a lot of things...
An example, if on player worlds that use staff blocks (but don't set the shape to block), all you have to do is delete the file, or edit it, and like magic...its gone.

There should be a way to force a file download, so the image is re-downloaded, and no problems occur.

If this could be added in an update, or even the next version, It would be very much appreciated. (Or even anything similar to this)
__________________

Reply With Quote
  #2  
Old 12-13-2009, 03:29 AM
WhiteDragon WhiteDragon is offline
Banned
Join Date: Feb 2007
Posts: 1,002
WhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to behold
It shouldn't be terribly hard to implement something that checksums the file on the server, and compares it to the checksum on the client each time the file gets buffered into memory.

But, you should really just setshape on something that important.
Reply With Quote
  #3  
Old 12-13-2009, 03:30 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
I use an array of common images, and isimgpixeltransparent to catch people who modify them
__________________
Quote:
Reply With Quote
  #4  
Old 12-13-2009, 04:23 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
You shouldn't be using staff blocks for anything important, it's way too easy to "hack" over them.
__________________

Last edited by cbk1994; 12-13-2009 at 05:07 AM..
Reply With Quote
  #5  
Old 12-13-2009, 05:05 AM
oo_jazz_oo oo_jazz_oo is offline
Jazz teh Awesome
oo_jazz_oo's Avatar
Join Date: Jul 2006
Location: California
Posts: 596
oo_jazz_oo is a jewel in the roughoo_jazz_oo is a jewel in the rough
Send a message via MSN to oo_jazz_oo
The staff block was just an example. XD

I was just requesting this feature, and couldnt think of another example on the spot. -.-
Reply With Quote
  #6  
Old 12-14-2009, 04:50 AM
oo_jazz_oo oo_jazz_oo is offline
Jazz teh Awesome
oo_jazz_oo's Avatar
Join Date: Jul 2006
Location: California
Posts: 596
oo_jazz_oo is a jewel in the roughoo_jazz_oo is a jewel in the rough
Send a message via MSN to oo_jazz_oo
Sorry for double post, but I found this while searching for scripts.

HTML Code:
fileupdate(str) - returns boolean - requests the download or reloading of a file
But, I can't get this to work...even if it does work.
I tried just the image file, with the folder path, relative to levels folder, etc. But I just can't get it to work...

Any help?
Reply With Quote
  #7  
Old 12-14-2009, 05:06 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
fileupdate is kind of useless nowadays, it was more so back when you did File I/O via Scripts and the files didn't appear in the File Browser until you did /refreshfilelist.

I don't think there's a command to actually force a re-download on the client-side. You can do this though on the server-side to have everyone re-download it.

PHP Code:
function onCreated() {
  
forceReDownload("levels/images/block.png");
}

function 
forceReDownload(file) {
  
temp.img.loadstring(file);
  
temp.img.savestring(file0);

__________________
Quote:
Reply With Quote
  #8  
Old 12-14-2009, 06:05 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
The way I imagine it's best to do is to have a list of file sizes of common images, and if they're off from the server's file size, disconnect the player. Use a "base" type update package to download the images on login.

Just a theory, though .
Quote:
Originally Posted by fowlplay4 View Post
I don't think there's a command to actually force a re-download on the client-side. You can do this though on the server-side to have everyone re-download it.
I never thought of doing that, nice .
__________________
Reply With Quote
  #9  
Old 12-14-2009, 09:15 AM
coreys coreys is offline
N-Pulse Assistant Manager
coreys's Avatar
Join Date: Mar 2005
Posts: 2,180
coreys has a spectacular aura about
Send a message via AIM to coreys Send a message via MSN to coreys Send a message via Yahoo to coreys
Quote:
Originally Posted by cbk1994 View Post
The way I imagine it's best to do is to have a list of file sizes of common images, and if they're off from the server's file size, disconnect the player. Use a "base" type update package to download the images on login.
That's over complicating it, what WhiteDragon said is more than good enough :O
__________________

Quote:
*SlikRick: so should I even ask about your aim status?
*Xor: well if you want to
*Xor: but i am LARPING
*SlikRick: While on a computer?
*Xor: yes
*Xor: in my living room
*SlikRick: ahh
*Xor: i have a fort setup to hide from beasts
Reply With Quote
  #10  
Old 12-14-2009, 11:06 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 coreys View Post
That's over complicating it, what WhiteDragon said is more than good enough :O
I assume you mean the setshape? A checksum would almost certainly be more complicated.

I agree, a setshape is the best way to make sure objects block regardless of the image; I was just trying to answer the question of the best way to force download an image .
__________________
Reply With Quote
  #11  
Old 12-15-2009, 12:37 AM
WhiteDragon WhiteDragon is offline
Banned
Join Date: Feb 2007
Posts: 1,002
WhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to behold
I meant easy for Stefan, not for a GS2 developer.

As far as I know, there is no hook for when something gets buffered into memory, so that'd actually be impossible.


The file rewriting thing is cool, although, the reason it works is probably because it changes the "file changed time", so I wonder if there is a better way than actually rewriting the whole thing (which could cause big problems if the file is large).
Reply With Quote
  #12  
Old 12-15-2009, 01:04 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
Quote:
Originally Posted by WhiteDragon View Post
I meant easy for Stefan, not for a GS2 developer.

As far as I know, there is no hook for when something gets buffered into memory, so that'd actually be impossible.


The file rewriting thing is cool, although, the reason it works is probably because it changes the "file changed time", so I wonder if there is a better way than actually rewriting the whole thing (which could cause big problems if the file is large).
I wonder if movefile would work? I doubt it since it shouldn't change the time, but it might trigger some kind of file updated event, and it's worth a shot.

PHP Code:
movefile("levels/graphics/doors/mydoor.png""levels/graphics/doors/mydoor.png"); 
__________________
Reply With Quote
  #13  
Old 12-15-2009, 05:03 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
You can configure gupd files to use checksum check instead of file modification time comparison. It's better to not use it for a lot of files because checksum check means it needs to read the whole file.
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 06:05 PM.


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