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 07-18-2006, 12:10 PM
ForgottenLegacy ForgottenLegacy is offline
-Backtoscripts-
Join Date: Aug 2003
Location: California
Posts: 289
ForgottenLegacy is on a distinguished road
Send a message via AIM to ForgottenLegacy
requestText("folders", "");

Simple topic name. Now that I have your attention, I'll state my problem: WTFORK !!

Okay. My rights are set to this:
NPC Code:

rw */*
rw */*/*
rw */*/*/*
rw */*/*/*/*
rw */*/*/*/*/*
rw */*/*/*/*/*/*
rw */*/*/*/*/*/*/*
rw */*/*/*/*/*/*/*/*
rw */*/*/*/*/*/*/*/*/*
rw */*/*/*/*/*/*/*/*/*/*



Now I am trying to make a client FTP to add to my TGConsole. When I do a requestText(), passing "folders" as the first param, it works! ...sort of! Instead of a list of all of the folders in the FTP, I get this:
NPC Code:

*/
*/*/
*/*/*/
*/*/*/*/
*/*/*/*/*/
*/*/*/*/*/*/
*/*/*/*/*/*/*/
*/*/*/*/*/*/*/*/
*/*/*/*/*/*/*/*/*/
*/*/*/*/*/*/*/*/*/*/



In all honesty, that return is useless. Useless for making an FTP. Can someone fix this please, or help me through this problem? I do not want to change my rights, because I'm pretty much in charge of the FTP, and I create and delete folders left and right. I don't want to update my rights every time I create or delete a folder.

-- Kaidenn A. Neseta
__________________
"The higher you fly, the harder it is to breathe."

[Kaidenn] Maybe I will somehow take control of Lance's body when he isn't looking, have him log onto Kingdoms, update one script, and leave.
[Kaidenn] And leave him exactly where I found him, unchanged and completely unnaware of what just took place the last two minutes.
[GrowlZ] Lance: You might want to lock your bedroom door tonight
Reply With Quote
  #2  
Old 07-18-2006, 03:45 PM
Omini Omini is offline
Millenium Owner
Join Date: Feb 2006
Location: N.Ireland
Posts: 293
Omini is on a distinguished road
Send a message via AIM to Omini Send a message via MSN to Omini Send a message via Yahoo to Omini
All I know about a Client RC is that you need a weapon, reading folder names and what not I don't know.

PHP Code:
//#CLIENTSIDE

public function openFileBrowser() {
  
requesttext("folders","") ;
  new 
GuiWindowCtrl(FileBrowser_Screen) {
    
profile = "GuiWindowProfile";
    
x = 50, y = 50;
    
width = 500, height = 450;
    
canMove = true;
    
canResize = true;
    
canClose = true;
    
text = "File Browser";
    
tile = true;
    
destroyonhide = true;

    new 
GuiScrollCtrl(FileBrowser_TreeScroll) {
      
profile = "GuiScrollProfile";
      
horizSizing = "right";
      
vertSizing = "height";
      
x = 5;
      
y  = 23;
      
width = 136;
      
height = 335;
      
hScrollBar = "dynamic";
      
vScrollBar = "dynamic";
      
tile = true;

      new 
GuiTreeViewCtrl(FileBrowser_Tree) {
        
profile = "GuiTreeViewProfile";
        
horizSizing = "width";
        
x = y = 0;
        
width = 120;
        
fitParentWidth = false;
        
sortmode = "name";
        
thiso.catchevent(name,"onSelect","onTreeView");
      }
    }
    new 
GuiTextCtrl(FileBrowser_NameLabel) {
      
profile = "GuiDarkTextProfile";
      
position = "170 24";
      
extent = "60 22";
      
minExtent = "8 22";
      
text = "Name";
    }
    new 
GuiTextCtrl(FileBrowser_RightsLabel) {
      
profile = "GuiDarkTextProfile";
      
position = "285 24";
      
extent = "40 22";
      
minExtent = "8 22";
      
text = "Rights";
    }
    new 
GuiTextCtrl(FileBrowser_SizeLabel) {
      
profile = "GuiDarkTextProfile";
      
position = "325 24";
      
extent = "50 22";
      
minExtent = "8 22";
      
text = "Size";
    }
    new 
GuiTextCtrl(FileBrowser_ModifiedLabel) {
      
profile = "GuiDarkTextProfile";
      
position = "375 24";
      
extent = "60 22";
      
minExtent = "8 22";
      
text = "Modified";
    }

    new 
GuiScrollCtrl(FileBrowser_FilesScroll) {
      
profile = "GuiScrollProfile";
      
horizSizing = "width";
      
vertSizing = "height";
      
x = 144;
      
y  = 44;
      
width = 351;
      
height = 311;
      
hScrollBar = "alwaysOff";
      
vScrollBar = "dynamic";
      
tile = true;

      new 
GuiTextListCtrl(FileBrowser_FilesList) {
        
profile = "GuiTextListProfile";
        
horizSizing = "width";
        
vertSizing = "height";
        
x = y = 0;
        
width = 330;
        
fitParentWidth = true;
        
sortMode = "name";
        
clipColumnText = true;
        
lineSpacing = 20;
        
fontSize = 18;
        
setIconSize(16,18);
        
columns = {0,120,160,230};
      }
    }
    new 
GuiScrollCtrl(FileBrowser_Scroll) {
      
profile = "GuiScrollProfile";
      
x = 5;
      
y = 360;
      
width = 490;
      
height = 85;
      
horizSizing = "width";
      
vertSizing = "top";
      
hScrollBar = "alwaysOff";
      
vScrollBar = "dynamic";

      new 
GuiMLTextCtrl(FileBrowser_DebugText) {
        
profile = "GuiMLTextProfile";
        
horizSizing = "width";
        
x = y = 0;
        
width = 470;
      }
    }
  }
  new 
GuiContextMenuCtrl(FileBrowser_Menu) {
    
profile = "GuiPopUpMenuProfile";
    
textprofile = "GuiTextListProfile";
    
width = 20;
//    setIconSize(16,16);

    
clearRows();
    
addRow(0,"Download");
    
addRow(1,"Edit As Text");
    
addRow(2,"Upload File(s)");
    
addRow(-1,"-");
    
addRow(3,"Reload");
    
addRow(4,"Move");
    
addRow(5,"Rename");
    
addRow(-1,"-");
    
addRow(6,"Delete");
  }

  
FileBrowser_DebugText.addText("Welcome to the filebrowser!", true);
  
FileBrowser_Screen.bringToFront();
}

