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.


Messages - xra7en

Pages: [1] 2 3 ... 19
1
QB64 Discussion / Re: Is there an ON EXIT run sub/function?
« on: February 19, 2022, 01:27:22 pm »
OK, that's a little tricky. it's not just ANY loop, if you have an inkey$ loop, I have to put it there. Had it in the main loop and it did nothing.

2
QB64 Discussion / Re: Is there an ON EXIT run sub/function?
« on: February 19, 2022, 11:55:55 am »
o interesting!

did not think to check for _exit LOL, actually did not know I could

I'll give it a shot.

3
QB64 Discussion / Re: Is there an ON EXIT run sub/function?
« on: February 19, 2022, 07:16:22 am »
THIS I know. I need a function/sub to run if they click the "x" (and not a "Q"uit option )

However, it will NOT run a sub or function if a user clicks the "x" on the terminal window. the terminal window will just stop.

For example clicking the red "x" in firefox, it will run some cleanup and delete cookies etc...

a qb64 window will just exit/end

edit: I know the title is confusing but there was not a better way to write that
I need the "exit/end" to RUN a sub/function




4
QB64 Discussion / Is there an ON EXIT run sub/function?
« on: February 19, 2022, 05:54:45 am »
Hi
Need to do a little app cleanup if a user clicks the "X" vs regular "q"uit etc.. In my case, I want to execute a "save_game" funciton even if they just "x" out of the app

VB5,6 have this, just curious if qb64 does :-)

5
Programs / Terminial Launch V - Complete overhaul for 2022!
« on: January 09, 2022, 04:04:33 pm »
No, I have not released the source code for this yet (still messy) I started to work off the older source, however, there were so many changes I wanted to make, I threw it in the proverbial trashcan and (once again) started from scratch.

TL-V is my fav. Everything works as I wanted. Search by name, next/prev page works on larger collections, uses an external ini file that is much more organized (need dos commands that work internal of QB64 instead of shell - just askin :-P), much cleaner execution. and several other improvements over the older one.
Hats off to SPRIGGYSPRIG for his clever string.split and SMcNiel for his best solution to an "IsNum()"  function

If I get enough requests, I'll put the source up as is. (its messy, almost done cleaning it). Currently MUCH MUCH smaller at 450+ lines of code, and some external files as well.

edit: forgot to add a download :-)

mediafire
Quote
https://www.mediafire.com/folder/26w77pfe4s4lr/releases

6
QB64 Discussion / Re: QB quirk on shell dir command?
« on: January 02, 2022, 10:19:21 pm »
OK, solved it this way:

cmd doesn't like the multiple extension in one line.
so used spriggy's split.string to split the extension


then looped through each split and wrote to the text file.

that all worked.


7
QB64 Discussion / Re: QB quirk on shell dir command?
« on: January 02, 2022, 06:43:29 pm »
So if I do

c:\> dir /b /a-d "drive:\path\to\roms\snes\" *.iso,*.bin
it says:
the system cannoot find the file specified, and then lists ALL the files in the folder.

However, If I do this in the same drive, no errors, and it lists the two extensions requested.

Unless I forgot how my dos stuff works LOL - VERY possible.

wish list, get dir$ working so it can do this :-)

(or does it)

8
QB64 Discussion / Re: QB quirk on shell dir command?
« on: January 02, 2022, 06:33:18 pm »
oops that was a mistake on my post. they are winblows slashes in the cmd they should have been "\" (I edited it to reflect this

UPDATE

I switched drives and did the command again, its a dos error. For some reason, it seems to ignore the switches on different drives.
so this is some weird quirk of dos "dir" from one drive to another. I just doesnt seem to see the /a-d part


9
QB64 Discussion / QB quirk on shell dir command?
« on: January 02, 2022, 05:27:15 pm »
so working on my emu launcher. and found an interesting quirk (wont call it a bug)

Quote
dir /b /a-d drive:\path\to\folder\ *.bin,*.iso
The above works perfect from the command prompt as intended. Just the bin and iso files show
howeeevvver

Code: QB64: [Select]
  1. ext = "*.bin,*.iso"
  2. rom_path="d:\some big\long\path\to\roms\"
  3. Shell _Hide "dir /b /a-d " + Chr$(34) + ROM_PATH + Chr$(34) + " " + EXT + " > ./romlist.txt"  

gives me ALL the files in the folder. which is what I don't want. Is this a goofy characteristic with QB64?

10
QB64 Discussion / Re: QB64 forum database err
« on: December 25, 2021, 12:52:30 pm »
oopps had the wrong link,
see prev post - it new replies to YOUR posts thats causing a database error

