Results 1 to 9 of 9

Thread: Checking if a script is upToDate

  1. #1
    Join Date
    Feb 2007
    Posts
    849
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Checking if a script is upToDate

    So I stole this off Harry

    SCAR Code:
    Procedure ScriptUpToDate;
    var ClientUp, Neifile: integer;
        OnlineVersion: string;
    Begin
      writeln('Checking script version...');
      ClientUp := InitializeHTTPClient(False);
      SetHTTPUserAgent(ClientUp,'Simba/BarebonesUpdater');
      OnlineVersion := GetHTTPPage(ClientUp,'http://86.17.186.225/fightcave');
      if (OnlineVersion='') then exit;
      if (LOCAL_VERSION = OnlineVersion) then
        writeln('The script is up to date');

    End;

    Yes, that's my IP and yes, my web server is setup and running.

    The 'fightcave' file has a number (which I will be keeping up to date) and will be for example, 120. This will be for version 1.20!

    I can't find anything for 'InitializeHTTPClient', and the debugging is telling me I have included an incorrect amount of parameters.
    I've searched the forum, alas with no prevail.
    ________________________________________
    14:19 < cycrosism> I wonder what she would have done without it
    14:19 < cycrosism> without me*
    Cycrosism is now an it.
    Quote Originally Posted by Dervish View Post
    /Facedesk.

  2. #2
    Join Date
    Dec 2006
    Location
    Sweden
    Posts
    10,812
    Mentioned
    3 Post(s)
    Quoted
    16 Post(s)

    Default

    InitializeHTTPClient is one parm if you don't declare SRL, and 2 parms if you do declare SRL. Both booleans, and both best left at False (HandleCookies, HandleRedirects).

    I suggest getting a sub-domain name that you can update if your IP changes. Nice choice in httpd using lighttpd though!

    Lastly, make sure you free the HTTPClient when you're done.


    Send SMS messages using Simba
    Please do not send me a PM asking for help; I will not be able to help you! Post in a relevant thread or make your own! And always remember to search first!

  3. #3
    Join Date
    Feb 2007
    Posts
    849
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks, I couldn't find any documentation!

    I don't really want a sub domain that isn't any of the following!

    .co.uk
    .harry.lu
    .com

    I'll look around tomorrow for something free and not mysite.THISisAfreeFUCKINGdomainCLICKhereTOgetONEno w.co.nr!


    Edit: (I seem to edit A LOT of my posts!)

    There's a function for ToStr(), but not ToInt()?
    How can I transform a string to an int?
    Last edited by HarryJames; 03-04-2011 at 05:52 AM.
    ________________________________________
    14:19 < cycrosism> I wonder what she would have done without it
    14:19 < cycrosism> without me*
    Cycrosism is now an it.
    Quote Originally Posted by Dervish View Post
    /Facedesk.

  4. #4
    Join Date
    Jan 2010
    Posts
    5,227
    Mentioned
    6 Post(s)
    Quoted
    60 Post(s)

    Default

    StrToInt().

  5. #5
    Join Date
    Dec 2006
    Location
    Sweden
    Posts
    10,812
    Mentioned
    3 Post(s)
    Quoted
    16 Post(s)

    Default

    StrToInt() - edit: ninja.

    Look through http://freedns.afraid.org/domain/registry/ - you might find something nice.


    Send SMS messages using Simba
    Please do not send me a PM asking for help; I will not be able to help you! Post in a relevant thread or make your own! And always remember to search first!

  6. #6
    Join Date
    Oct 2006
    Posts
    1,190
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    Simba Code:
    StrToFloatDef(String, 0)

    will try to convert the string to a float and if it fails it will return 0, although you can set this number to anything eg -1, -0.1 etc whatever you want to use

    EDIT: double ninja'd



  7. #7
    Join Date
    Feb 2007
    Posts
    849
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I remembered I bought one, with EMA (that I didn't have).

    I got a letter from the bank saying they withdrew the transaction. I still own the site somehow, and it's updating the Zone Records now!

    ToStr
    IntToStr

    It doesn't follow the same format

    Thanks!
    ________________________________________
    14:19 < cycrosism> I wonder what she would have done without it
    14:19 < cycrosism> without me*
    Cycrosism is now an it.
    Quote Originally Posted by Dervish View Post
    /Facedesk.

  8. #8
    Join Date
    Feb 2007
    Posts
    849
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I'll make a new post for this!

    Simba Code:
    Procedure ScriptUpToDate;
    var
    ClientUp: integer;
    OnlineVersion: string;
    Begin
      writeln('Checking script version...');
      ClientUp := InitializeHTTPClient(False, False);
      SetHTTPUserAgent(ClientUp,'Simba/BarebonesUpdater');
      OnlineVersion := GetHTTPPage(ClientUp,'http://86.17.186.225/fightcave');
      FreeHTTPClient(ClientUp);

      if (OnlineVersion='') then exit;
        writeln(LOCAL_VERSION);
        writeln(OnlineVersion);
      if (LOCAL_VERSION = StrToInt(OnlineVersion)) then
        writeln('The script is up to date');

    End;

    Debug Box;
    Progress Report:
    Checking script version...
    120
    120
    
    Successfully executed.


    I manually stopped it. Are they still of inconsistent data types?

    Edit: (I DO ALOT OF EDITS, OKAY?)

    I now have this site, until mine starts working!
    Last edited by HarryJames; 03-04-2011 at 06:14 AM.
    ________________________________________
    14:19 < cycrosism> I wonder what she would have done without it
    14:19 < cycrosism> without me*
    Cycrosism is now an it.
    Quote Originally Posted by Dervish View Post
    /Facedesk.

  9. #9
    Join Date
    Nov 2008
    Location
    Melbourne, Australia
    Posts
    2,240
    Mentioned
    3 Post(s)
    Quoted
    11 Post(s)

    Default

    This is the code from the version checker on my power cutter

    Simba Code:
    Procedure CheckVersion;
    Begin
      Vv := GetPage('http://cycrosism.webs.com/willow.txt');
      V := Between('/v ', ' v\', Vv);
      If Version = V Then Writeln('You have the latest version ('+Version+')') Else
      Begin
        Writeln('Your version of the script isn''t up to date but the script will run anyway.');
        Writeln('Updated version can be found at [url]http://villavu.com/forum/showthread.php?p=771486#post771486');[/url]
        Wait(5000);
      End;
      If Version = '' Then
      Begin
        Writeln('Please allow the script to connect to my webpage to check the version');
        Wait(2000);
        TerminateScript;
      End;
    End;
    Click here to find out how to get full screen without members! | Click here to check out my Ultimate Bitmap Tutorial! Edited to work with Simba! |

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •