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 14145 times)

0 Members and 1 Guest are viewing this topic.

topsy99

    Topic Starter


    Beginner

    gwbasic to vb
    « on: April 05, 2012, 10:26:04 PM »
    i have a gwbasic program that i need re written in vbasic but can do it myself is there anyone who could do it for me.
    it is short.

    topsy99

      Topic Starter


      Beginner

      Re: gwbasic to vb
      « Reply #1 on: April 05, 2012, 11:08:06 PM »
      i have screen capture of this gwbasic program only about 30 lines but dont know how to post it.

      Geek-9pm


        Mastermind
      • Geek After Dark
      • Thanked: 1026
        • Gekk9pm bnlog
      • Certifications: List
      • Computer: Specs
      • Experience: Expert
      • OS: Windows 10
      Re: gwbasic to vb
      « Reply #2 on: April 06, 2012, 12:04:23 AM »
      Is this is because you:
      A. Want to play the game as it is.
      B. Want to see if it works better in Visual Basic.

      Games written in GW -BAISC work best in the same.

      You should be able to LIST the game program send to a file.
      (I used to know how to do that.)


      Salmon Trout

      • Guest
      Re: gwbasic to vb
      « Reply #3 on: April 06, 2012, 12:22:19 AM »
      i have screen capture of this gwbasic program only about 30 lines but dont know how to post it.

      Save the proram on a floppy in ASCII format, then put the floppy in a Windows computer, open the program text in Notepad, and finally copy and paste the program text here.

      Anyhow, what does it do?

      topsy99

        Topic Starter


        Beginner

        Re: gwbasic to vb
        « Reply #4 on: April 06, 2012, 02:24:19 AM »
        the program adds up figures in a dat file.  gwbasic wont work in 64 bit but would like it to do so. so needs to be in vb or perl.
        i cant write either but did write the original gwbasic. it is small. i cant open it

        [year+ old attachment deleted by admin]

        topsy99

          Topic Starter


          Beginner

          Re: gwbasic to vb
          « Reply #5 on: April 06, 2012, 02:27:52 AM »
          this posting is part of it the rest is here.     this is a handy program that i use regularly but now i have to use two computers to research.  i know it is old buyt used to do all my programming in gw basic. but got to old to manage the smarter stuff.   vb or perl would be great if any one can do it. dont want to break any rules but could always send a christmas card for a working version.
           64 bit doesnt allow gw basic      when i bought my computer it was set up in 64 bit and didnt realise gwbasic wouldnt work.


          [year+ old attachment deleted by admin]

          topsy99

            Topic Starter


            Beginner

            Re: gwbasic to vb
            « Reply #6 on: April 06, 2012, 02:29:36 AM »
            it is only small  not a games programming but for text reading and adding up.

            Salmon Trout

            • Guest
            Re: gwbasic to vb
            « Reply #7 on: April 06, 2012, 02:50:47 AM »
            Not many people (a) understand GW-BASIC and (b) know Perl and (c) will enjoy squinting at those screen dumps and retyping your program. You are much more likely to get an answer if you post the program as copiable/pastable text. If you can LIST it, you can save it as ASCII. SAVE "progname",A saves the file progname in ASCII format. So type SAVE "MYPROG.BAS",A and then get the program text in an editor such as Notepad and copy and paste it in your next post. I am willing to try to create a Cscript version if you do what I have suggested.


            topsy99

              Topic Starter


              Beginner

              Re: gwbasic to vb
              « Reply #8 on: April 06, 2012, 03:10:48 AM »
              it is quite readable if you double clik on them. i cant lift the text off the interpreter with copy or printing with notepad.
              will try your suggestion and come back to you

              topsy99

                Topic Starter


                Beginner

                Re: gwbasic to vb
                « Reply #9 on: April 06, 2012, 03:17:55 AM »
                10 INPUT "filename ";ME$
                20 DIM X$(3900),A$(4900)
                30 INPUT "Search Name or XXX to end";S$
                40 R(I) =0
                50 IF S$="xxx" THEN END
                60 OPEN "i",#1,ME$
                70 IF EOF(1) THEN 230
                80 INPUT#1,A$(I)
                90 Q=Q+1
                100 IF LEFT$(A$(I),LEN(S$)) < > S$ THEN 220
                110 PRINT A$(I),Q
                120 X$= RIGHT$(A$(I),1)
                130 J = VAL(X$)
                133 F$=LEFT$(A$(I),9)
                140 Y$=RIGHT$(A$(I),2)
                145 E = E+1
                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
                200 PRINT R(I),E
                210 N=N+1
                220 GOTO 70
                230 CLOSE#1
                232 PRINT F$,R(I)
                235 E=0
                240 GOTO 30
                

                there we go     hope someone can help.

                Salmon Trout

                • Guest
                Re: gwbasic to vb
                « Reply #10 on: April 06, 2012, 03:20:52 AM »
                What is it supposed to do? Some comments (REMs) would be nice. Also an example input file.



                topsy99

                  Topic Starter


                  Beginner

                  Re: gwbasic to vb
                  « Reply #11 on: April 06, 2012, 03:46:38 AM »
                  sample data  from the actuall  dat file

                  "arena(good)(2000)(randwick)27-09-98)2"
                  "sharscay(good)(2000)(randwick)27-09-98)5"
                  "yippyio(good)(2000)(randwick)27-09-98)6"
                  "turridu(good)(2000)(randwick)27-09-98)6"
                  "sunline(good)(1600)(randwick)27-09-98)1"
                  "camarena(good)(1600)(randwick)27-09-98)2"
                  "confer(good)(1600)(randwick)27-09-98)2"
                  "dodge(good)(1600)(randwick)27-09-98)1"
                  "super slew(good)(1600)(randwick)27-09-98)2"
                  "iron horse(good)(1600)(randwick)27-09-98)2"
                  "sedation(dead)(1417)(flemington)27-09-98)7"
                  "mossman(dead)(1417)(flemington)27-09-98)8"
                  "cooktown(dead)(1417)(flemington)27-09-98)8"
                  "aerosmith(dead)(2000)(flemington)27-09-98)3"
                  "gold guru(dead)(2000)(flemington)27-09-98)4"
                  "our unicorn(dead)(2000)(flemington)27-09-98)4"
                  "inaflury(dead)(1625)(flemington)27-09-98)3"
                  "rose of dane(dead)(1625)(flemington)27-09-98)4"
                  "astralita(dead)(1625)(flemington)27-09-98)4"
                  "rebel(dead)(1200)(flemington)27-09-98)5"
                  "dantelah(dead)(1200)(flemington)27-09-98)6"
                  "classic day(dead)(1200)(flemington)27-09-98)6"
                  "our dynamic lady(dead)(1417)(flemington)27-09-98)5"
                  "cannyanna(dead)(1417)(flemington)27-09-98)6"
                  "misomai(dead)(1417)(flemington)27-09-98)6"
                  "pepinello(good)(1200)(belmont)27-09-98)7"
                  "kim angel(good)(1200)(belmont)27-09-98)8"
                  "bar screamer(good)(1200)(belmont)27-09-98)8"
                  "chamoix(good)(1600)(morphettville)27-09-98)7"


                  the gwbasic program checks for a name and the number of times it appears and deducts the end number from 9 and adds it up and prints a final name and total score.
                  in some case the number has an a or b attached which program  then checks the second last character on the end.


                  the data in the dat file is created and appended by a different gw-basic file.

                  topsy99

                    Topic Starter


                    Beginner

                    Re: gwbasic to vb
                    « Reply #12 on: April 06, 2012, 03:50:21 AM »
                    5 rem input "horse.dat"
                    10 INPUT "filename ";ME$
                    20 DIM X$(3900),A$(4900)
                    25 rem  input horse name to search
                    30 INPUT "Search Name or XXX to end";S$
                    40 R(I) =0
                    50 IF S$="xxx" THEN END
                    55  rem  open horse.dat
                    60 OPEN "i",#1,ME$
                    70 IF EOF(1) THEN 230
                    75   rem input names for checking if they exist
                    80 INPUT#1,A$(I)
                    90 Q=Q+1
                    100 IF LEFT$(A$(I),LEN(S$)) < > S$ THEN 220
                    110 PRINT A$(I),Q
                    120 X$= RIGHT$(A$(I),1)
                    130 J = VAL(X$)
                    133 F$=LEFT$(A$(I),9)
                    140 Y$=RIGHT$(A$(I),2)
                    145 E = E+1
                    150 Z=VAL(Y$)
                    155  rem   deducts end number from 9  e.g. 9 minus z
                    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
                    195 rem  horse name   and total score 
                    200 PRINT R(I),E
                    210 N=N+1
                    220 GOTO 70
                    230 CLOSE#1
                    232 PRINT F$,R(I)
                    235 E=0
                    240 GOTO 30


                    some  rems

                    Salmon Trout

                    • Guest
                    Re: gwbasic to vb
                    « Reply #13 on: April 06, 2012, 03:53:02 AM »
                    Oh, right it's for Oz horseracing.

                    topsy99

                      Topic Starter


                      Beginner

                      Re: gwbasic to vb
                      « Reply #14 on: April 06, 2012, 04:00:20 AM »
                      yes have been playing with it for years.   the idea is to record best performances and give them a number and then tally them . sort of to try to sort the wheat from the chaff if you forgive the pun.
                      have it automated in a perl program that does the searching and matching when doing race meetings but to do recreational research the gwbasic score program is invaluable but cant take it to windows 7 64 bit.  so am seeking some help.

                      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.

                                        Salmon Trout

                                        • Guest
                                        Re: gwbasic to vb
                                        « Reply #30 on: April 08, 2012, 04:09:41 AM »
                                        That last screen capture you posted has helped a lot, I've got a pretty good idea of what is needed now.

                                        topsy99

                                          Topic Starter


                                          Beginner

                                          Re: gwbasic to vb
                                          « Reply #31 on: April 08, 2012, 04:45:05 PM »
                                          it is relatively straight forward my programming probably messy but it worked.

                                          you put in a name it checks the dat file to see if it is there it adds the end number by taking from 9 and adds them together. e.g. the same name may be in there 20 times and it adds 20 numbers or it may not be there at all. etc.
                                          thanks for looking at it for me.
                                          regards

                                          topsy99

                                            Topic Starter


                                            Beginner

                                            Re: gwbasic to vb
                                            « Reply #32 on: April 10, 2012, 04:49:54 AM »
                                            any news.

                                            Salmon Trout

                                            • Guest
                                            Re: gwbasic to vb
                                            « Reply #33 on: April 11, 2012, 01:42:08 PM »
                                            Code: [Select]
                                            Const ForReading = 1
                                            Wscript.StdOut.Write "Please input Filename:     "
                                            FileName = Wscript.StdIn.ReadLine
                                            Do Until UCase(SearchHorseName)="XXX"
                                            Wscript.StdOut.Write "Search Name or XXX to end: "
                                            SearchHorseName = Wscript.StdIn.ReadLine
                                            e=0
                                            q=0
                                            R=0
                                            Set objFSO = CreateObject("Scripting.FileSystemObject")
                                            Set objInputFile = objFSO.OpenTextFile(FileName, ForReading)
                                            Do until objInputFile.AtEndofStream
                                            strHorseData = objInputFile.ReadLine
                                            q = q + 1
                                            strHorseData = Replace(strHorseData, Chr(34),"")
                                            If Left(strHorseData,LEN(SearchHorseName))=SearchHorseName Then
                                            wscript.echo strHorseData & " " & q
                                            Fstring = Left(Strhorsedata,9)
                                            strHorseData = Replace(strHorseData, ")(",",")
                                            strHorseData = Replace(strHorseData, "(",",")
                                            strHorseData = Replace(strHorseData, ")",",")
                                            ArrData=split(strHorseData,",")
                                            HorseName = ArrData(0)
                                            EndNumber = Val(ArrData(5))
                                            e=e+1
                                            If EndNumber > 0 Then EndNumber = 9- EndNumber
                                            R=R+EndNumber
                                            wscript.echo R & " " & e
                                            End If
                                            Loop
                                            objInputFile.Close
                                            wscript.echo Fstring & " " & R
                                            Loop
                                            Wscript.Quit

                                            Function Val(vValue)
                                            If len(vValue) = 0 then
                                            lResult = 0
                                            else
                                            if isnumeric(vValue) then
                                            lResult = cdbl(vValue)
                                            else
                                            lCount = 1
                                            do until (isnumeric(mid(vValue,lCount,1))=false) or (lCount > len(vValue))
                                            strResult = strResult & mid(vValue, lCount, 1)
                                            lCount = lCount + 1
                                            loop
                                            if len(strResult) = 0 then
                                            lResult = 0
                                            else
                                            lResult = cdbl(strResult)
                                            end if
                                            end if
                                            end if
                                            Val = lResult
                                            End Function

                                            save this as e.g. HorseAnalyse.vbs and run it like so from the prompt

                                            cscript //nologo HorseAnalyse.vbs

                                            The .dat file (e.g. Horse.dat) needs to be in the same folder

                                            Please give it a go and let me know if it works OK or if not what it does wrongly





                                            topsy99

                                              Topic Starter


                                              Beginner

                                              Re: gwbasic to vb
                                              « Reply #34 on: April 11, 2012, 05:08:21 PM »
                                              success. you are a genius.    I can do it now on windows 7 64 bit   (although i have only run on 32 bit vista so far.)  but you have done well.

                                              where can i send an easter card to.



                                              do you know that down here in Tasmania i dont know any programmers.  they seem to be scarce as hen's teeth.

                                              regards and very greatful to you.