Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Dimster

Pages: [1] 2 3 ... 5
1
QB64 Discussion / SEEK # or not SEEK #
« on: April 15, 2022, 12:02:52 pm »
Running into a bad file name or number error message when using Seek on a sequential file and not sure why.

Open "d:/SequentialFile1" for INPUT as #52
Seek #52, Seek(1)

The above is generating the error message. I have checked the name of the file I'm trying to open, and that the file is indeed on my "d" drive, also that the same opening statement works with Input #52.

I checked the wiki and the example it provides drops the "#" . The wiki has the seek statement as SEEK 1, Seek(1) ( ie there is no "#").

I'm not sure which is the correct statement but no matter, both with or without the "#" I'm getting the error message. I have also tried to be sure the file I'm trying to access is Closed before the Opening statement.

Any idea's on what I could be doing wrong, and which to the two Seek statements is the correct one?

Thanks

2
QB64 Discussion / ElseIF v's Or
« on: April 06, 2022, 04:54:00 pm »
Ok, time for another dumb questions on "Why can't I...?"

Now I realize there is such a thing as ELSEIF. I do use it a lot. But I often find myself wondering why an IF statement can not follow an OR.

To give you an example.. Suppose you have an Array (1 to 10) and you want to search the array for duplicate, or triplicate, or quadruplicate, or Quintuplicate, or Sextuplicate etc values

For x = 1 to 10
  For y = 1 to 10
     If Array(x) = Array(y) then Duplicate = Array(x)
     or IF Array(x) = Array(y) and Array(x)=Array(y+1) then Tripiplicate = Array(x)

etc etc


3
QB64 Discussion / Variable v's Fixed Value
« on: March 22, 2022, 10:29:21 am »
@MasterGy ... Garland of Pearls is terrific. In going over the code I notice the use of a variable rather than a fixed value in the math formula. For example the variable ZOOM appears to be a constant 2 and the Name ZOOM is used in the math formula for x1,y1,x2,y2, rather than the fixed value of 2.

Whereas in the case of the variable POWER, it's value is not fixed and the math formula vec_x and vec_y also use the variable POWER.

The POWER application seems to me to be the way I mostly see named variables used. I was just wondering if you find some advantage in your coding to use named variables of fixed values for use in formulas ?

4
I have a number of nested for loops and do loop and was thinking of changing some of them into recursive statements by changing the outer loop to a subroutine that is called in the inner do loop. Not sure if I have explained that right but here is an example of the format. Main problem (actually the first problem I am encountering) is stopping the recursion.

Code: QB64: [Select]
  1.     a = 0
  2.     b = b + 1
  3.  
  4.     DO
  5.         a = a + 1
  6.         PRINT " Value of A is "; a; "  Value of B is "; b
  7.  
  8.     LOOP UNTIL a = 100
  9. LOOP UNTIL b = 100
  10.  
  11.  
  12.     a = a + 1
  13.     PRINT " Value of A is "; a; "  Value of C is "; c
  14.     desub
  15.  
  16.  
  17.  
  18.  
  19. SUB desub
  20.     a = 0
  21.     c = c + 1
  22.     IF c = 100 THEN SLEEP

5
QB64 Discussion / Printing Color using LPRINT
« on: March 04, 2022, 01:46:10 pm »
Every now and then, I like to write up some notes on the text screen and LPrint them off. Changing text color preferences in the IDE doesn't help with this but is there a way to change the color of the some of the text so a LPrint picks it up for the printer?

6
QB64 Discussion / Formula to convert Print to _Printstring
« on: February 21, 2022, 11:38:14 am »
Hello All

I'm fumbling for a formula which accurately converts the location on the screen when I switch some of my prior code from Print to _Printstring. Actually, it's not so much what I'm actually printing to the screen it's more the conversion of the comma's... as in Print "Hello World","Are you ready for the day",,,"YES/NO".

So those comma's move the print zone by 14 characters, so to convert to say a new screen (1800,900,32), what I have been doing is dividing 1800/14 (or whatever the new screen column by 14). It's close but no cigar. I wind up continuously playing with column value...takes forever to recreate the Print screen to _Printstring. Am I missing something in my formula or is this rough calculation the best approach to the recreation of the old screens?

7
QB64 Discussion / True and False
« on: February 09, 2022, 12:23:13 pm »
True and False in QB64 are not key words. At least I don't think they are. They seem to be key words in other languages. In QB64 I can make False = 1 or 10 or 1000 and True = Not False. It seems to me that I need to interpret True or False from the results of an equation. The wiki states True = -1 and False = 0. Quite often I'm not getting those values (particularly for False) even though I know what the correct result of the outcome should be.

True and False seem to be in the background somewhere....If a = 5 then etc ....has a true/false element being performed but we only work with the Then part of the result. I'm wondering, if the STATUS screen at the bottom of the IDE could display decision statements and then either TRUE or FALSE (rather than -1 or 0) to those decision statements in our coding. If not, is it possible to add that feature to Debug in the future?

8
QB64 Discussion / Debugging unused variables and arrays
« on: January 29, 2022, 10:55:31 am »
Lets say you've got a mixture of 30 variables and arrays in your program, is there a way, using the filter feature of $Debug, to identify unused variables and arrays without going one at a time?

9
QB64 Discussion / Select Case
« on: January 22, 2022, 02:31:24 pm »
Looking for some ideas on how to jump to the next case in a series of Select Cases.

Right now the only way I'm having some success is building another Select Case within the case I want to jump.

Here's an example of what I'm trying to accomplish. So I have a Select Case of 4 cases then End Select. I have a counter within each case and when that counter reaches a particular level I do not want that case to perform the tasks it has been performing but rather just jump to the next case.

