Mittens 2018 will be in Boston this September. There are three spaces left, so check out the thread for details!

Author Topic: [SOLVED] Multiple Codes Keypad  (Read 93 times)

[SOLVED] Multiple Codes Keypad
« on: 03 Jan 2018, 06:27 »
EDIT: I'll leave the original post here but sorry I worked out a solution after posting it. I apologize as I don't know how to delete the post but the code may help others.




Hello,

So I've started working on my game again after a break due to personal reasons. Before the break I had help with an elevator keypad set up but couldn't find the post with the person who helped me, so, sorry about that.
I've since realized I'd like to use multiple codes and not just one, but I cannot. It would probably be easier to call up a dialog tree to choose the floor I'd like to travel to and may end up doing that, but I
was wondering if I could get some help to make it work with multiple codes and not just what I have here which works with 9 hotspots each corresponding to a number. The main problem is using the same hotspot/number in multiple codes. Any help would be greatly appreciated.

Thank you.

Code: Adventure Game Studio
  1. int sequence=0;
  2.  
  3. function hHotspot9_Interact()
  4. {
  5.  if (sequence == 0) sequence++;
  6.    else sequence = 0; // wrong combination, so start again
  7. }
  8.  
  9. function hHotspot3_Interact()
  10. {
  11.    if (sequence == 1) sequence++;
  12.    else sequence = 0; // wrong combination, so start again
  13.  
  14. }
  15.  
  16. function hHotspot6_Interact()
  17. {
  18.    if (sequence == 2) sequence++;
  19.    else sequence = 0; // wrong combination, so start again
  20. }
  21.  
  22. function hHotspot2_Interact()
  23. {
  24.   if (sequence == 3) { // correct combination so
  25.       player.ChangeRoom(6, 231, 135); // give player the ice cream
  26.    }
  27.    else sequence = 0; // wrong combination, so start again
  28. }
  29.  
  30. function hHotspot10_Interact()
  31. {
  32.   player.ChangeRoom(1, 161, 97);
  33. }
  34.  
« Last Edit: 03 Jan 2018, 06:30 by GameMaker_95 »