From: ibot_dung11
mk thanks! ill see if i can figure it out lol. does this look correct and are my comments describing whats going on right? couldnt find a tut so found this in one of Ashaman88's scripts and made some name changes. idk what the CloseFile(NewFile) purpose is though
procedure AutoUpdater;
var NewFile:integer;
OnlineVersion, NewScript, NewFileName:string;
begin
if UseAutoChecker then
begin
OnlineVersion := GetPage('http://zezima.com/version.txt'); //this is just a number?
writeln(OnlineVersion);
writeln(ScriptVersion); //declared at begining of script
if (trim(OnlineVersion) > ScriptVersion) then //checking if the number is greater than the script in uses number?
begin
NewScript := GetPage('http://zezima.com/scriptname.simba'); //getting the new script?
NewFileName := ScriptPath+ 'scriptname' + OnlineVersion + '.simba'; //what we are saving the new script as?
NewFile := Rewritefile(NewFileName, true); //rewriting the old file with the new file
try //if an error occurs when saving??
WriteFileString(NewFile, NewScript);
except
begin
terminatescript;
end;
end;
CloseFile(NewFile); //not sure what its closing?
TerminateScript;
end else
writeLn('You have the latest version of the script!');
end else
WriteLn('We are not checking for updates!');
end;
edit: are you talking about google docs? or google drive they call it now? havent used google for awhile :P then i just add who ever it is to the document and they can view it? but wouldnt they be able to edit the document aswell? sorry im a noob, i have limited experience lol
Personally I use google docs just fine for public and/or private scripts (different google accounts for private scripts).
With Google Docs, you can add permissions for edit to a selected list of people while permissions to view is public. However, while permission to view is public, searching for you isn't easy, which is what keeps you fairly safe in respect to keeping your script private :p
CloseFile(NewFile); "Closes" the file. Basically when you open or write a file, it's now in your memory, so you need to close it in order to "free" it like you would a DTM or BMP.