QB64 Phoenix Edition
'$include: 'file.tmr' Timing Question - Printable Version

+- QB64 Phoenix Edition (https://qb64phoenix.com/forum)
+-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1)
+--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3)
+---- Forum: Help Me! (https://qb64phoenix.com/forum/forumdisplay.php?fid=10)
+---- Thread: '$include: 'file.tmr' Timing Question (/showthread.php?tid=4000)



'$include: 'file.tmr' Timing Question - pmackay - 10-16-2025

Hey Everyone, Hope you are all well, Qb64PE is absolutely Fabulous.... any way I would like to ask you three things..

* First of All.... With '$Include:   is it possible to execute the folloing from a file or Do i keep this in the main because it has a on gosub which is not in the File.
  

Code: (Select All)
 KeyboardRepeat = _FreeTimer
On Timer(KeyboardRepeat, .07) GoSub readkeyboard
BugMoveRepeat = _FreeTimer
On Timer(BugMoveRepeat, .16) GoSub bugmoverepeat

* Is it possible for QB64 to include with on Timer a way to just call timer like On Timer (whatever,07) call KeyboardRepeat ... I know we have gosub but would be nice to put a call to Sub outside of main to a $include:    It would allow the main to have the call hidden away like with const and dim vars to keep the main tidy

* This is a Utility IDE Request, I was thinking how I need to save files and do new to make an empty file for '$include:   I was thinking that the IDE detects the file is missing and it would be great to have and option in the options menu to click and have it spawn the file if it does not exist. like just type '$include 'file' and the Ide creates it if missing or just add an option like '$Include 'file.???' : make   and it auto makes the empty file ready to click and use or just a simple option in the drop down menu.. new include file...

thanks guys.... Sorry to be a hole in the sock Smile


RE: '$include: 'file.tmr' Timing Question - bplus - 10-16-2025

"Sorry to be a hole in the sock"  LOL luv it!  

What did the Wiki say about this? Sorry to be such a hang nail Smile

Mr Wiki says this:
ON TIMER([number%,] seconds!) { SUBprocedure | GOSUB lineLabel|lineNumber} }

So yes, yes you can Smile once included its as if it were with all the other junk in the main. I haven't tested this but I am willing to bet real money with someone else who hasn't tested this. GoSub calls from main module would have to remain with main module but not Subs. BTW did you know you can use GoSubs and calls to them inside Subs and such are not seen by the rest of the code?


RE: '$include: 'file.tmr' Timing Question - a740g - 10-16-2025

Plenty of examples:

https://github.com/a740g/QB64-PE-Museum/blob/1b2d913035e1ad81f69c484ae7950ad652712c5a/Terry-Ritchie/QB64-ButtonLib/RQBL.BI#L170

https://github.com/a740g/QB64-PE-Museum/blob/1b2d913035e1ad81f69c484ae7950ad652712c5a/Bisqwit/fmengineqb/include/adlib.bas#L72

https://github.com/a740g/QB64-PE-Museum/blob/1b2d913035e1ad81f69c484ae7950ad652712c5a/mechatronic3000/QBPool/fzxNGN_QBPOOL_NET.bas#L140

https://github.com/a740g/QB64-PE-Museum/blob/1b2d913035e1ad81f69c484ae7950ad652712c5a/NakedApe/RockJockey2/RockJockey.bas#L265