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 02-02-2010, 02:30 AM
12171217 12171217 is offline
Banned
Join Date: Jan 2009
Posts: 453
12171217 has a spectacular aura about
requesturlasgamefile?

Does anybody know how to use it?

I've got the parameters, but I have no clue how to use it.

Otherwise, is there a way to save a file to the images folder on the client using savestring?

And if not, can somebody give the NPCServer read/write access to a certain folder on Testbed so I can experiment?
Reply With Quote
  #2  
Old 02-02-2010, 04:22 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
In theory this should work, but it doesn't.

PHP Code:
function urltest() {
  
temp.url "http://forums.graalonline.com/forums/images/misc/vbulletin3_logo_white.gif";
  
temp.req requesturlasgamefile(temp.url"levels/images/vbulletin3_logo_white.gif"0);
  
this.catchevent(temp.req"onReceiveData""onFileTransferred");
}

function 
onFileTransferred(obj) {
  echo(
extractfilename(obj.fileSPC "received. (" obj.fulldata.length() @ " bytes)");

But you can also try the redirect option in the Folder Configuration.

I.e:
NPC Code:

redirect onlineimages/*.png http://www.example.com/images/

__________________
Quote:
Reply With Quote
  #3  
Old 02-02-2010, 04:51 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
ooo, I did not know you could do that in folder config
__________________

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
  #4  
Old 02-02-2010, 05:34 AM
12171217 12171217 is offline
Banned
Join Date: Jan 2009
Posts: 453
12171217 has a spectacular aura about
Quote:
Originally Posted by fowlplay4 View Post
In theory this should work, but it doesn't.

PHP Code:
function urltest() {
  
temp.url "http://forums.graalonline.com/forums/images/misc/vbulletin3_logo_white.gif";
  
temp.req requesturlasgamefile(temp.url"levels/images/vbulletin3_logo_white.gif"0);
  
this.catchevent(temp.req"onReceiveData""onFileTransferred");
}

function 
onFileTransferred(obj) {
  echo(
extractfilename(obj.fileSPC "received. (" obj.fulldata.length() @ " bytes)");

But you can also try the redirect option in the Folder Configuration.

I.e:
NPC Code:

redirect onlineimages/*.png http://www.example.com/images/

And what does the former do? Does it add it to the server, or is it sent to the client, is it called on the client? Does the NPCServer need read/write access to the directory?
Reply With Quote
  #5  
Old 02-02-2010, 04:47 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
These things only work in v6.
For the redirect-feature you still need to upload the files to the server (for file-modification-time-check) but the client will download them from a website.
With requesturlasgamefile() you can download a file from a webserver and treat it like it has been downloaded from the server. I've just seen that there is a bug though, normally it requires 4 parameters, will fix it in the next version.

The main reason for these functions is to take stress away from the server, e.g. it could be possible to download Graal.exe from the website instead from the game server so that not hundreds of people download a new Graal version at once and slow down the server.
Reply With Quote
  #6  
Old 02-02-2010, 08:12 PM
Darklux Darklux is offline
Petrification of a Newbie
Darklux's Avatar
Join Date: Dec 2002
Location: Dortmund, Germany
Posts: 1,375
Darklux is a jewel in the roughDarklux is a jewel in the rough
Send a message via ICQ to Darklux Send a message via AIM to Darklux Send a message via Yahoo to Darklux
Quote:
Originally Posted by Stefan View Post
These things only work in v6.
For the redirect-feature you still need to upload the files to the server (for file-modification-time-check) but the client will download them from a website.
With requesturlasgamefile() you can download a file from a webserver and treat it like it has been downloaded from the server. I've just seen that there is a bug though, normally it requires 4 parameters, will fix it in the next version.
Uploading the file anyways is a bit unhandy, could a md5 hash be attached to the command?
Reply With Quote
  #7  
Old 02-02-2010, 11:21 PM
12171217 12171217 is offline
Banned
Join Date: Jan 2009
Posts: 453
12171217 has a spectacular aura about
Quote:
Originally Posted by Stefan View Post
These things only work in v6.
For the redirect-feature you still need to upload the files to the server (for file-modification-time-check) but the client will download them from a website.
With requesturlasgamefile() you can download a file from a webserver and treat it like it has been downloaded from the server. I've just seen that there is a bug though, normally it requires 4 parameters, will fix it in the next version.

The main reason for these functions is to take stress away from the server, e.g. it could be possible to download Graal.exe from the website instead from the game server so that not hundreds of people download a new Graal version at once and slow down the server.
Thanks. How about savestring? Can I use that to save an image on the client?
Reply With Quote
  #8  
Old 02-02-2010, 11:47 PM
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 12171217 View Post
Thanks. How about savestring? Can I use that to save an image on the client?
I wouldn't think so, since it will be saving it as ASCII data instead of binary data (I'm pretty sure).
__________________

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
  #9  
Old 02-02-2010, 11:52 PM
Loriel Loriel is offline
Somewhat rusty
Loriel's Avatar
Join Date: Mar 2001
Posts: 5,059
Loriel is a name known to allLoriel is a name known to allLoriel is a name known to allLoriel is a name known to all
Quote:
Originally Posted by coreys View Post
I wouldn't think so, since it will be saving it as ASCII data instead of binary data (I'm pretty sure).
What is the difference? \n?
Reply With Quote
  #10  
Old 02-03-2010, 12:50 AM
12171217 12171217 is offline
Banned
Join Date: Jan 2009
Posts: 453
12171217 has a spectacular aura about
There is no difference. I can generate my image via script perfectly fine, and use savestring to save it. Only problem is, it's in the scriptfiles folder.
Reply With Quote
  #11  
Old 02-03-2010, 03:55 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 Loriel View Post
What is the difference? \n?
I guess depends on how it chooses to encode the text, but it seems it works.
__________________

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
  #12  
Old 02-03-2010, 03:48 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
savestring() is saving as binary, not ASCII.
Normally files saved to the scriptfiles folder should work fine as in-game image.
Reply With Quote
  #13  
Old 02-14-2010, 10:42 AM
calani calani is offline
Scriptess
calani's Avatar
Join Date: Aug 2003
Location: asmgarden.gmap
Posts: 606
calani is on a distinguished road
Send a message via AIM to calani
Quote:
Originally Posted by Stefan
Normally files saved to the scriptfiles folder should work fine as in-game image.
They do and have for awhile.

Pretty handy, actually. Custom graphics generated via script. Think: seasonal images.
Would be nice to have photoshop-like features added, however, or something like ImageMagick for Perl.
__________________
Reply With Quote
  #14  
Old 02-14-2010, 04:27 PM
12171217 12171217 is offline
Banned
Join Date: Jan 2009
Posts: 453
12171217 has a spectacular aura about
Really? O_o..

I had images in scriptfiles and they refused to display on the client..
Reply With Quote
  #15  
Old 02-14-2010, 04:51 PM
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
Quote:
Originally Posted by 12171217 View Post
Really? O_o..

I had images in scriptfiles and they refused to display on the client..
Same here, I declare shenanigans.
__________________
Quote:
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:54 AM.


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