function 
FileBrowser_FilesList.onResize(newwidth, newheight) {
  if (
newwidth<320) newwidth = 320;
  
FileBrowser_FilesList.columns = {0,newwidth-210,newwidth-170,newwidth-100};
  
widthdiff = newwidth-330;
  
FileBrowser_RightsLabel.x = 285+widthdiff;
  
FileBrowser_SizeLabel.x = 325+widthdiff;
  
FileBrowser_ModifiedLabel.x = 395+widthdiff;
}

function 
FileBrowser_FilesList.onRightMouseDown(modifier,mx,my,mcount) {
  
this.fileid = FileBrowser_FilesList.getRowIdAtPoint(mx,my);
  if (
this.fileid>=0) {
    
FileBrowser_FilesList.setSelectedById(this.fileid);
    
this.selectedfile = FileBrowser_FilesList.getSelectedText();
    
i = this.selectedfile.pos("\t");
    if (
i>=0)
      
this.selectedfile = this.selectedfile.substring(0,i);
    
FileBrowser_Menu.open(mx,my);
  }
}

function 
FileBrowser_Menu.onSelect(entryid,text) {
  switch (
text) {
    case 
"Download": {
        
selectFileForDownload(this.selectedfile);
        break;
      }
    case 
"Edit As Text": {
        break;
      }
    case 
"Upload File(s)": {
        
selectFileForUpload();
        break;
      }
    case 
"Reload": {
        
triggerserver("gui","Editor","updatefile",this.selectedfile);
        break;
      }
    case 
"Move": {
        
TextEditor.openTextInput("MoveFiles","Move Files","Enter the target folder:","Move");
        if (
MoveFiles_Field.text=="")
          
MoveFiles_Field.text = this.showfolder;
        if (!
MoveFiles_Field.text.ends("/"))
          
MoveFiles_Field.text @= "/";
        break;
      }
    case 
"Rename": {
        
TextEditor.openTextInput("RenameFile","Rename File","Enter the new filename:","Rename");
        
RenameFile_Field.text = this.selectedfile;
        break;
      }
    case 
"Delete": {
        
requestFileDeletion(this.selectedfile);
        
requesttext("folder",this.showfolder);
        break;
      }
  }
}

function 
MoveFiles_Button.onAction() {
  
targetfolder = MoveFiles_Field.text;
  if (!
targetfolder.ends("/"))
    
targetfolder @= "/";
  echo(
"moving files to : " @ targetfolder);
  
requestFilesMove(targetfolder,this.selectedfile);
  
requesttext("folder",this.showfolder);
  
MoveFiles_Window.hide();
}

function 
RenameFile_Button.onAction() {
  
newfilename = RenameFile_Field.text;
  echo(
"renaming file to: " @ newfilename);
  
requestFileRename(this.selectedfile,newfilename);
  
requesttext("folder",this.showfolder);
  
RenameFile_Window.hide();
}

