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 09-10-2013, 03:17 AM
BlueMelon BlueMelon is offline
asdfg
BlueMelon's Avatar
Join Date: Sep 2008
Posts: 1,481
BlueMelon is a splendid one to beholdBlueMelon is a splendid one to beholdBlueMelon is a splendid one to beholdBlueMelon is a splendid one to behold
Saving file from server to client's PC

I have recently stumbled across the selectFileForDownload(str) function with no surprise of not finding much documentation.

What I want to do is download a file from the server to my PC using a save file dialog-esk UI.

This is what the function gives clientside for:
selectFileForDownload("/levels/graphics/images/test.png");


When I click the save button, nothing happens and the function doesn't return anything.

I haven't seen this function being used anywhere either...
And the lack of documentation doesn't help.

Is there another way to download a file from the server to a client's PC?

I want to avoid uploading it to a web server and getting the client to download it from there...

I have also tried different arguments for the function with no luck.
__________________
http://i.imgur.com/OOJbW.jpg
Reply With Quote
  #2  
Old 09-10-2013, 03:49 AM
alissalee alissalee is offline
Mr. Ciprioni Atrius Admin
alissalee's Avatar
Join Date: Dec 2004
Location: Lawrence, Ma
Posts: 190
alissalee is an unknown quantity at this point
Send a message via AIM to alissalee Send a message via MSN to alissalee
i have no answer for this. but i would love to understand this function. that would be a amazing thing
__________________
account was being used by jigga.... sorry for what he has said in the past
Reply With Quote
  #3  
Old 09-10-2013, 05:33 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
That's a Client-RC function, and a terrible file browser.

With solely just script.

PHP Code:
function onCreated() {
  
temp.file.loadstring("level/path/to/file.png");
  
temp.data base64encode(temp.file);
  
player.triggerclient("weapon"this.name"file""file.png"temp.data);
}

//#CLIENTSIDE

function onActionClientSide() {
  if (
params[0] == "file") {
    
temp.data base64decode(params[2]);
    
temp.data.savestring(params[1], 0); // Saves to Graal/scriptfiles/Servername/file.png
    
echo("Downloaded " params[1] @ "!");
  }

Side note, just stumbled upon these functions in /scripthelp:

generatezipstring(obj) - returns string - creates a zip in memory from the array you provide like {filename, content, filename, content, ...}, save to file using str.savestring(filename, 0)
decompressfile(str, str, str, int) - returns boolean - parameters are filename, file name pattern (*), destination folder and flags (1 (keep zip paths) + 2 (keep original modification time)); unzips a file into the specified folder
__________________
Quote:
Reply With Quote
  #4  
Old 09-10-2013, 10:56 AM
BlueMelon BlueMelon is offline
asdfg
BlueMelon's Avatar
Join Date: Sep 2008
Posts: 1,481
BlueMelon is a splendid one to beholdBlueMelon is a splendid one to beholdBlueMelon is a splendid one to beholdBlueMelon is a splendid one to behold
Hm, ok. I will use savestring instead.
__________________
http://i.imgur.com/OOJbW.jpg
Reply With Quote
  #5  
Old 09-10-2013, 08:16 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
Now slightly off topic, but re: the original post, you can see how it's used in the graphic uploader I released (and Jer modified) on the Code Gallery.
__________________
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 01:47 AM.


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