QB64.org Forum

Active Forums => QB64 Discussion => Topic started by: Pete on September 30, 2021, 11:28:23 pm

Title: Need help finishing my HELLO WORLD program.
Post by: Pete on September 30, 2021, 11:28:23 pm
The "O" is out on my keyboard and so far, it's just been HELL

Pete
Title: Re: Need help finishing my HELLO WORLD program.
Post by: bplus on September 30, 2021, 11:32:28 pm
Another liar ;-)) What key is out on your keyboard?
Title: Re: Need help finishing my HELLO WORLD program.
Post by: Pete on September 30, 2021, 11:40:52 pm
Ah... Sent from my iphone. :D
Title: Re: Need help finishing my HELLO WORLD program.
Post by: bplus on September 30, 2021, 11:48:46 pm
Chr$(79)

Code: QB64: [Select]
  1. a$ = "HELL0 W0RLD"
  2. For i = 1 To Len(a$)
  3.     If Mid$(a$, i, 1) = "0" Then Print Chr$(79); Else Print Mid$(a$, i, 1);
  4.  
Title: Re: Need help finishing my HELLO WORLD program.
Post by: SMcNeill on October 01, 2021, 12:17:06 am
Do this:

Hold ALT down
Press 0, release.
Press 7, release.
Press 9, release.
Release ALT
Title: Re: Need help finishing my HELLO WORLD program.
Post by: johnno56 on October 01, 2021, 01:48:03 am
I use a much simpler method, in the event of key/keyboard failure, the exchange method. I used to pull apart keyboards and repair them myself. Failing eyesight changed 'that' solution. Now, all I do is, travel to a PC store and exchange dollars for a new keyboard.... Moo Ha Ha...  Of course, the exchange method, works better for desktop keyboards... Moo Ha Ha...
Title: Re: Need help finishing my HELLO WORLD program.
Post by: Pete on October 01, 2021, 01:19:30 pm
Well kidding aside, I did have a keyboard problem years ago. I ended up buying a USB keyboard for my laptop, but before I did, I got by using the Windows virtual keyboard for a couple of days. Now if you will excuse me, my HELLO WORLD program isn't going to finish itself. Ah, my crowning achievement... with a little help from spell check.

Pete
Title: Re: Need help finishing my HELLO WORLD program.
Post by: bplus on October 01, 2021, 01:47:28 pm
What if the only key that works is the spacebar?!?!

The current game competition at Syntax Bomb allows you to have only one key (or mouse button or joystick button) on or off (no analog like using mouse position for range of options of position).

I was wondering how one could access the whole key board with only one button like the spacebar. I tried going down the alphabet highlighting one letter at a time, you press the spacebar if that letter is what you want next. Then I needed to add numbers for a menu of commands including and specially a backspace command using 4 to signal that. So flashing a letter every 2 secs takes nearly a minute to input a letter for some, yikes!

So I broke up the letters into rows and put _ at beginning and end for going up or down in the rows, so now if they are flashed and when you press spacebar on those you go down a row unless at last row, you start back at beginning.

Want to see and test how that works?

Code: QB64: [Select]
  1. _Title "One Key - spacebar  menu 4 is backspace to erase last letter"
  2.  
  3. For i = 1 To 20
  4.     x$ = GetInput$(10, 10)
  5.     If x$ = "4" Then ' back space to erase
  6.         If Len(inp$) Then inp$ = Left$(inp$, Len(inp$) - 1)
  7.     Else
  8.         inp$ = inp$ + x$
  9.     End If
  10.     Cls
  11.     Locate 1, 1: Print inp$
  12.  
  13.  
  14. Function GetInput$ (LocateCol, LocateRow)
  15.     Dim g$(5)
  16.     g$(0) = "_ABCDE_"
  17.     g$(1) = "_FGHIJ_"
  18.     g$(2) = "_KLMNO_"
  19.     g$(3) = "_PQRST_"
  20.     g$(4) = "_UVWXY_"
  21.     g$(5) = "_Z1234_"
  22.  
  23.     py = 0: px = 0
  24.     Do
  25.         GoSub show
  26.         lp = lp + 1
  27.         If lp = 60 Then
  28.             lp = 0
  29.             px = px + 1
  30.             If px > 6 Then px = 0
  31.         End If
  32.         If InKey$ = " " Then
  33.             If pick$ = "_" Then
  34.                 py = py + 1
  35.                 If py > 5 Then py = 0
  36.             Else
  37.                 GetInput$ = pick$: Exit Function
  38.             End If
  39.         Else
  40.         End If
  41.         Locate 1, 40: Print py, px
  42.         _Limit 60
  43.     Loop
  44.  
  45.     show:
  46.     For row = 0 To 5
  47.         For col = 0 To 6
  48.             If col = px And row = py Then Color 0, 15: pick$ = Mid$(g$(row), col + 1, 1) Else Color 15, 0
  49.             Locate LocateRow + row, LocateCol + col: Print Mid$(g$(row), col + 1, 1);
  50.         Next
  51.     Next
  52.     Color 15, 0
  53.     Return
  54.  
  55.  

This is harder than putting names and phone numbers in the phone!



Title: Re: Need help finishing my HELLO WORLD program.
Post by: SMcNeill on October 01, 2021, 02:00:10 pm
For one key, create an ASCII chart and navigate it via timed presses. 
No tap, no hold, no input for 3 seconds = input accepted.
No tap, no, hold, no input for 5 seconds = input finished.
One tap, no hold = move selector one spot
One tap, key held = move selector in auto-scroll at 10 characters per second or so

So hello would be:
Press, hold to H. 
Release, wait 3 seconds for acceptance.
Press, hold to E.
Release, wait 3 seconds for acceptance.
Press, hold to L….
…so on…
Press, hold for D.
Release, wait 3 seconds for acceptance.
Do nothing.  Wait 5 more seconds to terminate with finished input.



Seems like a simple enough one-key input system.  ;D
Title: Re: Need help finishing my HELLO WORLD program.
Post by: Pete on October 01, 2021, 02:05:34 pm
That might work. It's faster than I type, anyway!

Actually, it reminds me of putting in my wifi code in my printer/fax numeric dial pad.

Pete
Title: Re: Need help finishing my HELLO WORLD program.
Post by: bplus on October 01, 2021, 03:12:53 pm
For one key, create an ASCII chart and navigate it via timed presses. 
No tap, no hold, no input for 3 seconds = input accepted.
No tap, no, hold, no input for 5 seconds = input finished.
One tap, no hold = move selector one spot
One tap, key held = move selector in auto-scroll at 10 characters per second or so

So hello would be:
Press, hold to H. 
Release, wait 3 seconds for acceptance.
Press, hold to E.
Release, wait 3 seconds for acceptance.
Press, hold to L….
…so on…
Press, hold for D.
Release, wait 3 seconds for acceptance.
Do nothing.  Wait 5 more seconds to terminate with finished input.


Seems like a simple enough one-key input system.  ;D


Timing your holds is getting dangerously close to analog input, not simple On/Off but OK lets see code for a test ;-))  PS I was thinking Morse Code but ruled it out because it seemed analog-ish too.

I think it's still going to take some time tapping you way to end of alphabet for those letters towards the end.

We could put most used letters towards beginning but then gets hard to predict the order?

Title: Re: Need help finishing my HELLO WORLD program.
Post by: Pete on October 01, 2021, 03:23:40 pm
Keep it going, and we're going to see the birth of QB-Short-Hand-BASIC.

4i 1 2 50
Next

DOu i 50
LOOP

myfile$ binary 1
Close 1

etc...