Results 1 to 18 of 18

Thread: Help with version checker

  1. #1
    Join Date
    May 2007
    Location
    England
    Posts
    4,140
    Mentioned
    11 Post(s)
    Quoted
    266 Post(s)

    Default Help with version checker

    Hey guys. I'm making a version checker for a script which SRL Members know about, but the public will know about it when it is completed. Anyway, this is my procedure which checks the version
    SCAR Code:
    procedure VerCheck;
    var
      Version : string;

    begin
      Version:= GetPage('http://www.learnsomething.freehostia.com\Version.txt');
      if (not(Version = Ver)) then
      begin
        WriteLn('');
        WriteLn('Your version is not the latest. Get the latest BETA version from');
        WriteLn('http://www.villavu.com/forum/showthread.php?p=587620#post587620');
        WriteLn('');
        TerminateScript;
      end;
      Wait(5000);
    end;
    and there is
    SCAR Code:
    const
      Ver = '0.5'; //DO NOT CHANGE UNLESS YOU WANT AN OUTDATED VERSION!
    above it. When I run it, I get
    Code:
    Socket Error # 11004
    
    
    Your version is not the latest. Get the latest BETA version from
    http://www.villavu.com/forum/showthread.php?p=587620#post587620
    in the debug box. I can only assume that "Socket Error # 11004" has something to do with it, as the version in the document on the internet matches the const, but I don't know how to fix this.

    Thanks,
    Richard
    <3

    Quote Originally Posted by Eminem
    I don't care if you're black, white, straight, bisexual, gay, lesbian, short, tall, fat, skinny, rich or poor. If you're nice to me, I'll be nice to you. Simple as that.

  2. #2
    Join Date
    Oct 2007
    Location
    http://ushort.us/oqmd65
    Posts
    2,605
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    I tried going to that site in my browser. It didn't load.

    + you have to do

    StrToFloat(Version)
    I do visit every 2-6 months

  3. #3
    Join Date
    Jun 2007
    Location
    Wednesday
    Posts
    2,446
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    GetPage returns a string as is his constant, so as long as they are both strings (or running using Scar 3.20 onwards) then it should be fine.

    For Freehostia, there's no www, so just http://blah.freehostia.com - that fixes the site non-existent error. The next one is it appears you haven't uploaded the file to it or not to the right area as going to your sites homepage opens up the directory (as you have no index page) and it doesn't show any files in it.
    By reading this signature you agree that mixster is superior to you in each and every way except the bad ways but including the really bad ways.

  4. #4
    Join Date
    Aug 2008
    Location
    Finland
    Posts
    2,851
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    try this
    SCAR Code:
    procedure VerCheck;
    var
      Version : string;

    begin
      Version:= Between('[ver]', '[/ver]', GetPage('http://www.learnsomething.freehostia.com\Version.txt'));
      if (not(Version = Ver)) then
      begin
        WriteLn('');
        WriteLn('Your version is not the latest. Get the latest BETA version from');
        WriteLn('http://www.villavu.com/forum/showthread.php?p=587620#post587620');
        WriteLn('');
        TerminateScript;
      end;
      Wait(5000);
    end;
    and add [ ver]0.5[ /ver] to your file

  5. #5
    Join Date
    Dec 2006
    Location
    Sydney, New South Wales, Australia
    Posts
    4,603
    Mentioned
    15 Post(s)
    Quoted
    42 Post(s)

    Default

    Maybe because the file doesn't exist? And that you're not supposed to have a back slash in the URL (methinks).
    You may contact me with any concerns you have.
    Are you a victim of harassment? Please notify me or any other staff member.

    | SRL Community Rules | SRL Live Help & Chat | Setting up Simba | F.A.Q's |

  6. #6
    Join Date
    Aug 2007
    Location
    in a random little world
    Posts
    5,778
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

  7. #7
    Join Date
    May 2007
    Location
    England
    Posts
    4,140
    Mentioned
    11 Post(s)
    Quoted
    266 Post(s)

    Default

    Version.txt does exist. I'm going to try what mixter said.
    <3

    Quote Originally Posted by Eminem
    I don't care if you're black, white, straight, bisexual, gay, lesbian, short, tall, fat, skinny, rich or poor. If you're nice to me, I'll be nice to you. Simple as that.

  8. #8
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    First of all you need to use an extended.

    Then you do Version := StrToFloatDef(GetPage('blahblah'), 0);

    Then do if Version > Ver then ...

    Also, for Freehostia subdomains you do not need a www. That goes for any site with a subdomain.

  9. #9
    Join Date
    Oct 2006
    Location
    ithurtsithurtsithurtsithurts
    Posts
    2,930
    Mentioned
    7 Post(s)
    Quoted
    135 Post(s)

    Default

    Quote Originally Posted by Da 0wner View Post
    First of all you need to use an extended.

    Then you do Version := StrToFloatDef(GetPage('blahblah'), 0);

    Then do if Version > Ver then ...

    Also, for Freehostia subdomains you do not need a www. That goes for any site with a subdomain.
    He doesn't need to do that. Both Version and Ver are strings. Anyway, assuming the file exists (which it doesn't when attempting to browse to it), this should work:
    SCAR Code:
    procedure VerCheck;
    var
      Version : string;

    begin
      Version:= GetPage('http://learnsomething.freehostia.com/Version.txt');
      if (Version <> Ver) then
      begin
        WriteLn('');
        WriteLn('Your version is not the latest. Get the latest BETA version from');
        WriteLn('http://www.villavu.com/forum/showthread.php?p=587620#post587620');
        WriteLn('');
        TerminateScript;
      end;
      Wait(5000);
    end;

  10. #10
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    True, but in general, it is always best to use extendeds. You shouldn't compare strings even if it may give the same result. Sometimes it may result in something different and not always correct.

    Anyways, what Senrath posted would work, but I still advise to use floats .

  11. #11
    Join Date
    Oct 2006
    Location
    ithurtsithurtsithurtsithurts
    Posts
    2,930
    Mentioned
    7 Post(s)
    Quoted
    135 Post(s)

    Default

    Quote Originally Posted by Da 0wner View Post
    True, but in general, it is always best to use extendeds. You shouldn't compare strings even if it may give the same result. Sometimes it may result in something different and not always correct.

    Anyways, what Senrath posted would work, but I still advise to use floats .
    Huh? Comparing strings is perfectly fine.

  12. #12
    Join Date
    Dec 2008
    Posts
    2,813
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Why is it bad to compare strings? :/

  13. #13
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Someone (dev, admin, or something) once told me that it was better to compare integers/extendeds.

  14. #14
    Join Date
    Oct 2006
    Location
    ithurtsithurtsithurtsithurts
    Posts
    2,930
    Mentioned
    7 Post(s)
    Quoted
    135 Post(s)

    Default

    Quote Originally Posted by Da 0wner View Post
    Someone (dev, admin, or something) once told me that it was better to compare integers/extendeds.
    Well, until I'm told a specific reason for why it's better to use integers and/or extendeds (other than possibly a speed increase), I'm gonna stick with strings.

  15. #15
    Join Date
    Dec 2006
    Location
    Sydney, New South Wales, Australia
    Posts
    4,603
    Mentioned
    15 Post(s)
    Quoted
    42 Post(s)

    Default

    Quote Originally Posted by senrath View Post
    Well, until I'm told a specific reason for why it's better to use integers and/or extendeds (other than possibly a speed increase), I'm gonna stick with strings.
    Ok, try this:
    pascal Code:
    const
      Ver = '3';
      Version = '3.0';

    begin
      if(Ver = Version) then
        Writeln('Wow! Strings do work when combining with extra letters');
      if(StrToFloat(Ver) = StrToFloat(Version)) then
        Writeln('I knew this would work anyhow xD');
    end.
    Got my point?
    You may contact me with any concerns you have.
    Are you a victim of harassment? Please notify me or any other staff member.

    | SRL Community Rules | SRL Live Help & Chat | Setting up Simba | F.A.Q's |

  16. #16
    Join Date
    Oct 2006
    Location
    ithurtsithurtsithurtsithurts
    Posts
    2,930
    Mentioned
    7 Post(s)
    Quoted
    135 Post(s)

    Default

    Quote Originally Posted by Dan's The Man View Post
    Ok, try this:
    pascal Code:
    const
      Ver = '3';
      Version = '3.0';

    begin
      if(Ver = Version) then
        Writeln('Wow! Strings do work when combining with extra letters');
      if(StrToFloat(Ver) = StrToFloat(Version)) then
        Writeln('I knew this would work anyhow xD');
    end.
    Got my point?
    Well, yes, but if that's the biggest problem to worry about with string comparisons, then it's really no problem. Especially since I LIKE using things like that. For instance, in past (non-SCAR) projects, I have had versions 1.1 and 1.10. 1.10 was the 11th version, while 1.1 was the 1st. Using your comparison, they would've been found equal, when they weren't.

  17. #17
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Use 1.01-1.10 .

  18. #18
    Join Date
    May 2007
    Location
    England
    Posts
    4,140
    Mentioned
    11 Post(s)
    Quoted
    266 Post(s)

    Default

    Anyway, the version checker is working now. Check it out in the my in Members section.
    <3

    Quote Originally Posted by Eminem
    I don't care if you're black, white, straight, bisexual, gay, lesbian, short, tall, fat, skinny, rich or poor. If you're nice to me, I'll be nice to you. Simple as that.

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
  •