View Full Version : ..more code probs
clueless
08-03-2006, 08:18 AM
ive been trying to use the ftp plugin. I managed to get it connected up ok when i specified the url/user/pass in the program but im having difficulty when using user inputs;-
myFTP = Input.GetText("iptFTP");
myUser = Input.GetText("iptUser");
mypass = Input.GetText("iptAssp");
if Label.GetText("FTPStatus")=="Disconnected" then
FTP.Connect(myFTP, myUser, mypass, "", true);
end
the error im getting is 'attempt to index global FTP (a string value)'
Roboblue
08-03-2006, 11:18 AM
Mina has a good FTP example on her site
go here (http://www.mina-e.com/ams-n-ex.html) and download the ftp example apz.
clueless
08-03-2006, 05:08 PM
Thanks but im also intrested why this isnt working in the first place.
Wild guess... Either the FTP plugin is not loaded or you have overwritten the table containing the FTP functions with another value... are there any variables named FTP anywhere in your script?
clueless
08-03-2006, 05:57 PM
Thanks. Yes i did overwrite FTP.
clueless
08-03-2006, 07:01 PM
just for the sake of anyone else searching for a solution on this..
in the end i made a global function;-
function checkFTP()
if String.Length(Input.GetText("ipthost"))>0 and FTP.IsValidHostname(Input.GetText("ipthost")) and String.Length(Input.GetText("iptuser"))>0 and String.Length(Input.GetText("iptpass"))>0 and Button.IsVisible("butConnect")==false then
Button.SetVisible("butConnect", true);
elseif String.Length(Input.GetText("iptuser"))==0 or String.Length(Input.GetText("iptpass"))==0 and Button.IsVisible("butConnect")==true then
Button.SetVisible("butConnect", false);
end
end
that i call from the OnKey condition of the host/user/pass input boxes. It switches on the connect button when the input boxes have been filled and the host name is valid.
Then on the connect button i put;-
hostname = Input.GetText("ipthost");
username = Input.GetText("iptuser");
password = Input.GetText("iptpass");
account ="";
if Label.GetText("MyHostStatus")=="Disconnected" then
FTP.Connect(hostname, username, password, account, true);
if FTP.IsConnected()==true then
Button.SetText("butConnect", "Disconnect");
Audio.Load(CHANNEL_EFFECTS, "AutoPlay\\Audio\\Copy of Bleeep-Public_D-17.wav", false, false);
Audio.Play(CHANNEL_EFFECTS);
Label.SetText("MyHostStatus", "Connected");
end
else
FTP.Disconnect()
Button.SetText("butConnect", "Connect");
Label.SetText("MyHostStatus", "Disconnected");
Audio.Load(CHANNEL_EFFECTS, "AutoPlay\\Audio\\Clicka-TM-533.wav", false, false);
Audio.Play(CHANNEL_EFFECTS);
end
when its connected it switches the 'connect' button to 'disconnect' and changes the text of the MyHostStatus to Connected. The sound effects were custom ones i imported.
Powered by vBulletin™ Version 4.0.6 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.