Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: gwbasic to vb  (Read 14151 times)

0 Members and 1 Guest are viewing this topic.

Salmon Trout

  • Guest
Re: gwbasic to vb
« Reply #15 on: April 06, 2012, 04:07:22 AM »
If you have a 64 bit Windows I guess you have Wscript and Cscript? To check open a cmd prompt and type CSCRIPT /? (upper, lower, or mixed case!)



topsy99

    Topic Starter


    Beginner

    Re: gwbasic to vb
    « Reply #16 on: April 06, 2012, 04:11:25 AM »
    i got a response.  scriptname.extension.


    i think yes is the answere

    Salmon Trout

    • Guest
    Re: gwbasic to vb
    « Reply #17 on: April 06, 2012, 04:43:53 AM »
    You should see something like this...

    Code: [Select]
    C:\>cscript /?
    Usage: CScript scriptname.extension [option...] [arguments...]

    Options:
     //B         Batch mode: Suppresses script errors and prompts from displaying
     //D         Enable Active Debugging
     //E:engine  Use engine for executing script
     //H:CScript Changes the default script host to CScript.exe
     //H:WScript Changes the default script host to WScript.exe (default)
     //I         Interactive mode (default, opposite of //B)
     //Job:xxxx  Execute a WSF job
     //Logo      Display logo (default)
     //Nologo    Prevent logo display: No banner will be shown at execution time
     //S         Save current command line options for this user
     //T:nn      Time out in seconds:  Maximum time a script is permitted to run
     //X         Execute script in debugger
     //U         Use Unicode for redirected I/O from the console

    topsy99

      Topic Starter


      Beginner

      Re: gwbasic to vb
      « Reply #18 on: April 06, 2012, 04:49:38 AM »
      yes   thats correct  i got all that.

      Salmon Trout

      • Guest
      Re: gwbasic to vb
      « Reply #19 on: April 06, 2012, 11:53:38 AM »
      I have to say that the GW-BASIC code is somewhat strange: I think I have managed to puzzle most of it out. I don't quite see why you declare two string arrays: X$, and A$, with sizes of 3900 and 4900 respectively, but you only ever use the first element (0) of each one (e.g. you read the each file line in turn into A$(I) and I is never assigned a value so is zero by default)  You also have an numerical array called R which is never declared but you only ever use R(I). Luckily GW-BASIC is forgiving about unassigned variables (they are deemed to be single precison and value zero) and undimensioned arrays (gives them 10 elements). Also, there is a variable N which I don't think is used for anything, though it is dutifully incremented once around each loop.

      I can't quite get my head around what this is meant to do

      Code: [Select]
      120 X$= RIGHT$(A$(I),1)
      130 J = VAL(X$)

      140 Y$=RIGHT$(A$(I),2)

      150 Z=VAL(Y$)
      160 IF Z>0 THEN Z=9-Z
      170 J = 9-J
      180 IF J = 9 THEN J = 0
      190 R(I) = R(I) +J+Z

      It looks like you are using VAL to coerce the substring X$ which is the last character of the input line into a numeric variable J, then the last 2 characters Y$ into numeric variable Z, then taking 9 away from Z (if it is greater than zero), and then doing the same to J (whatever its value) then finally adding them together. Could you help me understand the reason for this? Is this some kind of special score calculation?

      You see, while I am fairly experienced with GW-BASIC, I used it around 1985 - 1992, I know absolutely nothing about horseracey stuff like handicapping so I want to make sure I understand what is going on.


      topsy99

        Topic Starter


        Beginner

        Re: gwbasic to vb
        « Reply #20 on: April 06, 2012, 05:17:22 PM »
        horse racing is a purpose but the programming is really just a value assigned to the end of the name.  e.g. an 8 on the end or an 8a    the end number is subtracted from 9 which leaves 1   going through the program by a particular name it identifies the name and the number on the end and subtracts from 9 and adds up the total e.g. 1 + 4 + 3 equals 8   

        in my earlier post i suggested i can do myself.  i cannot do it myself in any other language.

        in the case of where there is an a or b it has to check the val(i) of the second last character so this is where the messy stuff comes in.
        also i learned basic from the microsoft gwbasic book so am self taught and getting it to run was an achievement. this one does what it is supposed to do but it needs updating.
        so the right$ a$(i),2) etc is because of this.  so cant vouch for the quality of programming but it goes through the search and adds up by subtracting the end figure from 9.

        Salmon Trout

        • Guest
        Re: gwbasic to vb
        « Reply #21 on: April 07, 2012, 01:30:07 AM »
        i learned basic from the microsoft gwbasic book

        I had that book! It weighed a ton. Don't get me wrong, I wasn't criticising; I think what you wrote does you credit. One more question...

        Code: [Select]
        133 F$=LEFT$(A$(I),9)

        232 PRINT F$,R(I)

        After going through the dat file, the program prints the first 9 chars of the last line it read, follwed by the total score. THose 9 chars... is that meant to be part or all of the horses name? Why 9?


        topsy99

          Topic Starter


          Beginner

          Re: gwbasic to vb
          « Reply #22 on: April 07, 2012, 02:12:01 AM »
          sorry cant remember why i is left$   9   think it might have been just to tidy up the final print line and total.


          the 9 in the 9 minus last digit is just a value i allocate to the races e.g. highest class scores 8 points lowest 1 point.

          sorry cant be much more help than that.


          topsy99

            Topic Starter


            Beginner

            Re: gwbasic to vb
            « Reply #23 on: April 07, 2012, 02:31:54 AM »
            please ask more questions. sorry didnt mean to say couldnt be more help. i meant with the left$ 9  issue.


            re my programming  i used to do a lot of gwbasic programming but mainly little stuff like this. had a lot of fun with it.


            but down here in botom of tasmania our age group didnt allow participation in learning further . we were too old.

            regards

            Salmon Trout

            • Guest
            Re: gwbasic to vb
            « Reply #24 on: April 07, 2012, 02:49:06 AM »
            What I am getting at is - what do you expect to see on the screen after a run?

            topsy99

              Topic Starter


              Beginner

              Re: gwbasic to vb
              « Reply #25 on: April 07, 2012, 03:20:57 AM »
              give me a minute. wil have to put up another screen shot.  please double click it.

              topsy99

                Topic Starter


                Beginner

                Re: gwbasic to vb
                « Reply #26 on: April 07, 2012, 03:38:58 AM »
                this is the output and then is ready for anothe rinput

                [year+ old attachment deleted by admin]

                topsy99

                  Topic Starter


                  Beginner

                  Re: gwbasic to vb
                  « Reply #27 on: April 08, 2012, 03:06:52 AM »
                  any thoughts .

                  Salmon Trout

                  • Guest
                  Re: gwbasic to vb
                  « Reply #28 on: April 08, 2012, 03:09:46 AM »
                  I am about 3/4 done writing a VBScript, but I was a bit busy yesterday what with it being Easter weekend and the washing machine is busted but hang in there...

                  topsy99

                    Topic Starter


                    Beginner

                    Re: gwbasic to vb
                    « Reply #29 on: April 08, 2012, 03:20:25 AM »
                    sorry pleased you are trying something. i appreciate your interest. some rain down here at last. best wishes.