Select Case Event

Case 1
Count1 = Temperture
If Count1<0 then next case
RainEvent = RainEvent + 1

Case 2
Count2 = SnowDays
If Count2>31 then next case
SnowEvent = SnowEvent + 1


Case 3
Count3 = Windspeed
If Count3>100 then next case
WindEvent = WindEvent + 1

Case 4
HurricaneEvent=HurricaneEvent +1

Enb Select

The thing is there is no CASE NEXT or GOTO CASE. IF THEN CASE 2 doesn't work. I have discover the underscore doesn't work (ie if Count3>100 THEN_)nor does CONTINUE work or EXIT CASE. What I have been doing is building another Select Case within the Case I want to jump but I'm wondering if someone else may have a better/simpler way of going to the next case if a particular circumstance/criteria has been met?

10
QB64 Discussion / Happy New Year
« on: January 01, 2022, 02:54:08 pm »
Looking forward to getting this damn virus behind us. It did hit our home ending a lot of beautiful meals and a hook ups with some very funny relatives. But on the positive side ( if that word still carries a happy meaning) my Christmas turned into an adult Halloween. Tons  of chocolates, tarts and treats you couldn't stop eating. At the moment I'm trying to write some code while consuming a coffee with chocolates filled with brandy. I suspect its' the chocolates that have inspired me to pass along this season greeting. I'm very thankful for all the help this community has provided to me. Going for a couple more chocolates, they could actually be a cure for the virus.

11
QB64 Discussion / S_PRINT, E_PRINT
« on: December 29, 2021, 01:16:01 pm »
I know from reading past threads that messing with the PRINT statement can be very dicey but if there is ever a consideration to expand on LPRINT I think it would be useful to have a way to sending large sections of your code to the printer. At the present time, to send a section of my code to the printer, I highlight the section and copy/paste it back with new lines in the program I'm coding. Then change the beginning of each line with LPRINT. In this way I get a hard copy of the code on the screen. But where the screen can only show me so many lines the hard copy provides lines of code not displayed. It is a pain in the butt to do all the highlighting, copy/paste and rewording the beginning of each line with LPRINT. Maybe you guys or girls have a better way to send a large section of code to the printer???

Anyway, the thought occurred to me while debugging, it may be helpful to have something like a command "S_PRINT" that you would place at the start of the lines to print and "E_PRINT" where you want the printing to End. I wonder if that approach might be easier than trying to add a Print option to highlighted sections of code??

12
QB64 Discussion / Loss my IDE colors.
« on: November 26, 2021, 11:24:16 am »
So here's something strange. I shut down my computer last night as I normally do. When I powered up this morning all my qb64 programs lost the IDE colors which I had set. They all powered up this morning in the default IDE dark blue. And of course I did not keep a record of the IDE colors which were helping me determine which of the programs were working ok v's those that needed more help. Has this happened to anyone else? An idea what I may have done to cause it? I'm using the 64 bit v2.0. (as the v2.0.1 and v2.0.2 do not have changes material to my programs I have not updated these changes. Not sure if updating to the latest would have saved me in this case?)

13
QB64 Discussion / QB64 Certification
« on: November 19, 2021, 12:06:03 pm »
I've notice some employers, no matter what the job, do look at some of those off beat hobbies people list on a resume, and if that off beat hobby comes with a certificate then it seems to hold some value in them considering you for the job you are chasing. Does there exist a QB64 Certification? I would image this community would have some members with proficiencies in different aspects of Basic programming which should warrant them a Certificate of Excellence which we would all vouch for should it appear on their resume. I guess it would be better if the certificate came from a teaching institute but this site is more than just teaching basic.

14
QB64 Discussion / Division by Zero
« on: November 10, 2021, 10:32:30 am »
So, as we all know, math isn't my strongest suit. Wondering if I could get your thoughts on if there may be a math formula to do something with division by zero. In my case I have multiple calculation which produce for me a trending value. In the calculations I often come to the point where there is zero trending (ie where the divisor is zero). Now the direction of the trend is also being followed and once the divisor gets to zero, in my routines negative trending is allowed. Therefore I have struggled with trying to determine if "0" is positive or negative and I'm using the trending to make that determination. So a falling trend at zero, the formula needs to product a negative value, whereas a trend that has been rising suddenly hits a zero, I want that same math formula to produce a positive value. That sounds so convoluted but I hope you can grasp the idea.

Anyway. I have never been able to find a math formula to do what I have just described, so I have forced values. Here is an idea of what I mean by forced the value

Code: QB64: [Select]
  1. a = 25
  2. b = 0
  3. c = a / b
  4. Print " 25/0 = "; c
  5. a = 25
  6. b = 0
  7. c = a / b
  8. If b = 0 Then c = -.001 ' value forced for a falling trend, would be +.001 for rising trend
  9. Print " 25/0 = "; c

By plugging a forced value I think I'm introducing some inaccuracies to my outputted values. Maybe there is a positive or negative number that I could use that is just 1 short of inf?

15
QB64 Discussion / Recursion
« on: October 27, 2021, 09:01:51 am »
I was wondering if I could get your advice on where best to apply recursive code. Now that Function has a recursive element to it, would it be to my speed advantage to explore it? I presently have in my program multiple calls to the same Subroutine. Basically the program inputs data, calls a subroutine to work with the data then onto the next piece of data. I was thinking perhaps the program may have speed advantage if it inputted and stored the data, then, once I have it all,  use a recursive function call to perform the same work on each piece of data which the Subroutine had been performing. This is the trouble with new toys...your imagination goes wild and reality is always so painfully down the road.

Pages: [1] 2 3 ... 5