Jump to content


Photo

Solved, I'm a derp


  • Please log in to reply
4 replies to this topic

#1 CompahQ

CompahQ

    GMC Member

  • New Member
  • 155 posts

Posted 04 August 2012 - 11:14 PM

Hello, everyone! I'm trying to add a button configuration option to a game I'm making, but I'm not exactly sure how to do it. Right now, I have an object and under the step event it checks if any key is pressed, and then sets a variable to keyboard_lastkey. This gives me a "Variable Name Expected" error, though, so I'm not sure what to do. Any ideas?

Edited by CompahQ, 05 August 2012 - 03:58 AM.

  • 0

#2 Dangerous_Dave

Dangerous_Dave

    GMC Member

  • Global Moderators
  • 9276 posts
  • Version:Unknown

Posted 04 August 2012 - 11:45 PM

keyboard_lastkey is already a variable that holds the keycode of the last key pressed. You can't change it, though. If you are using your own variable, call it something different ;)
  • 0

#3 CompahQ

CompahQ

    GMC Member

  • New Member
  • 155 posts

Posted 04 August 2012 - 11:50 PM

Well, I'm trying to set a different variable to be equal to the keyboard_lastkey variable. It gives me an error though, so I'm not sure what to do.
  • 0

#4 SlipknLov

SlipknLov

    GMC Member

  • GMC Member
  • 236 posts
  • Version:GM8

Posted 04 August 2012 - 11:57 PM

for your [create]:
lst=0;
then for your [step]
if keyboard_check_pressed(vk_anykey) then
{ lst = keyboard_lastkey; }

Edited by SlipknLov, 05 August 2012 - 12:52 AM.

  • 0

#5 CompahQ

CompahQ

    GMC Member

  • New Member
  • 155 posts

Posted 05 August 2012 - 03:57 AM

Thanks for the help everyone, but as it turns out, the problem was because I had the key stored as a constant. I feel kind of stupid. :P Anyway, I changed it to being a variable instead and it works just fine. Thanks again!
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users