Graal Forums  

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

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 09-02-2010, 02:17 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
Downloader

Well I made this since I hated the whole opening my browser and what not to download the new beta client (If I could find the name of the Beta TextCtrl, I'd do it automatically but w/e).

Basically downloads what you have set in this.dlurl.

PHP Code:
//#CLIENTSIDE

function onCreated() {
  
// You'll have to fix this line.. well the start of it.
  
this.dlurl "http://www.path.to/the/right/place/" getplatform() @ ".zip";
}

function 
ChatBar.onAction() {
  if (
ChatBar.text == "/download") {
    
ChatBar.text "";
    
createGUI();
    
// Comment the line below if you want the 
    // joy of clicking a button.
    
downloadFile(); 
  }
}

function 
createGUI() {
  new 
GuiWindowCtrl("BetaDownloader") {
    
profile GuiBlueWindowProfile;
    
width 200;
    
height 72;
    
= (screenwidth width) / 2;
    
= (screenheight height) / 2;
    
text "Beta Downloader";
    new 
GuiButtonCtrl("BetaDownloader_Download") {
      
profile GuiBlueButtonProfile;
      
10;
      
30;
      
active true;
      
width 180;
      
text "Download" SPC extractfilename(thiso.dlurl);
      
thiso.catchevent(this.name"onAction""downloadFile");
    }
  }
}

function 
downloadFile() {
  
with (BetaDownloader_Download) {
    
active false;
    
text "Downloading...";
  }
  
temp.req requesturl(this.dlurl);
  
thiso.catchevent(temp.req"onReceiveData""downloadedFile");
}

function 
downloadedFile(obj) {
  
temp.file extractfilename(obj.file);
  
BetaDownloader_Download.text file SPC "downloaded.";
  
obj.fulldata.savestring(file0);

Portable download functions:

PHP Code:
//#CLIENTSIDE
function downloadFile(dlurl) {
  
temp.req requesturl(dlurl);
  
thiso.catchevent(temp.req"onReceiveData""downloadedFile");
}

function 
downloadedFile(obj) {
  
temp.filename extractfilename(obj.file);
  
obj.fulldata.savestring(temp.filename0);

__________________
Quote:
Reply With Quote
 


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:19 AM.


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