11
QB64 Discussion / Re: simple array question (I forgot)
« on: December 25, 2021, 11:23:23 am »
Name is a keyword in QB64 like Print. Add or subtract a letter or more for variable name.

O ya,, knew that. I tried _name but that didnt work either. so using nname, but I saw in @Cobalt had a good idea, and used "nam" not bad. will prob switch to that

thanks @Cobalt

12
QB64 Discussion / QB64 forum database err
« on: December 25, 2021, 11:21:43 am »
Show new replies toyour posts.  <---- edit

this gives a database error.

wasnt sure where to put this.

delete when addressed :--)

13
QB64 Discussion / Re: simple array question (I forgot)
« on: December 25, 2021, 04:22:41 am »
thanks for the replies

You are correct, it is good practice to init all vars, arrays, and udt, however, is a special case for me.
I was so fascinated by the "ON TIMER(x)" feature.
I am in the process of converting a clicker JS game to QB64, and have almost 500 lines of UDT. 

Here is what I was able to convert so far - goes pretty smooth. May not be the correct way. but it works
Code: QB64: [Select]
  1.  
  2. '-- THESE 2 LINES WILL RUN EVERY SECOND
  3. '-- AND UPDATE THE GAME WITH THE UPKEEP SUB
  4. On Timer(1) UP_KEEP
  5.  
  6. Const TRUE = 1
  7. Const FALSE = 0
  8.  
  9.  
  10. '-- GAME RECORDS
  11. '-- INITIATE EVERYTHING HERE.
  12. '--- TODO MAKE AN INI FILE FOR CUSTOM SETTINGS
  13.  
  14. '-- FOOD
  15. Type tCORE
  16.     nname As String * 20
  17.     total As Integer
  18.     increment As Integer
  19.     specialChance As Double
  20. Dim Shared CORE As tCORE
  21. Dim Shared FOOD As tCORE
  22. FOOD.nname = "food"
  23. FOOD.total = 0
  24. FOOD.increment = 1
  25. FOOD.specialChance = 0.1
  26.  
  27. '-- WOOD
  28. Dim Shared WOOD As tCORE
  29. WOOD.total = 0
  30. WOOD.increment = 1
  31. WOOD.specialChance = 0.1
  32.  
  33. '-- STONE
  34. Dim Shared STONE As tCORE
  35. STONE.total = 0
  36. STONE.increment = 1
  37. STONE.specialChance = 0.1
  38.  
  39.  
  40. '-- SKINS
  41. Dim Shared SKINS As tCORE
  42. SKINS.nname = "skins"
  43. SKINS.total = 0
  44.  
  45. Dim Shared HERBS As tCORE
  46. HERBS.nname = "herbs"
  47. HERBS.total = 0
  48.  
  49. Dim Shared ORE As tCORE
  50. ORE.nname = "ore"
  51. ORE.total = 0
  52.  
  53. Dim Shared LEATHER As tCORE
  54. LEATHER.nname = "leather"
  55. LEATHER.total = 0
  56.  
  57. Dim Shared METAL As tCORE
  58. METAL.nname = "metal"
  59. METAL.total = 0
  60.  
  61. Dim Shared PIETY As tCORE
  62. PIETY.nname = "piety"
  63. PIETY.total = 0
  64.  
  65. Dim Shared GOLD As tCORE
  66. GOLD.nname = "piety"
  67. GOLD.total = 0
  68.  
  69. LAND = 1000
  70. Dim Shared TOTAL_BUILDINGS As Long
  71. TOTAL_BUILDINGS = 0
  72.  
  73. Type TREQUIRES
  74.     FOOD As Integer
  75.     WOOD As Integer
  76.     STONE As Integer
  77.     SKINS As Integer
  78.     HERBS As Integer
  79.     ORE As Integer
  80.     LEATHER As Integer
  81.     METAL As Integer
  82.     PIETY As Integer
  83.     CORPSES As Integer
  84.  
  85. Type treqtemplate
  86.     total As Integer
  87.     devotion As Integer
  88.     requires As TREQUIRES
  89.  
  90.  
  91. Dim Shared TENT As treqtemplate
  92. TENT.requires.WOOD = 2
  93. TENT.requires.SKINS = 2
  94.  
  95. Dim Shared WHUT As treqtemplate
  96. WHUT.requires.WOOD = 20
  97. WHUT.requires.SKINS = 2
  98.  
  99.  
  100. Dim Shared COTTAGE As treqtemplate
  101. COTTAGE.requires.WOOD = 10
  102. COTTAGE.requires.STONE = 30
  103.  
  104. Dim Shared HOUSE As treqtemplate
  105. HOUSE.requires.WOOD = 30
  106. HOUSE.requires.STONE = 70
  107.  
  108. Dim Shared MANSION As treqtemplate
  109. MANSION.requires.WOOD = 200
  110. MANSION.requires.STONE = 200
  111.  
  112. Dim Shared BARN As treqtemplate
  113. BARN.requires.WOOD = 100
  114.  
  115. Dim Shared WOODSTOCK As treqtemplate
  116. WOODSTOCK.requires.WOOD = 100
  117.  
  118. Dim Shared STONESTOCK As treqtemplate
  119. STONESTOCK.requires.WOOD = 100
  120.  
  121. Dim Shared TANNERY As treqtemplate
  122. TANNERY.requires.WOOD = 30
  123. TANNERY.requires.STONE = 70
  124. TANNERY.requires.SKINS = 2
  125.  
  126. Dim Shared SMITHY As treqtemplate
  127. SMITHY.requires.WOOD = 30
  128. SMITHY.requires.STONE = 70
  129. SMITHY.requires.ORE = 2
  130.  
  131. Dim Shared APOTHECARY As treqtemplate
  132. APOTHECARY.requires.WOOD = 30
  133. APOTHECARY.requires.STONE = 70
  134. APOTHECARY.requires.HERBS = 2
  135.  
  136. Dim Shared TEMPLE As treqtemplate
  137. TEMPLE.requires.WOOD = 30
  138. TEMPLE.requires.STONE = 120
  139. TEMPLE.requires.HERBS = 10
  140.  
  141. Dim Shared BARRACKS As treqtemplate
  142. BARRACKS.requires.WOOD = 60
  143. BARRACKS.requires.FOOD = 20
  144. BARRACKS.requires.STONE = 120
  145.  
  146. Dim Shared STABLE As treqtemplate
  147. STABLE.requires.FOOD = 60
  148. STABLE.requires.WOOD = 60
  149. STABLE.requires.STONE = 120
  150. STABLE.requires.LEATHER = 10
  151.  
  152. Dim Shared MILL As treqtemplate
  153. MILL.requires.WOOD = 100
  154. MILL.requires.STONE = 100
  155.  
  156. Dim Shared GRAVEYARD As treqtemplate
  157. GRAVEYARD.requires.WOOD = 50
  158. GRAVEYARD.requires.STONE = 200
  159. GRAVEYARD.requires.HERBS = 50
  160.  
  161. Dim Shared FORTIFICATION As treqtemplate
  162. FORTIFICATION.requires.STONE = 100
  163.  
  164. Dim Shared BATTLEALTAR As treqtemplate
  165. BATTLEALTAR.devotion = 1
  166. BATTLEALTAR.requires.METAL = 50
  167. BATTLEALTAR.requires.PIETY = 200
  168. BATTLEALTAR.requires.STONE = 200
  169.  
  170. Dim Shared FIELDSALTAR As treqtemplate
  171. FIELDSALTAR.devotion = 1
  172. FIELDSALTAR.requires.FOOD = 500
  173. FIELDSALTAR.requires.WOOD = 500
  174. FIELDSALTAR.requires.STONE = 200
  175. FIELDSALTAR.requires.PIETY = 200
  176.  
  177. Dim Shared UNDERWORLDALTER As treqtemplate
  178. UNDERWORLDALTER.devotion = 1
  179. UNDERWORLDALTER.requires.PIETY = 200
  180. UNDERWORLDALTER.requires.STONE = 200
  181. UNDERWORLDALTER.requires.CORPSES = 1
  182.  
  183. Dim Shared CATALTER As treqtemplate
  184. CATALTER.devotion = 1
  185. CATALTER.requires.PIETY = 200
  186. CATALTER.requires.STONE = 200
  187. CATALTER.requires.HERBS = 100
  188.  
  189. Type TWONDER
  190.     TOTAL As Integer
  191.     WOOD As Integer
  192.     FOOD As Integer
  193.     STONE As Integer
  194.     SKINS As Integer
  195.     HERBS As Integer
  196.     ORE As Integer
  197.     LEATHER As Integer
  198.     METAL As Integer
  199.     PIETY As Integer
  200.     NNAME As String * 20
  201.     BUILDING As Integer
  202.     COMPLETED As Integer
  203.     PROGRESS As Integer
  204. Dim Shared WONDER As TWONDER
  205.  
  206. Type TPOPULATION
  207.     CURRENT As Integer
  208.     CAP As Integer
  209.     CATS As Integer
  210.     CORPSES As Integer
  211.     ZOMBIES As Integer
  212.     GRAVES As Integer
  213.     UNEMPLOYED As Integer
  214.     FARMERS As Integer
  215.     WOODCUTTERS As Integer
  216.     MINERS As Integer
  217.     TANNERS As Integer
  218.     BLACKSMITHS As Integer
  219.     APOTHECARIES As Integer
  220.     CLERICS As Integer
  221.     LABOURERS As Integer
  222.     SOLDIERS As Integer
  223.     SOLDIERSCAS As Integer
  224.     CAVALRY As Integer
  225.     CAVALRYCAS As Integer
  226.     CAVALRYPARTY As Integer
  227.     CAVALRYPARTYCAS As Integer
  228.     SIEGE As Integer
  229.     ESOLDIERS As Integer
  230.     ESOLDIERSCAS As Integer
  231.     EFORTS As Integer
  232.     healthy As Integer
  233.     totalsick As Integer
  234.     healthyas As Integer
  235.     totalSickas As Integer
  236.     unemployedIll As Integer
  237.     farmersIll As Integer
  238.     woodcuttersIll As Integer
  239.     minersIll As Integer
  240.     tannersIll As Integer
  241.     blacksmithsIll As Integer
  242.     apothecariesIll As Integer
  243.     clericsIll As Integer
  244.     labourersIll As Integer
  245.     soldiersIll As Integer
  246.     soldiersCasIll As Integer
  247.     cavalryIll As Integer
  248.     cavalryCasIll As Integer
  249.     wolves As Integer
  250.     wolvesCas As Integer
  251.     bandits As Integer
  252.     banditsCas As Integer
  253.     barbarians As Integer
  254.     barbariansCas As Integer
  255.     esiege As Integer
  256.     enemiesSlain As Integer
  257.     shades As Integer
  258. Dim Shared POPULATION As TPOPULATION
  259.  
  260. Type Tefficiency
  261.     happiness As Integer
  262.     farmers As Double
  263.     pestBonus As Double
  264.     woodcutters As Double
  265.     miners As Double
  266.     tanners As Double
  267.     blacksmiths As Double
  268.     apothecaries As Double
  269.     clerics As Double
  270.     soldiers As Double
  271.     cavalry As Double
  272. Dim Shared EFFICIENCY As Tefficiency
  273. EFFICIENCY.happiness = 1
  274. EFFICIENCY.farmers = 0.2
  275. EFFICIENCY.pestBonus = 0
  276. EFFICIENCY.woodcutters = 0.5
  277. EFFICIENCY.miners = 0.2
  278. EFFICIENCY.tanners = 0.5
  279. EFFICIENCY.blacksmiths = 0.5
  280. EFFICIENCY.apothecaries = 0.1
  281. EFFICIENCY.clerics = 0.05
  282. EFFICIENCY.soldiers = 0.05
  283. EFFICIENCY.cavalry = 0.08
  284.  
  285. Type TUPGRADES
  286.     domestication As Integer
  287.     ploughshares As Integer
  288.     irrigation As Integer
  289.     skinning As Integer
  290.     harvesting As Integer
  291.     prospecting As Integer
  292.     butchering As Integer
  293.     gardening As Integer
  294.     extraction As Integer
  295.     croprotation As Integer
  296.     selectivebreeding As Integer
  297.     fertilisers As Integer
  298.     masonry As Integer
  299.     construction As Integer
  300.     architecture As Integer
  301.     wheel As Integer
  302.     horseback As Integer
  303.     tenements As Integer
  304.     slums As Integer
  305.     granaries As Integer
  306.     palisade As Integer
  307.     weaponry As Integer
  308.     shields As Integer
  309.     writing As Integer
  310.     administration As Integer
  311.     codeoflaws As Integer
  312.     mathematics As Integer
  313.     aesthetics As Integer
  314.     civilservice As Integer
  315.     feudalism As Integer
  316.     guilds As Integer
  317.     serfs As Integer
  318.     nationalism As Integer
  319.     flensing As Integer
  320.     macerating As Integer
  321.     standard As Integer
  322.     deity As Integer
  323.     deityType As Integer
  324.     lure As Integer
  325.     companion As Integer
  326.     comfort As Integer
  327.     blessing As Integer
  328.     waste As Integer
  329.     stay As Integer
  330.     riddle As Integer
  331.     throne As Integer
  332.     lament As Integer
  333.     book As Integer
  334.     feast As Integer
  335.     secrets As Integer
  336.     trade As Integer
  337.     currency As Integer
  338.     commerce As Integer
  339. Dim Shared UPGRADES As TUPGRADES
  340.  
  341. Type TDEITY
  342.     nname As String * 20
  343.     ttype As String * 20
  344.     seniority As Integer
  345.     devotion As Integer
  346.     battle As Integer
  347.     fields As Integer
  348.     underworld As Integer
  349.     cats As Integer
  350. Dim Shared DEITY As TDEITY
  351. DEITY.seniority = 1
  352.  
  353. Type TACHIEVEMENTS
  354.     hamlet As Integer
  355.     village As Integer
  356.     smallTown As Integer
  357.     largeTown As Integer
  358.     smallCity As Integer
  359.     largeCity As Integer
  360.     metropolis As Integer
  361.     smallNation As Integer
  362.     nation As Integer
  363.     largeNation As Integer
  364.     empire As Integer
  365.     raider As Integer
  366.     engineer As Integer
  367.     domination As Integer
  368.     hated As Integer
  369.     loved As Integer
  370.     cat As Integer
  371.     glaring As Integer
  372.     clowder As Integer
  373.     battle As Integer
  374.     cats As Integer
  375.     fields As Integer
  376.     underworld As Integer
  377.     fullHouse As Integer
  378.     plague As Integer
  379.     ghostTown As Integer
  380.     wonder As Integer
  381.     seven As Integer
  382.     merchant As Integer
  383.     rushed As Integer
  384.     neverclick As Integer
  385. Dim Shared ACHIEVEMENTS As TACHIEVEMENTS
  386.  
  387. Type TTRADER
  388.     MATERIAL As Integer
  389.     REQUESTED As Integer
  390.     TTIMER As Integer
  391.  
  392. Dim Shared TRADER As TTRADER
  393.  
  394. Type TRAIDING
  395.     ISRAIDING As Integer
  396.     VICTORY As Integer
  397.     ITERATIONS As Integer
  398.     LAST As String * 20
  399. Dim Shared RAIDING As TRAIDING
  400. RAIDING.ISRAIDING = FALSE
  401. RAIDING.VICTORY = FALSE
  402.  
  403. Dim Shared TARGETMAX As String
  404. CIVTYPE = "THORP"
  405. TARGETMAX = "THORP"
  406.  
  407. Dim Shared resourceClicks As Integer
  408. Dim Shared logRepeat As Integer
  409. Dim Shared attackCounter As Integer
  410. Dim Shared tradeCounter As Integer
  411. Dim Shared throneCount As Integer
  412. Dim Shared pestTimer As Integer
  413. Dim Shared gloryTimer As Integer
  414. Dim Shared cureCounter As Integer
  415. Dim Shared graceCost As Integer
  416. Dim Shared walkTotal As Integer
  417. Dim Shared autosave As String * 4
  418. Dim Shared autosaveCounter As Integer
  419. Dim Shared customIncrements As Integer
  420. Dim Shared delimiters As Integer
  421. Dim Shared usingWords As Integer
  422. Dim Shared worksafe As Integer
  423. Dim Shared thissize As Integer
  424.  
  425. resourceClicks = 0
  426. logRepeat = 1
  427. attackCounter = 0
  428. tradeCounter = 0
  429. throneCount = 0
  430. pestTimer = 0
  431. gloryTimer = 0
  432. cureCounter = 0
  433. graceCost = 1000
  434. walkTotal = 0
  435. autosave = "on"
  436. autosaveCounter = 1
  437. customIncrements = FALSE
  438. delimiters = TRUE
  439. usingWords = FALSE
  440. worksafe = FALSE
  441. thissize = 1
  442.  



And I believe @Cobalt is correct - UDT fixed strings usually hold junk
Also, anyone have an idea how to use "name" in a UDT that doesnt produce an error?

14
QB64 Discussion / Re: simple array question (I forgot)
« on: December 22, 2021, 09:01:36 pm »
will do, when I finish the init section I'll run it and see if it gives me the required values
I'll post the results here.
but ya, its the UDT I am concerned about.

15
QB64 Discussion / simple array question (I forgot)
« on: December 22, 2021, 08:44:46 pm »
when initializing an array and type vars - do they start with empty strings or integers ?



I'm tinkering with a program but have tons of arrays and type vars, and just realized that I may have to do the famous loop to zero stuff out.
Do I still need to do that?

example
Code: QB64: [Select]
  1. type tRec
  2. var1 as integer
  3. var2 as string
  4.  
  5. type t2ndRec
  6. var1 as integer
  7. var2 as tRec

do these start off as zero for the var1 and empty string for the var2?




Pages: [1] 2 3 ... 19