91
on: April 18, 2012, 07:28:01 pm
|
Started by johbu151 - Last post by GarrisonRicketson
|
QB64 /run smcam_v3.bas /L QWADV.QLB /AH Have you just tried it, from the IDE, ?, Simpley compile the .bas. QWADV.QLB, This may be some kind of library, or ? not sure, and less on the /L, I have never tried running qb64 from the command line, and have no clue what the /L is, nor the /AH, it may be that the QWADV.QLB needs to be converted to a .bi, or some sort of library that qb64 uses. I use LINUX Mint, so I can't tell you much, on the command line syntex,..my thoughts are that it sees the /L QWADV.QLB as the file name, have you tried it with out the switch, this is just a quess, but I am thinking, it loooks for a file named L QWADV.BLB, and there is none,... I don't believe a .bas file can be run that way, from the command line, I am going to see if anyone at the qb64.net, will look at this, and see what they say, to be honest some of it is somewhat above my head, being that I do not use windows, nor have I ever tried using the 64 bit, versions,... The only thing I can suggest, maybe is , first compile the .bas, with qb64, from the IDE, (not the command line, ) When you compile it, qb64 will create a executable, named smcam_v3.exe ( usually, sometimes I have a problem with it leaving the .exe, named untitled.exe, in which case I have to rename it, so you may want to check that), If it compiles, with no errors, look for the newly created , smcam_v3.exe, it should be there in your qb64 folder,..( or untitled.exe ) It sounds to me like in your case, you will be best off , with your qb64 folder, being empty, no other, .bas or files, other then the ones needed for your program,...if you have a lot of files in your qb64 folder, temporaily move everything to another folder, that is to say everything except the files you are working with,.. the other way to go is , install qb64, to a new, empty folder, this is ok, one can have several, folders with qb64. OK, back to , """ smcam_v3.exe "", once you compile the .bas, and have your smcam_v3.exe , Try again running it from the command line, QB64 /run smcam_v3.exe/L QWADV.QLB /AH (((( The only change being smcam_v3.exe , instead of .bas,...)))) One last though, if any of these files are Visual Basic, then they will not work in qb64, but they wouldn't have worked in the 32 bit version either,.. that is the part that I find "odd", and also do not undertsand,... Sorry I am not being much help on this,...Is there any chance you can, make the files available, IE: put them on Drop Box, as a zipped package, ? My last suggestion, would be, try compileing something simple, in the IDE, first open the IDE, type in the code below, and run it. When you save the file, save it as helloworld.bas, PRINT " HELLO WORLD " after you have compiled, (run) it, look in your qb64 folder, and see if there is a helloworld.exe, there should be,...if not , look for untitled.exe, run it, it probably will be your helloworld, (test),.. OK, now, try running from the command line, QB64 /run helloworld.bas ,... I don't think it will "run", it may open the .bas file, but I don't think it will run it,.. Then try QB64 /run helloworld.exe , it should run, displaying the words HELLO WORLD , on your screen,.. There are some more, more complex examples, that come with QB64, in the QB64/Samples folder, try some of these, with the 64bit version, and then also try running them from the command line. I suggest this, to try to determine, if it is the code, or a "bug" with the 64 bit version, so lets see if some simple code compiles and runs, first,... You may have already tried this, I don't know,.. Then the next thing we need to figure out is, what the switches do, and what the QWADV.QLB is, and what it is for, ...I have never seen a .QLB file in qb64,...as far as that goes, I have never seen that suffix, in qb4.5, nor qbasic,...so I am thinking this is where the problem is. If so, then we would need to see the file, to see what changes need to be made,. My guess is , it is some kind of Library file, for the LB, in which case probably that needs to be re written, , some thing way above my head, but like I said, I am going to see if I can get some help on this,.. from Garry
|
92
on: April 18, 2012, 08:34:15 am
|
Started by johbu151 - Last post by johbu151
|
Thanks for the response Garry. If it helps, apparently this program hasn't been compiled into an executable. It's actually run with the following command line syntax:
"QB /run smcam_v3.bas /L QWADV.QLB /AH"
I honestly don't understand the impact of things after the /L parameter, but I figured at a minimum, I should be able to run QB64 stand-alone and open the SMCAM_V3.BAS program and view the code. When I do this with the 32-bit QB, the file opens fine and I can read it. When I open the exact same file with the 64-bit version, I get all the jumbled ASCII character stuff. I can also open that file in Windows notepad and read it just fine, so it appears all of the .BAS files in my folder are plain-text. I figured that would be enough of a starting point for someone to tell me what kind of situation I have on my hands. When I extracted the 64-bit setup, I simply copied all of the files from my 32-bit folder right into the root of the 64 bit folder, and nothing was prompted for overwrite. Therefore, there wouldn't be any missing dependencies or anything like that.
I tried running the 64-bit command line option like above: "QB64 /run smcam_v3.bas /L QWADV.QLB /AH", but I am getting a "File Not Found", even though all supporting files are available. In 32-bit, I do not get this error and the program appears to launch fine. Does this lead you to any other ideas?
|
93
on: April 17, 2012, 09:14:25 pm
|
Started by johbu151 - Last post by GarrisonRicketson
|
Do I need to "recompile" the 32-bit .BAS files or anything so that they can be modified/executed with QB64? From what I understand , you shouldn't be having this problem, I would try the above first, open the original .bas files, and make sure they appear ok,.. you can use a text editer, also. In fact, it might be a good idea to make copys, and save those, as .txt files, then llok at the file and code, if it appears to be ok, just paste it into the 64 bit qb64 ide, and "run" it to re-compile, so that the execitable has been compiled with the 64 bit version, This was a recent discussion , on the same subject. http://www.qb64.net/forum/index.php?topic=5796.0 With the app files ( executable), the ones compiled with the 32 bit version, would need, ( be dependent) on the DLL files, of the 32 bit version also,.. so you would need to copy those to the same folder, where you are trying to run them from,... I suspect that this is what the problem is,.. I would try recompiling them first, see what you get, the fact that originaly made with qb4.5, may complicate this some what, because that is actually intended for Dos, however many of the .bas files that were used in qb4.5, do compile fine with the qb64 32 bit version, some of the commands have changed , a little, though too,.. So if you get errors, especially illegal functions, or syntax errors,.. you may need to make some adjustments,.. At http://www.qb64.net there are more active members, a few that have a lot of experience with this, as they have been working with qbasic, right from the start, to qb4.5, and then to the current qb64 versions, and Galleon, the author of qb64, is also available there. Please let us know how this turns out,.. Oh , and also welcome to the forum, from Garry
|
94
on: April 17, 2012, 01:12:58 pm
|
Started by johbu151 - Last post by johbu151
|
Having no experience with QB whatsoever, I am attempting to help someone with a 32-bit 4.5 QB application migrate to a 64-bit environment. Everything for the application is contained in a single folder, including all programs and QB components. Attempting to run the 32-bit programs in my separate 32-bit environment works fine. I have downloaded the 64 bit version of QB, and copied the 32-bit app files into the new folder. However, when I launch QB64 and attempt to open the 32-bit .BAS file to look at/run the code, all I get is a mess of jumbled/random characters.
Do I need to "recompile" the 32-bit .BAS files or anything so that they can be modified/executed with QB64?
Thanks for any help you can provide, Sean
|
96
on: April 13, 2012, 08:54:36 pm
|
Started by GarrisonRicketson - Last post by GarrisonRicketson
|
Auto play Sound then auto exit You can play a wav file, for sound using this. REM DEFLNG A-Z
wav1& = _SNDOPEN("anywavfile.wav", "sync,vol") _SNDVOL wav1&, 0.9 t1 = _FREETIMER ON TIMER(t1, 10) GOSUB Finish 'the "10" is 10 seconds TIMER(t1) ON PRINT "This is my wav sound or music""
DO IF NOT _SNDPLAYING(wav1&) THEN _SNDPLAY wav1& END IF LOOP WHILE Done = 0
TIMER(t1) OFF TIMER(t1) FREE _SNDSTOP wav1& _SNDCLOSE wav1& SLEEP 1 SYSTEM
Finish: Done = 1 RETURN Use any WAV file,where it says, "anywavfile.wav" The wav will continue to be played until on timer auto end is reached. Be sure to change the name to the name of the file you use, Also the file must be in the same folder as QB64. ______________----__________________________---___-------- Garry mentioned MIDI tunes & I remembered Barry Taylor who produced some 500 MIDI works of high quality. He did the traditional music of England, Scotland, Ireland, Canada, America... Link is: http://www.contemplator.com/tunebook/A lot of MIDI stuff is rather stilted and lacking in feeling but this is good stuff because Barry Taylor has the gift. --Quark
|
97
on: April 13, 2012, 07:24:13 pm
|
Started by GarrisonRicketson - Last post by GarrisonRicketson
|
Your IP,EMAIL and usernames, are checked, http://www.stopforumspam.com/ If you are a listed spammer, then you are NOT welcome here, so you will be banned , deleted, and put in the garbage can,...and any posts that are spam, are fully reported, and the "spammer" added to the list.
|
98
on: April 12, 2012, 07:17:41 pm
|
Started by GarrisonRicketson - Last post by GarrisonRicketson
|
This is a game, where the player is a Hawk, and you try to catch a little Bunny that runs back and forth, at the bottom of the screen,.. DEFINT A-Z gamescreen& = _NEWIMAGE(800, 600, 32) SCREEN gamescreen&
PRINT "Welcome to Catch the Bunny, use arrow keys move hawk" PRINT "Mouse works , left button capture , right button release" PRINT " Ctrl key captures, alt key releases, try to drop the bunny into the nest" PRINT "if you get him lined up just right he will not fall back to the ground." PRINT " Hit any key to start" PRINT "Escape key to quit"
'* constants relating to current bunny state -- easier than remembering numbers! CONST BunnyStateNormal = 1 CONST BunnyStateCaptured = 2 CONST BunnyStateReleased = 3 CONST BunnyMaxRangeY = 550 limitfps% = 32 bunnymaxsp% = 100 * limitfps% '*pixels/sec bunnydirection% = 1 bunnyspeed% = bunnymaxsp% / limitfps% BunnyWidth% = 16 BunnyHeight% = 16 Background& = _LOADIMAGE("Hawksnest.bmp") 'create the background page
'Create the Hawk and rabbit sprites from data. CreateSpriteFromData Hawk&, 23, 23 CreateSpriteFromData Bunny&, 16, 16
'------ The source co-ordinates for putimages ---------------------------------------- bwidth& = _WIDTH(Bunny&) bheight& = _HEIGHT(Bunny&) sbx1 = 0: sby1 = 0: sbx2 = bwidth& - 1: sby2 = bheight& - 1 hwidth& = _WIDTH(Hawk&) hheight& = _HEIGHT(Hawk&) shx1 = 0: shy1 = 0: shx2 = hwidth& - 1: shy2 = hheight& - 1 '-------------------------------------------------------------------------------------
DIM HawkX AS INTEGER, HawkY AS INTEGER DIM BunnyX AS INTEGER, BunnY AS INTEGER
'* in the same order as unseenmachine's MOUSE record type DIM Mx AS INTEGER '* current mouse cursor x DIM My AS INTEGER '* current mouse cursor y DIM LMB AS INTEGER '* current mouse left button pressed DIM RMB AS INTEGER '* current mouse right button pressed DIM MWH AS INTEGER '* current mouse wheel accumulator '*********
bunnystart# = TIMER(.001) bunnydirection% = 1 hawkdirection% = 1 '<-- added this BunnyStartx% = 0 RabbitState% = BunnyStateNormal '* 1<-- added this Capture = 0 '<-- added this Release = 0 '<-- added this BunnyY = BunnyMaxRangeY '<-- added this Pink& = _RGB32(255, 0, 255) '<-- added this '_MOUSEHIDE '* don't show the mouse cursor For slow mouse you need to see the mouse cursor
Dummy$ = INPUT$(1) _FULLSCREEN DO GetMouse Mx, My, LMB, RMB, MWH '******************************************************** 'rabbit state SELECT CASE RabbitState% CASE BunnyStateNormal '* normal IF BunnyX >= _WIDTH(0) - BunnyWidth% * 2 THEN '* BunnyWidth% is width of bunny image bunnydirection% = -bunnydirection% BunnyStartx% = BunnyX - 1 bunnystart# = TIMER(.001) ELSEIF BunnyX < 0 THEN 'heading east bunnydirection% = -bunnydirection% BunnyStartx% = BunnyX + 1 bunnystart# = TIMER(.001) END IF BunnyX = BunnyStartx% + bunnydirection% * bunnyspeed% * (TIMER(.001) - bunnystart#) CASE BunnyStateCaptured '* captures BunnyX = HawkX + Xdifference + 14: BunnyY = HawkY + bheight& + Ydifference + bheight& CASE BunnyStateReleased '* released BunnyY = BunnyY + 2 IF BunnyX >= 40 AND BunnyX <= 55 THEN IF BunnyY >= 240 AND BunnyY <= 246 THEN _DELAY 1 Capture = 0: Release = 0: RabbitState% = 1 bunnystart# = TIMER(.001) bunnydirection% = 1 BunnyStartx% = 0 BunnyY = 550 END IF END IF IF BunnyY >= 550 THEN BunnyY = 550 Capture = 0: Release = 0: RabbitState% = 1 bunnystart# = TIMER(.001) bunnydirection% = 1 BunnyStartx% = 0 END IF END SELECT '******************************************************** 'Keyboard/Mouse input here to update hawk posisiton 'Slow the Mouse routine,have to show the mouse cursor for this to work GetMouse miceX, miceY, HawkLmb, hawkRmb, hawkWheel IF HawkX > miceX THEN HawkX = HawkX - 4: hawkdirection% = -1 'make them 8 for faster movement IF HawkX < miceX THEN HawkX = HawkX + 4: hawkdirection% = 1 IF HawkY > miceY THEN HawkY = HawkY - 4 IF HawkY < miceY THEN HawkY = HawkY + 4 'make them 2 for less movement
'* changed from non-executed code -- acted funny with mouse (not anymore using sdl_warpmouse) IF _KEYDOWN(20480) THEN HawkY = HawkY + 4 'down arrow key IF _KEYDOWN(18432) THEN HawkY = HawkY - 4 'up arrow key IF _KEYDOWN(19200) THEN ' left arrow key HawkX = HawkX - 4: hawkdirection% = -1 HawkControlPressed% = 1 END IF IF _KEYDOWN(19712) THEN ' right arrow key HawkX = HawkX + 4: hawkdirection% = 1 HawkControlPressed% = 1 END IF
BunnycentreX% = BunnyX + bwidth& BunnycentreY% = BunnyY + bheight&
IF _KEYDOWN(100305) OR _KEYDOWN(100306) OR HawkLmb THEN 'control keys + Lmice button=capture IF RabbitState% = 1 THEN IF HawkX + 14 <= BunnycentreX% AND HawkX + 30 >= BunnycentreX% THEN IF HawkY + 30 <= BunnycentreY% AND HawkY + 40 >= BunnycentreY% THEN PLAY "mb a10b10g10" Capture = 1: RabbitState% = 2 Xdifference = HawkX - BunnyX: Ydifference = HawkY - BunnyY END IF END IF END IF END IF IF _KEYDOWN(100307) OR _KEYDOWN(100308) OR hawkRmb THEN 'alternate keys + Rmice button=release IF RabbitState% = 2 THEN PLAY "mb a10g10e10g10a10ba" Release = 1: Capture = 0: RabbitState% = 3 END IF END IF IF _KEYDOWN(32) THEN Debug = 1 ELSE Debug = 0 'used to show boundary box (collision test) '******************************************************** 'Hawk top and side collision tests IF HawkX >= _WIDTH(0) - (hwidth& * 2) THEN HawkX = _WIDTH(0) - (hwidth& * 2) ELSEIF HawkX < 0 THEN HawkX = 1 END IF IF HawkY >= _HEIGHT(0) - (hheight& * 2) THEN HawkY = _HEIGHT(0) - (hheight& * 2) ELSEIF HawkY < 0 THEN HawkY = 1 END IF
'******************************************************** 'Draw a background _PUTIMAGE , Background&, 0
'Draw the rabbit IF bunnydirection% = 1 THEN _PUTIMAGE (BunnyX, BunnyY)-(BunnyX + 31, BunnyY + 31), Bunny&, 0, (sbx1, sby1)-(sbx2, sby2) ELSE _PUTIMAGE (BunnyX, BunnyY)-(BunnyX + 31, BunnyY + 31), Bunny&, 0, (sbx2, sby1)-(sbx1, sby2) END IF
'Draw the hawk IF hawkdirection% = 1 THEN _PUTIMAGE (HawkX, HawkY)-(HawkX + (hwidth& * 2) - 1, HawkY + (hheight& * 2) - 1), Hawk&, 0, (shx1, shy1)-(shx2, shy2) ELSE _PUTIMAGE (HawkX, HawkY)-(HawkX + (hwidth& * 2) - 1, HawkY + (hheight& * 2) - 1), Hawk&, 0, (shx2, shy1)-(shx1, shy2) END IF IF Debug = 1 THEN LINE (HawkX + 14, HawkY + 32)-(HawkX + 30, HawkY + 36), Pink&, B
_DISPLAY _LIMIT limitfps% CLS
LOOP UNTIL _KEYDOWN(27) SLEEP SCREEN 0 _FREEIMAGE Bunny& _FREEIMAGE Hawk& _FREEIMAGE Background& _FREEIMAGE gamescreen& SYSTEM
'----------------------------------------------- SUBS ------------------------------------------------------------------------ SUB CreateSpriteFromData (ImageHandle&, XSize%, YSize%) '// Store the current DESTintation in a LONG handle so we can restore it later. OldDest& = _DEST
'// Create a new 32 bit image. ImageHandle& = _NEWIMAGE(XSize%, YSize%, 32)
'//Change the DESTination to the new image. _DEST ImageHandle& FOR YP% = 0 TO YSize% FOR XP% = 0 TO XSize% '// Read the color value for the pixel. READ Sprite% IF Sprite% > 0 THEN IF Sprite% = 8 THEN clr& = _RGB(240, 120, 120) IF Sprite% = 15 THEN clr& = _RGB(255, 255, 255) '// PSET the color onto the newimage PSET (XP%, YP%), clr& END IF NEXT NEXT '// Restore the original destination. _DEST OldDest& END SUB
SUB GetMouse (GetMouseMx%, GetMousemy%, GetMouseLMB%, GetMouseRMB%, GetMouseMWH%) '* this method is the most accurate way to read the mouse i know -- always guaranteed to make at least one read of the mouse DO GetMouseMx% = _MOUSEX GetMousemy% = _MOUSEY GetMouseLMB% = _MOUSEBUTTON(1) GetMouseRMB% = _MOUSEBUTTON(2) GetMouseMWH% = _MOUSEWHEEL LOOP WHILE _MOUSEINPUT END SUB
' Bitmap for the Hawk sprite DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 DATA 8,8,8,8,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,8,8,8,8 DATA 0,0,8,8,8,8,8,0,0,0,0,0,0,0,0,0,0,8,8,8,8,8,0,0 DATA 0,0,0,0,0,8,8,8,8,0,0,0,0,0,0,0,8,8,8,8,0,0,0,0 DATA 0,0,0,0,0,0,8,8,8,8,8,8,0,0,8,8,8,8,8,0,0,0,0,0 DATA 0,0,0,0,0,0,0,0,8,8,8,8,8,8,8,8,8,0,0,0,0,0,0,0 DATA 0,0,0,0,0,0,0,0,0,0,8,8,8,8,8,8,0,0,0,0,0,0,0,0 DATA 0,0,0,0,0,0,0,8,8,8,8,8,8,8,8,8,0,0,0,0,0,0,0,0 DATA 8,8,8,8,8,8,8,8,8,8,8,8,8,8,1,8,0,0,0,0,0,0,0,0 DATA 0,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,0,0,0,0,0,0,0,0 DATA 0,0,8,8,8,8,0,8,8,8,8,8,8,8,8,8,8,0,0,0,0,0,0,0 DATA 0,0,8,8,0,0,0,8,8,8,8,8,8,0,0,0,8,0,0,0,0,0,0,0 DATA 0,0,8,0,0,0,0,8,8,8,8,8,0,0,0,0,0,0,0,0,0,0,0,0 DATA 0,0,0,0,0,0,0,8,8,8,8,8,0,0,0,0,0,0,0,0,0,0,0,0 DATA 0,0,0,0,0,0,8,8,8,8,8,8,8,0,0,0,0,0,0,0,0,0,0,0 DATA 0,0,0,0,0,0,0,0,8,8,0,0,0,8,8,0,0,0,0,0,0,0,0,0 DATA 0,0,0,0,0,0,0,8,0,0,8,0,0,8,0,8,0,0,0,0,0,0,0,0 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
' Bitmap for the Bunny sprite DATA 0,0,0,0,0,15,0,0,0,0,15,0,0,0,0,0,0 DATA 0,0,0,0,0,15,15,0,0,15,15,0,0,0,0,0,0 DATA 0,0,0,0,0,0,15,0,0,0,15,0,0,0,0,0,0 DATA 0,0,0,0,0,0,0,15,15,15,0,0,0,0,0,0,0 DATA 0,0,0,0,0,0,0,15,15,15,0,0,0,0,0,0,0 DATA 0,0,0,0,0,0,15,0,15,0,15,0,0,0,0,0,0 DATA 0,0,0,0,0,0,15,15,15,15,15,0,0,0,0,0,0 DATA 0,0,0,0,0,0,0,15,15,15,15,0,0,0,0,0,0 DATA 0,0,0,0,0,0,0,0,15,15,15,0,0,0,0,0,0,0 DATA 0,0,0,0,0,0,0,15,15,15,15,15,0,0,0,0,0 DATA 0,0,0,0,0,0,15,15,15,15,15,15,0,0,0,0,0 DATA 0,0,0,0,0,15,0,15,15,15,15,0,15,0,0,0,0 DATA 0,0,0,0,0,0,0,0,15,15,15,15,0,0,0,0,0 DATA 0,0,0,0,0,0,15,15,0,0,0,0,15,15,0,0,0 DATA 0,0,0,15,15,15,0,0,0,0,0,0,15,15,15,0 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 You also will need this : http://dl.dropbox.com/u/15387474/Hawksnest.bmp Any questions or comments are welcome. from Garry
|
99
on: April 12, 2012, 12:49:12 am
|
Started by GarrisonRicketson - Last post by GarrisonRicketson
|
Ok, the previous demo, has been modified and corrected, thanks due to Small No More, at qb64.net,.. This is the corrected version: DEFLNG A-Z SCREEN 0 INPUT "What is your name "; name$ PRINT "Hello "; name$ PRINT " My name is Garry, I made this up,with the help of a tutorial,by Vic" PRINT "Thank you, wait a couple of seconds to go on" _DELAY 4 CLS 1 PRINT "These are some choices,of how many times to print something" PRINT "NOTE 0 will exit the program" PRINT " 0 exits,2,3,5 and 10,print that many times" PRINT " 6 beeps six times," PRINT " 9 goes to another program " INPUT "0,2,3,4,5,6,10,9"; number IF number = 9 THEN CLS FOR i = 1 TO 0 PRINT "you selected 9,now you will see screen 12" _DELAY 3 NEXT GOTO 12 END END IF
IF number = 0 THEN END END IF
IF number = 2 THEN CLS FOR i = 1 TO 2 PRINT "You selected 2 " NEXT GOTO 1 END IF IF number = 3 THEN CLS FOR i = 1 TO 3 PRINT "You selected 3" NEXT GOTO 1 END END IF IF number = 4 THEN CLS FOR i = 1 TO 4 PRINT " you selected 4 " NEXT GOTO 1 END END IF IF number = 5 THEN CLS FOR i = 1 TO 5 PRINT "you selected 5 " NEXT GOTO 1 END END IF IF number = 6 THEN CLS FOR i = 0 TO 1 PRINT " 6 is going to be different" NEXT GOTO 2 'END END IF IF number = 10 THEN CLS FOR i = 1 TO 10 PRINT "you selected 10" NEXT GOTO 1 END END IF 2 PRINT "this is 6" PLAY "aaaaaa" PRINT " 3 x 2 =" PRINT 3 * 2 _DELAY 2 GOTO 1 END
12 DEFINT A-Z
SCREEN 12 PRINT "Hello "; name$ PRINT "THIS WILL BE SCREEN 12" PRINT "The following code dose not use GOTO," PRINT "Hit any key to continue" SLEEP CLS
Done = 0 start: CLS DO '/// This is PART 2 and it has a bug LOCATE 2, 10 PRINT "WELCOME to Garrys invention" COLOR 2: PRINT "You Can do these things " '///Note it is in this part, that if any key other a number is "hit", it displays, the letter and a number, for example v 111, the space key will cause a error, so I need to find out how to fix this.NOW it is fixed,
PRINT "1)Multiply" PRINT "2)ADD" PRINT "3)Quit" Valid% = 0 WHILE Valid% = 0 Choice$ = INPUT$(1)
Choice% = ASC(LTRIM$(Choice$)) 'PRINT Choice$, Choice% <===this line you was telling it to print the numbers and characters SELECT CASE Choice% CASE 49 TO 51 Valid% = 1 CASE ELSE Valid% = 0 END SELECT WEND CLS SELECT CASE Choice% CASE 49 'multiply RANDOMIZE TIMER Num1% = INT(RND * 9) + 1 Num2% = INT(RND * 9) + 1 LOCATE 10, 2 PRINT "The product of"; Num1%; " x "; Num2%; "= " INPUT Answer$ Answer% = VAL(LTRIM$(Answer$)) IF Answer% = Num1% * Num2% THEN PRINT "Correct "; Num1%; " x "; Num2%; " = "; Answer% SOUND 1000, 1 ELSE PRINT "Wrong "; SOUND 600, 3 Answer% = Num1% * Num2% PRINT Num1%; " x "; Num2%; " = "; Answer% _DELAY 3 END IF PRINT Answer$ CASE 50 'addition RANDOMIZE TIMER Num1% = INT(RND * 9) + 1 Num2% = INT(RND * 9) + 1 LOCATE 10, 2 PRINT "The sum of"; Num1%; " + "; Num2%; "= " INPUT Answer$ Answer% = VAL(LTRIM$(Answer$)) IF Answer% = Num1% + Num2% THEN PRINT "Correct "; Num1%; " + "; Num2%; " = "; Answer% SOUND 1000, 1 ELSE PRINT "Wrong "; SOUND 600, 3 Answer% = Num1% + Num2% PRINT Num1%; " + "; Num2%; " = "; Answer% _DELAY 3 END IF CASE 51 'quit Done = 1 END SELECT _DELAY 1 CLS PRINT "Press anykey to exit" _DELAY 2 CLS LOOP WHILE Done = 0 SLEEP SYSTEM ' You can try this code, separate, just add start: to the top, right above dontdoit: dontdoit: CLS LOCATE 12, 20: PRINT "Sorry input must be a number" LOCATE 14, 20: PRINT "Returning to menu in 10 seconds" SLEEP 10 GOTO start
'PRINT Choice$, Choice% <===this line you was telling it to print the numbers and characters This is what needs to be removed,..using the ' in front of the code line, "remarks" it out, The ' Is used to indicate a line is a remark and not code to be executed. So now, you should be starting to understand a little, about "codeing" with qb64,.. using a few commands, remarks,.. and also, when you get to the point where you do not understand, why it dose not work right, just ask,...someone will find a answer,.. also looking at the wiki, http://qb64.net/wiki/index.php?title=Main_Page is a good place to start, when you need more info.
|
100
on: April 11, 2012, 09:18:54 pm
|
Started by GarrisonRicketson - Last post by GarrisonRicketson
|
I tried combining 2 of these into 1 program, it works, but it dose something kind of "odd", harmless , enough but at this point I do not understand why. First I want to mention this: 1] Always put this at the top of the program DEFLNG A-Z (It means any variable you make will automatically be of the LONG type) 2] Create an output screen. If you don't screen 0 will be used as default. 3] To prevent the program ending immediately add this before SYSTEM Dummy$=input$(1) (this waits for a key press without needing the enter key pressed) 4] End with the system command and your output screen will be closed automatically. All though these things are not always necessary, it probabley is a good "habbit" to get into, especially when you get into using SUBS , and Variables,..(need to add links too keywords) DEFLNG A-Z SCREEN 0 INPUT "What is your name "; name$ PRINT "Hello "; name$ PRINT " My name is Garry, I made this up,with the help of a tutorial,by Vic" PRINT "Thank you, wait a couple of seconds to go on" _DELAY 4 CLS 1 PRINT "These are some choices,of how many times to print something" PRINT "NOTE 0 will exit the program" PRINT " 0 exits,2,3,5 and 10,print that many times" PRINT " 6 beeps six times," PRINT " 9 goes to another program " INPUT "0,2,3,4,5,6,10,9"; number IF number = 9 THEN CLS FOR i = 1 TO 0 PRINT "you selected 9,now you will see screen 12" _DELAY 3 NEXT GOTO 12 END END IF
IF number = 0 THEN END END IF
IF number = 2 THEN CLS FOR i = 1 TO 2 PRINT "You selected 2 " NEXT GOTO 1 END IF IF number = 3 THEN CLS FOR i = 1 TO 3 PRINT "You selected 3" NEXT GOTO 1 END END IF IF number = 4 THEN CLS FOR i = 1 TO 4 PRINT " you selected 4 " NEXT GOTO 1 END END IF IF number = 5 THEN CLS FOR i = 1 TO 5 PRINT "you selected 5 " NEXT GOTO 1 END END IF IF number = 6 THEN CLS FOR i = 0 TO 1 PRINT " 6 is going to be different" NEXT GOTO 2 'END END IF IF number = 10 THEN CLS FOR i = 1 TO 10 PRINT "you selected 10" NEXT GOTO 1 END END IF 2 PRINT "this is 6" PLAY "aaaaaa" PRINT " 3 x 2 =" PRINT 3 * 2 _DELAY 2 GOTO 1 END
12 DEFINT A-Z
SCREEN 12 PRINT "Hello "; name$ PRINT "THIS WILL BE SCREEN 12" PRINT "The following code dose not use GOTO," PRINT "Hit any key to continue" SLEEP CLS
Done = 0
DO LOCATE 2, 10 PRINT "WELCOME to Garrys invention" COLOR 2: PRINT "You Can do these things " '///Note it is in this part, that if any key other a number is "hit", it displays, the letter and a number, for example v 111, the space key will cause a error, so I need to find out how to fix this.
PRINT "1)Multiply" PRINT "2)ADD" PRINT "3)Quit" Valid% = 0 WHILE Valid% = 0 Choice$ = INPUT$(1) Choice% = ASC(LTRIM$(Choice$)) PRINT Choice$, Choice% SELECT CASE Choice% CASE 49 TO 51 Valid% = 1 CASE ELSE Valid% = 0 END SELECT WEND CLS SELECT CASE Choice% CASE 49 'multiply RANDOMIZE TIMER Num1% = INT(RND * 9) + 1 Num2% = INT(RND * 9) + 1 LOCATE 10, 2 PRINT "The product of"; Num1%; " x "; Num2%; "= " INPUT Answer$ Answer% = VAL(LTRIM$(Answer$)) IF Answer% = Num1% * Num2% THEN PRINT "Correct "; Num1%; " x "; Num2%; " = "; Answer% SOUND 1000, 1 ELSE PRINT "Wrong "; SOUND 600, 3 Answer% = Num1% * Num2% PRINT Num1%; " x "; Num2%; " = "; Answer% _DELAY 3 END IF PRINT Answer$ CASE 50 'addition RANDOMIZE TIMER Num1% = INT(RND * 9) + 1 Num2% = INT(RND * 9) + 1 LOCATE 10, 2 PRINT "The sum of"; Num1%; " + "; Num2%; "= " INPUT Answer$ Answer% = VAL(LTRIM$(Answer$)) IF Answer% = Num1% + Num2% THEN PRINT "Correct "; Num1%; " + "; Num2%; " = "; Answer% SOUND 1000, 1 ELSE PRINT "Wrong "; SOUND 600, 3 Answer% = Num1% + Num2% PRINT Num1%; " + "; Num2%; " = "; Answer% _DELAY 3 END IF CASE 51 'quit Done = 1 END SELECT _DELAY 1 CLS PRINT "Press anykey to exit" _DELAY 2 CLS LOOP WHILE Done = 0 SLEEP SYSTEM You will see where I remarked about the key entered displaying a letter and the number. When I find out why, I can explain, and correct this.
|
|