[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 264: mysqli_fetch_assoc(): Couldn't fetch mysqli_result
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 326: mysqli_free_result(): Couldn't fetch mysqli_result
Pete's QBASIC Site Discuss QBasic, Freebasic, QB64 and more 2007-11-29T13:26:12-05:00 http://petesqbsite.com/phpBB3/app.php/feed/topic/2493 2007-11-29T13:26:12-05:00 2007-11-29T13:26:12-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=15737#p15737 <![CDATA[Problem with program...]]>
Ah, how can i reduce print statements? And why is it when i run it in EXE form it slows down my WHOLE computer but lots... will try to amek code smaller by adding "?"'s instead of print.
Reducing? Don't know.

Weird that is slows down your pc. It should make it faster. You tried running it in DosBox? You can download that here http://dosbox.sourceforge.net/.

? will result in QB as PRINT. If you compile from the prompt, ? will not be recognized.

Grtz

Statistics: Posted by Seb McClouth — Thu Nov 29, 2007 1:26 pm


]]>
2007-11-29T12:53:36-05:00 2007-11-29T12:53:36-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=15736#p15736 <![CDATA[Problem with program...]]> Statistics: Posted by Sinuvoid — Thu Nov 29, 2007 12:53 pm


]]>
2007-11-28T17:12:03-05:00 2007-11-28T17:12:03-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=15730#p15730 <![CDATA[Speed]]>
It is also based on the PC speed!

Ted

Statistics: Posted by burger2227 — Wed Nov 28, 2007 5:12 pm


]]>
2007-11-27T16:54:02-05:00 2007-11-27T16:54:02-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=15721#p15721 <![CDATA[Problem with program...]]> Statistics: Posted by Sinuvoid — Tue Nov 27, 2007 4:54 pm


]]>
2007-11-17T22:51:35-05:00 2007-11-17T22:51:35-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=15668#p15668 <![CDATA[Problem with program...]]> Statistics: Posted by Sinuvoid — Sat Nov 17, 2007 10:51 pm


]]>
2007-11-28T17:07:04-05:00 2007-11-17T17:19:26-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=15666#p15666 <![CDATA[A TIMER Delay]]>

Code:

SUB Delay (Dela!)   start = TIMER   DO WHILE start + dela! > TIMER   IF start > TIMER THEN start = start - 86400      'midnite correction   LOOPEND SUB
I use this instead of SLEEP for a very important reason. SLEEP only stops a program until a keypress by the user!

To call the sub:

Code:

Delay .5   '1/2 second delay                        ' orCALL Delay(.5)
I use this SUB in many of my programs to slow things down. A call can also slow down loops.

As to file access, you MUST not try to read data that is past the End Of File or EOF(#) or you will get an error. Here is an example with a loop and without one:

Code:

DO WHILE (NOT EOF(1))        'loop until end of fileINPUT #1, nme$, Phone$, age%, Zip% IF nme$ = name$ THEN EXIT DOLOOPIF (NOT EOF(1)) THEN LINE INPUT #1, Line$   'in an IF statement
The first example reads data from a file, numbered #1 in an OPEN statement, one piece at a time until the name matches. If the name is not found, the loop stops at the end of the file!
The second is used with IF to see if the EOF has been reached while taking an entire line of data like text. It will not Input data if it is at the end of the file!

Ted

Statistics: Posted by burger2227 — Sat Nov 17, 2007 5:19 pm


]]>
2007-11-16T13:58:30-05:00 2007-11-16T13:58:30-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=15658#p15658 <![CDATA[Problem with program...]]> Statistics: Posted by Sinuvoid — Fri Nov 16, 2007 1:58 pm


]]>
2007-11-16T12:59:40-05:00 2007-11-16T12:59:40-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=15656#p15656 <![CDATA[Problem with program...]]>

Code:

do...until EOF(filenr%)
? Because a file could contain more, or heck, not even exist for that matter.

Statistics: Posted by Seb McClouth — Fri Nov 16, 2007 12:59 pm


]]>
2007-11-16T12:14:10-05:00 2007-11-16T12:14:10-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=15655#p15655 <![CDATA[Problem with program...]]> But you have done well there, just keep on pushing and you find the way ;)

Try to create and use subs and functions instead of goto, will make your code way easier to read and handle.

E.K.Virtanen

Statistics: Posted by bungytheworm — Fri Nov 16, 2007 12:14 pm


]]>
2007-11-16T10:26:51-05:00 2007-11-16T10:26:51-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=15653#p15653 <![CDATA[Problem with program...]]>

Code:

