Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   Workarounds... (https://forums.graalonline.com/forums/showthread.php?t=69646)

fowlplay4 10-25-2006 12:52 AM

Workarounds...
 
Okay so I was playing around with flash and felt a need to make a workaround to get flash files from the internet, well I got all the way up to the part where I just gotta save the file.. It should save but it doesn't.. Help please :)
PHP Code:

function onCreated() {
Flash("http://64.191.61.82/albino_games04/curveball(www.albinoblacksheep.com).swf");
}
function 
Flash(url) {
 
temp.req requesturl("http://mywebserver.com/google.php?url=" url);
 
this.catchevent(temp.req,"onReceiveData","onFlash");
}
function 
onFlash(obj) {
 
temp.filename "flashtest.swf";
 echo(
"File Name?" SPC temp.filename);
 echo(
"File Length?" SPC obj.fulldata.length());
 
obj.fulldata.savestring("levels/flash/" temp.filename,0);
 echo(
temp.filename SPC "should be saved to your flash folder!");


PHP Code:

<?php
//Google.php
foreach ($_GET as $index => $val)
  $
$index $val;
echo 
open_external_url($url);

function 
open_external_url($url) {
 
$ch curl_init($url);
 
ob_start();
 
curl_exec($ch);
 
curl_close($ch);
 
$data ob_get_contents();
 
ob_end_clean();
 return 
$data;
}
?>


contiga 10-25-2006 04:35 PM

That's nice :D

Chompy 10-25-2006 05:14 PM

hmm, sounds nice

do levels/flash/ support .swf files in folder config etc..?

Admins 10-26-2006 01:34 AM

Is it serverside or clientside? It might end up somewhere in scriptfiles/*. On clientside you can only write into scriptfiles/* (exact path depends on your servername if you don't specify a path in scriptfiles/).

KuJi 10-26-2006 04:14 AM

Ovbiously clientside...

fowlplay4 10-26-2006 11:33 PM

Yes, the folder config is working correctly.
No its serverside. Using requesturl() clientside never occured to me before mmm.. Also does the flash gui check the scriptfiles if it can't find the file on the server?

Admins 10-27-2006 04:05 AM

Files added by script are not appearing when doing /find so it's not sent to clients either, that functionality can be added though if it's needed.

fowlplay4 10-28-2006 09:49 PM

Hmm.. so refreshing the file list should show the file? yet it doesnt.. Just wondering has anyone tried my script and had success?

Chompy 10-28-2006 10:02 PM

you have for example
PHP Code:

sendtorc("/refreshfilelist"); 

?

edit;
isn't obj.savestring suppose to be for one string?
tried like obj.savelines? obj.savevars?

fowlplay4 10-28-2006 10:22 PM

We're not dealing with vars so savevars doesnt work
PHP Code:

/*
 existing script and goes here
*/
function onFlash(obj) {
 echo(
obj.fulldata.size()); // returns 0, cant be a array ( lines )
 
echo(obj.fulldata.type()); // returns -1



Chompy 10-28-2006 10:26 PM

PHP Code:

temp.object = {obj.fulldata};
echo(
temp.object.size()); 

do that return 0?

fowlplay4 10-28-2006 11:03 PM

Congratulations Chompy that made it work :)
Heres some Rep..

PHP Code:

//Working onFlash(obj)

function onFlash(obj) {
 
temp.filename "flashtest.swf";
 
temp.object = {obj.fulldata};
 
temp.object.savelines("levels/flash/" temp.filename,0);
 echo(
temp.filename SPC "should be saved to your flash folder!");


Being able to request the url clientside and open the flash file in the scriptfiles folder would be neat and less strainful on the server :)

And just when I thought that worked, savelines is only letting me save the file as a txt. Good News though, when renamed the flash file works.

Requests:
- Saving lines in .swf format, ex: temp.object.savelines("test.swf",0);
- Opening flash files from the client scriptfiles folder.

http://img53.imageshack.us/img53/7598/jflashew7.jpg

Chompy 10-28-2006 11:05 PM

:blush: I am happy that I could help ya,
and I'll use that script on my server if I'm allowed,
because that was interesting, that picture :o

All you need to make now is an database that can store swf files for later download/usage
like an library? :]


Would be cool if someone made, like a library storing files
that you have added manually, or by url etc..
I might wanna make that :O

EDIT; would be funny, like to add something in server options, like
formats=txt,arc,swf,ini,doc etc.. would allow files saved by scripts with that format etc..
but that would easily been abused... ( like add .exe, or for example .dll or .server etc..)

but would be better to allow writing some other files then txt and arc (there are maybe more, but I don't know them :p)

Admins 10-29-2006 02:01 AM

I think it would also work if you do
PHP Code:

temp.object obj.fulldata;
temp.object.savestring("levels/flash/" temp.filename,0); 

Need to add something to make created files downloadable yes.


All times are GMT +2. The time now is 12:59 PM.

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