Author Topic: Pre-programmed keyboard prompts  (Read 3712 times)

0 Members and 1 Guest are viewing this topic.

Offline Doan Sephim

Pre-programmed keyboard prompts
« on: March 23, 2007, 12:54:47 PM »
I have been trying without success to add a couple menubar options similar to the "retype" function but with "common phrases" ("ask about" and "tell about")...

In trying to do this I thought I would look at the retype function and adjust it a little, but it proves to be more complex than I first thought, at least for me ;)

the retype code:
Code: [Select]
(case MENU_RETYPE
  (send pEvent:
     claimed(FALSE)
     type(evKEYBOARD)
     message( (User:echo) )
  )
)

I thought it would simply be putting "ask about" in the place of (User:echo), but it turns out that that was an oversimplification. I looked through the User Script to see how the User:echo function worked, but I must confess it confused me even more.

So, any ideas?


Artificial Intelligence Competition

Offline lskovlun

Re: Pre-programmed keyboard prompts
« Reply #1 on: March 23, 2007, 03:58:56 PM »
The inputLineAddr selector is what you're looking for. Use it like so:

StrCpy((User:inputLineAddr) "ask about")

The rest of the code should be similar to what you posted.

Lars

Offline Doan Sephim

Re: Pre-programmed keyboard prompts
« Reply #2 on: March 23, 2007, 04:50:54 PM »
Thanks Iskovlum! It took me a while to figure out how it all worked. I wasn't entirely sure where to put the code or even what exactly it did, but I noticed when I ran the StrCpy((User:inputLineAddr) "ask about") it did not bring up the prompt...but then I checked my "retype" button and it prompted "ask about" even though I did not type it.

So then I figured out that the code you were suggesting (if I have this right) is to use the exact same code as the "retype" except that before you run it, you change the the contents of the last input to "ask about" and then it "retypes" that phrase instead!

It looked like this:
Code: [Select]
(case MENU_RETYPE
  StrCpy((User:inputLineAddr) "ask about")
  (send pEvent:
     claimed(FALSE)
     type(evKEYBOARD)
     message( (User:echo) )
  )
)
Thanks again!


SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.042 seconds with 23 queries.