dMZX Forums: if keypressed? - dMZX Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

if keypressed?

#1 User is offline   cwags55 

  • Member
  • PipPip
  • Group: Members
  • Posts: 56
  • Joined: 14-October 00

Posted 07 December 2006 - 07:12 PM

I haven't used MZX in at least a year and I am having trouble remembering some code.

Isn't there a way to give any particular key the same properties as Spacebar and Delete?

i.e. If keyq pressed "go"

Any help is much appreciated.
cwags55
Uniquesoft
0

#2 User is offline   LogiCow 

  • Holiday cow
  • PipPipPipPipPip
  • Group: Members
  • Posts: 2,671
  • Joined: 18-July 02
  • Gender:Male
  • Location:Quebec

Posted 07 December 2006 - 07:18 PM

Keys have numeric codes associated to them.

Say you want to test if key45 is pressed, then it's

if "key45" = 1 "laserbeam"

You can also use key_code or keycode or whatever it is (I think it's key_code) to see which key is currently pressed.
0

#3 User is offline   Skylark 

  • AFK
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,823
  • Joined: 29-July 03
  • Gender:Male

Posted 07 December 2006 - 11:12 PM

Yes it is key_code.

To find out what the key_codes are and perhaps write down the ones you want to use, just have a blank board with 1 robot:

: "loop"
* "&key_code&"
wait 1
goto "loop"


Easy.
0

#4 User is offline   T-Bone 

  • Wastelander
  • PipPipPipPipPip
  • Group: Members
  • Posts: 2,487
  • Joined: 16-August 02
  • Gender:Male
  • Location:Canada

Posted 15 December 2006 - 03:08 AM

This is very simple. Use key_code. Its very reliable and maps out most of the keys on all keyboards.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

2 User(s) are reading this topic
0 members, 2 guests, 0 anonymous users