Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 06-19-2007, 08:06 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
Checking Files

Is there a way to check if a certain file exists on the server before its downloaded by the player? With a script of course..
Reply With Quote
  #2  
Old 06-19-2007, 08:19 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by Crow View Post
Is there a way to check if a certain file exists on the server before its downloaded by the player? With a script of course..
hmm, downloaded as in see the image and poof have it in your graal directory or downloaded by gupd package?
__________________
Reply With Quote
  #3  
Old 06-19-2007, 08:24 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
Before its downloaded in any way. When its in the Graal folder, I can check it with ->

PHP Code:
filesize(string) 
Or something else. But I want to check if it exists and is downloadable from the server before the client tries to do that.
Reply With Quote
  #4  
Old 06-19-2007, 08:25 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
I don't think it's possible to check that
__________________
Reply With Quote
  #5  
Old 06-19-2007, 08: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
Ok, lemme explain further :P I want to script a head changing system like on GK, something similar to "/head #". But I dont want to allow images which dont exist. How would I do that then? :/
Reply With Quote
  #6  
Old 06-19-2007, 08:40 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by Crow View Post
Ok, lemme explain further :P I want to script a head changing system like on GK, something similar to "/head #". But I dont want to allow images which dont exist. How would I do that then? :/
use fileexists?
Or was you hoping for something built-in or on the clientside?
__________________
Reply With Quote
  #7  
Old 06-19-2007, 11:05 PM
godofwarares godofwarares is offline
Webmaster
godofwarares's Avatar
Join Date: Dec 2006
Location: Florida
Posts: 552
godofwarares is on a distinguished road
Send a message via ICQ to godofwarares Send a message via AIM to godofwarares Send a message via MSN to godofwarares Send a message via Yahoo to godofwarares
Quote:
Originally Posted by Crow View Post
Ok, lemme explain further :P I want to script a head changing system like on GK, something similar to "/head #". But I dont want to allow images which dont exist. How would I do that then? :/
Give (npcserver) read rights to your heads folder, and use this to check if it exists:

PHP Code:
function doesFileExist(file)
{
  
file.loadLines(file);

  if (
file.size() >= 0)
  {
    return 
true;
  } else {
    return 
false;
  }

__________________
What signature? I see no signature?
Reply With Quote
  #8  
Old 06-19-2007, 11:38 PM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
Last time I tried fileexists() it didn't work, but that was outside the levels folder, perhaps you will have more luck with a downloadable file.
__________________
Reply With Quote
  #9  
Old 06-20-2007, 12:16 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
The recommended function to use is
headexists(filename) - tells you if the image is downloadable and can be used as head for the player
Reply With Quote
  #10  
Old 06-20-2007, 12:18 AM
Rapidwolve Rapidwolve is offline
Registered User
Join Date: Jul 2006
Posts: 1,241
Rapidwolve is an unknown quantity at this point
I had the same problem for my system to check if an image didn't exist on an external webserver (like a website). I was shocked when I found out that Graal can't check that. x_X
Reply With Quote
  #11  
Old 06-20-2007, 12:37 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
A clientside function for checking if a file can be downloaded would be nice...
I hate using getimgwidth() when showing an image and having it be wrong because the image isn't downloaded yet...
__________________
Do it with a DON!
Reply With Quote
  #12  
Old 06-20-2007, 03: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
Thanks a ton all of you
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 12:27 PM.


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