DesignCAD 3D Max 2027 box
Now available

DesignCAD 2027

Hatches that follow their boundaries, an on-screen dial to turn your model, and a way to find any command by name, in a clean Windows 11 look.

User Input During Macro Functions

Started by landonairey, August 22, 2013, 07:18:36 AM

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

landonairey

Hi there,

   Does anyone know a clever way to get keyboard input data while a macro is firing off many commands. Typically this is done with a statement such as "anykey key". However, that method requires the macro to wait at that step without continuing. Maybe there is a simple ISR I could model and periodically search for any change in a keyboard input?

prl

Well you could use Autohotkey.  They have a program called AutoScripWriter that will record keyboard and mouse activity.

What are you trying to do?  Normally if you are pausing a basiccad program for user input using the "input" statement and you want an automatic response, you can skip that line of coding in your program and define the value or response you need.

landonairey

     Out of curiosity (and humor) I made a macro that plays a game of old school pong. I wanted to check keyboard inputs for the up/down arrow keys to slide that block on the side that bounces the pong ball. I've made a pseudo random number generator (seeding off the system time) which slightly alters the deflection path of the pong ball on the walls so it never retraces it's path. For now I'm using the >getxy command which pulls the y coord from the mouse and if that changes, it changes the position of player 1's block. Every 10 back and forth patterns the pong changes to a different color and speeds up.

     So not very important as you can see, but I am curious about reading in user inputs while a macro is running through a list of other functions.   :D

prl

Quote from: landonairey on August 22, 2013, 10:08:44 AM
So not very important as you can see, but I am curious about reading in user inputs while a macro is running through a list of other functions.   :D

DesignCAD's macro facility, in my opinion, isn't really a true macro facility.  It is a partially automated system for creating basicCAD programs. 

samdavo

#4
Quote from: landonairey on August 22, 2013, 10:08:44 AM
      Every 10 back and forth patterns the pong changes to a different color and speeds up.
:D
landon,
about time old school pong had a makeover :)
and you sound like the sort of enthusiast to handle the challenge, lol.
Just warn everyone that the ball can change to a psychedelic and/or psycho superball, and sometimes, just when you're becoming complacent that you've got the pongs worked out, heck it throws in a ping - or randomly even a super-ping! 
At least it changes colour to give you a clue.
Heck, you could market it as "the ping with a sling";  or the "pong with a sprong" maybe ; or ping with a spring maybe; or a sting for that matter. (2 cents).

See, the trouble with the world today, too few people are interested in the REAL challenges.  I mean, once we got to the moon, the pioneering spirit out there just ....  seems to have gone off the boil somehow   :-\ 

PS I used to have a pang for pong as well.
PS - If you can stand some constructive criticism, you say every 10 bounces, it changes behaviour.  If you were to make that every 12 or 14, - and variable - it would make it more unpredictable, and also more difficult for people to count and be prepared - and most people have 10 fingers and/or toes for instance, and only a few have 14.
PS anyway, high sevens, and cheers, lol.