DECLARE SUB TEXT (a AS INTEGER, b AS INTEGER, C AS STRING)'A database of SouylsinDEFINT A-ZCLSWbackround:FOR i = 1 TO 3COLOR 15, 12TEXT 15, 20, "Loading, Please wait."SLEEP 1CLS 2TEXT 15, 20, "Loading, Please wait.."SLEEP 1CLS 2TEXT 15, 20, "Loading, Please wait..."SLEEP 1CLS 2NEXT iCLStest:COLOR 15, 12LOCATE 1, 1PRINT "A production of Souylsin."SLEEP 1LOCATE 2, 1PRINT "Thanks to everyine who has contributed to this production."SLEEP 1LOCATE 3, 1PRINT "WikiDAT 0.11"SLEEP 1SHELL "TYPE help.txt"SLEEP 1LOCATE 10,1PRINT "TEST COMPLETE"LOCATE 11, 1PRINT "Press Any key to Continue"kp$ = INKEY$IF kp$ <THEN> 4 THEN selection% = 1   GOSUB Redraw  CASE " "goto END SELECTLOOPRedraw:CLSFOR i = 1 TO 4 PRINT Menu$(i)NEXT iLOCATE selection%, 1COLOR 15, 12PRINT Menu$(selection%)COLOR 0, 12RETURNLOCATE 5, 20COLOR 14, 12PRINT "Database of Zelda Actors"ssearxh:GS:fnar:Anicode:asearch:CLS 2INPUT "Actor name, or part of one:", sactname$cmd$ = "FIND /I " + CHR$(34) + sactname$ + CHR$(34) + " Actordat.txt"SHELL cmd$PRINT "(A)nother search or (B)ack to main?"goto choiceext:CLS 2RANDOMIZE TIMERC = INT(RND * 0 + 15) + 1COLOR CLOCATE 10, 25PRINT "BYE!"SLEEP 1ENDSUB TEXT (a AS INTEGER, b AS INTEGER, C AS STRING)LOCATE a, bPRINT CEND SUB

Statistics: Posted by Sinuvoid — Fri Nov 16, 2007 10:26 am


]]>
2007-11-16T08:36:30-05:00 2007-11-16T08:36:30-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=15650#p15650 <![CDATA[Problem with program...]]>
Um wanna explain the code to me? Might help a bit, but i need the locate so the string appears in the middle of the screen, and not a 1,1. Know what I mean? Ill show you a update of my code shortly, maybe in like 10minutes.
http://www.ascii-world.com/centering-text-on-the-screen
EDIT:How would I be able to turn this into a sub?...
You need to make that as function with return value. If value = ok, then call sub done and so on.
Example of simple function.Rude and anti-beautifull but it does the job.

Code:

CONST OK = 1Function OkOrNot(a AS Integer, FileName AS String) AS IntegerOPEN FileName FOR INPUT AS #1INPUT #1, there$CLOSE #1locate a, 1IF there$ = "0000 0000 Link (may sometimes cause Z-buffer glitches)" THENPrint FileName; " Located successfully."RETURN OKELSEPRINT "Could not locate"; FileName "now exitting..."SLEEP 1ENDEND IFEND Function' this works after you create "Done" as sub.IF OkOrNot(a, "filenamehere") = OK Then Done
Take a look of sub/function tutorials in this site ;)

E.K.Virtanen

Statistics: Posted by bungytheworm — Fri Nov 16, 2007 8:36 am


]]>
2007-11-16T07:47:00-05:00 2007-11-16T07:47:00-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=15649#p15649 <![CDATA[Problem with program...]]>
EDIT:How would I be able to turn this into a sub?

Code:

find:OPEN file$ FOR INPUT AS #1INPUT #1, there$CLOSE #1IF there$ = "0000 0000 Link (may sometimes cause Z-buffer glitches)" THENLOCATE a, 1PRINT file$ " Located successfully."GOTO doneELSELOCATE a, 1PRINT "Could not locate"; file$ "now exitting..."SLEEP 1ENDEND IF

Statistics: Posted by Sinuvoid — Fri Nov 16, 2007 7:47 am


]]>
2007-11-16T07:28:39-05:00 2007-11-16T07:28:39-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=15648#p15648 <![CDATA[Problem with program...]]>
Here is another tip. I thought to create it after looking your start of code.

Code:

Temp$ = "Loading, Please wait..."CLS ' no need to locate since CLS allways put's cursor at 1,1.For counter = 1 TO LEN(Temp$)Print MID$(Temp$, counter, 1);' important to have ; at the end so line wont change.'DELAY CODE HERE: SLEEP 1 or somethingNext Counter
Dont get frustrated, you are goin good there. Just keep on learning ;)
http://www.ascii-world.com/qbasic-snippets

E.K.Virtanen

Statistics: Posted by bungytheworm — Fri Nov 16, 2007 7:28 am


]]>
2007-11-16T07:01:44-05:00 2007-11-16T07:01:44-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=15647#p15647 <![CDATA[Problem with program...]]> so thats how sub's work eh? Its like putting 2 commands together...AWESOME!

Statistics: Posted by Sinuvoid — Fri Nov 16, 2007 7:01 am


]]>
2007-11-16T06:47:32-05:00 2007-11-16T06:47:32-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=15646#p15646 <![CDATA[Problem with program...]]>

Code:

SUB Text(a AS Integer, b AS Integer, c AS String)    LOCATE a, b    PRINT cEND SUB
Now you can replace these
LOCATE 15, 20
PRINT "Loading, Please wait."


with this
TEXT 15, 12, "Loading Please wait."

Things that slows your program mostly are these ;)

Code:

FOR b = 1 TO 3000NEXT b 
If you want some delay there, i would ratherly use SLEEP with one or two second parameter. Your way depends of computer speed.

Statistics: Posted by bungytheworm — Fri Nov 16, 2007 6:47 am


]]>