function 
onFolderLog(text) {
  echo(
"folderlog: " @ text);
  
FileBrowser_DebugText.addText("\n" @ text, true);
  
FileBrowser_DebugText.scrollToBottom();
}

function 
onReceiveText(texttype,textoption,textlines) { 
  switch (
texttype) {
    case 
"folders":
      
FileBrowser_Tree.clearNodes();
      for (
foldername: textlines) {
        
subnode = FileBrowser_Tree.addNodeByPath(foldername,"/");
        
subnode.sortgroup = 1;
        
subnode.expanded = false;
      }
      
FileBrowser_Tree.sort();
      break;
    case 
"folder":
      
FileBrowser_FilesList.clearRows();
      
this.displayedfiles = textlines;
      for (
i=0; i<textlines.size(); i++) {
        
fileentry = textlines[i];

        
// Add the file entry
        
str = fileentry[0] @ '\t' @ fileentry[1] @ '\t' @ fileentry[2] @ '\t' @ fileentry[3];
        
FileBrowser_FilesList.addRow(i,str);

        
// Set icon
        
dotpos = fileentry[0].positions(".");
        
imgfilename = dotpos.size() > 0 ? "fileicon_" @ fileentry[0].substring(dotpos[dotpos.size()-1] + 1, -1) @ ".png" : "";
        
lastRow().icon.drawimagerectangle(0,0,imgfilename,0,0,16,16);
      }
      
FileBrowser_FilesList.sort();
      break;
  }
}

function 
onTreeView(obj,node,path,dot) {
  
this.showfolder = path;
  
requesttext("folder",path);
}

function 
lastRow() return FileBrowser_FilesList.rows[FileBrowser_FilesList.rows.size()-1]; 
I have that in a weapon called -FileBrowser
__________________



Reply With Quote
  #3  
Old 07-18-2006, 11:31 PM
ForgottenLegacy ForgottenLegacy is offline
-Backtoscripts-
Join Date: Aug 2003
Location: California
Posts: 289
ForgottenLegacy is on a distinguished road
Send a message via AIM to ForgottenLegacy
That does nothing for me. I still get the very same output. The problem is, requestText("folders", ""); reads my rights, and NOT the folder tree. This is a bug that needs to be fixed.
__________________
"The higher you fly, the harder it is to breathe."

[Kaidenn] Maybe I will somehow take control of Lance's body when he isn't looking, have him log onto Kingdoms, update one script, and leave.
[Kaidenn] And leave him exactly where I found him, unchanged and completely unnaware of what just took place the last two minutes.
[GrowlZ] Lance: You might want to lock your bedroom door tonight
Reply With Quote
  #4  
Old 07-19-2006, 07:49 PM
Yen Yen is offline
Banned
Yen's Avatar
Join Date: Oct 2005
Location: Nova Scotia, Canada
Posts: 1,085
Yen is an unknown quantity at this point
Send a message via AIM to Yen Send a message via MSN to Yen
requesttext("folder",path) is what you want.
Notice the 'folder' instead of 'folders'
Reply With Quote
  #5  
Old 07-19-2006, 10:09 PM
ForgottenLegacy ForgottenLegacy is offline
-Backtoscripts-
Join Date: Aug 2003
Location: California
Posts: 289
ForgottenLegacy is on a distinguished road
Send a message via AIM to ForgottenLegacy
Yen, that only gives me the contents of a single folder, files and everything. I want to get the entire folder tree.
__________________
"The higher you fly, the harder it is to breathe."

[Kaidenn] Maybe I will somehow take control of Lance's body when he isn't looking, have him log onto Kingdoms, update one script, and leave.
[Kaidenn] And leave him exactly where I found him, unchanged and completely unnaware of what just took place the last two minutes.
[GrowlZ] Lance: You might want to lock your bedroom door tonight
Reply With Quote
  #6  
Old 07-20-2006, 08:39 PM
Yen Yen is offline
Banned
Yen's Avatar
Join Date: Oct 2005
Location: Nova Scotia, Canada
Posts: 1,085
Yen is an unknown quantity at this point
Send a message via AIM to Yen Send a message via MSN to Yen
Quote:
Originally Posted by ForgottenLegacy
Yen, that only gives me the contents of a single folder, files and everything. I want to get the entire folder tree.
O-o
That's not possible, so make a function.
There's no problem with 'folders,' it's mean't to return your folder rights, not a folder tree.
Reply With Quote
  #7  
Old 07-21-2006, 03:29 AM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
That is a (known?) bug with the Client-RC. You have to specifically set the folders you want access to in your rights, instead of using wildcards (wildcards for the filename do work, just not for the folder, ie: rw temp/blah/* will work, temp/*/* will not.)
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
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 10:03 AM.


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