Page 1 of 1

Button Sequence Puzzle - The very basics

PostPosted: Sun May 29, 2011 9:25 pm
by reneuend
If you want to create a puzzle where the player must solve the sequence, here is a very basic solution. It is designed to be highly customizable, which I will show in the next BBB issue! :wink:

Note: If you can't extract the code, let me know and I'll add a text file.

http://hickchickgames.com/downloads/A%20Sequence%20Puzzle.pdf
(not editable)

http://hickchickgames.com/downloads/A%20Sequence%20Puzzle.docx
(editable)

http://hickchickgames.com/downloads/sequence.zip
(Example AM Project File)

PostPosted: Mon May 30, 2011 5:16 am
by mercedes
This is perfect!!!!! :D

... i took out the one sub..so no message boxes..type thing..I want them to not be sure what to do...
Only realize it when they click one and it goes down....and then so on.....But i figured you put that in there for us to see how it works. It's perfect. :D

Thx so much!~

PostPosted: Mon May 30, 2011 5:43 am
by reneuend
Great!

Yes, I put it in there because I thought it would be easier to see what was going on, and so it would give someone the ability to separate their code should they want to do a lot more then what I did!

PostPosted: Mon May 30, 2011 5:54 pm
by ZeornWarlock
reneuend,

Do you have a win xp version of your "example"? The one you have here is for win 7 only! :( I'd check out the code only, but I'm a visual person! :P

ZW.

PostPosted: Mon May 30, 2011 6:49 pm
by reneuend
What is win7 only? The project should work in XP or Win7.
Please let me know what it is you can't use from XP and I'll fix it!

PostPosted: Mon May 30, 2011 7:39 pm
by ZeornWarlock
reneuend wrote:What is win7 only? The project should work in XP or Win7.
Please let me know what it is you can't use from XP and I'll fix it!


I suppose it should work and I think the reason it does not for me is because I still have the previous version of AM. But that's because here... http://www.adventuremaker.com/downloads.htm it states the latest version is for win 7 only which is the reason I did not update. If that version works with xp, then it should be noted and I will update of course. ;)

ZW.

PostPosted: Mon May 30, 2011 8:40 pm
by reneuend
(updated) There isn't anything in the project I made that was special to Win7. I bet the project itself would work in your version. Have you tried it?

It wouldn't be too hard to build if you follow the instructions I sent. After copying and pasting the code, you only need to updated the highlighted areas...and there is only 3 per hotspot if I remember right. Can you open the "docx" file?

PostPosted: Mon May 30, 2011 10:17 pm
by mercedes
ZeornWarlock wrote:
I suppose it should work and I think the reason it does not for me is because I still have the previous version of AM. But that's because here... http://www.adventuremaker.com/downloads.htm it states the latest version is for win 7 only which is the reason I did not update. If that version works with xp, then it should be noted and I will update of course. ;)

ZW.


Are you talking about the message that comes up with AM..when you first try and launch something that is made with a newer version of AM..?

Just ignore that..[Hit ok] If that's indeed what you're talking about...

I have XP..and I have 4.52 AM..All worked out fine for me..:)

PostPosted: Tue May 31, 2011 5:41 am
by ZeornWarlock
reneuend wrote:(updated) There isn't anything in the project I made that was special to Win7. I bet the project itself would work in your version. Have you tried it?

It wouldn't be too hard to build if you follow the instructions I sent. After copying and pasting the code, you only need to updated the highlighted areas...and there is only 3 per hotspot if I remember right. Can you open the "docx" file?


reneuend, I wasn't referring ?you? to update your file; it was GM-Support that I was referring to, as he should update the notice about compatibility. Very sorry for that!

As mercedes mentioned, that was the report I was getting. I tried it anyway and it did work.

Very cool stuff and always useful. :)

ZW.

PostPosted: Wed Jul 27, 2011 12:18 am
by Vengeance66
I figure out everything, but when you get the correct order nothing happens...

I want to go to another frame... if that is possible...

Edit: This is the error after the correct sequence when nothing happens and when you click on a hotspot...

Code: Select all
function GetSequenceVal(sequence_pos)

  GetSequenceVal = GetWord(sequence_pos,sequence,",")

End Function




sub DisplayFail()

  Action.Message "Wrong melody!"

End Sub


sub DisplaySuccess()

  Action.Message "That is correct!"

  ResetGame()

End Sub



sub ResetGame()

  Action.GoToFrame Action.GetCurrentFrameName

End Sub





Function GetWord(index,text,delimiter)

Dim aWords

If ltrim(text) = "" Then
   GetWord = ""
   Exit Function
End If

If index > 0 Then
  index = index - 1
Else
  GetWord = ""
  Exit Function
End If

aWords = Split(text, delimiter)


If ubound(aWords) < index Then
  GetWord = ""
  Exit Function
End If

GetWord = ltrim(aWords(index))

End Function

PostPosted: Wed Jul 27, 2011 3:32 am
by reneuend
It looks to me that you are comparing a String with an Integer. I'd need to see your code in order to determine what's going on.

Did you download the files I have listed?

PostPosted: Wed Jul 27, 2011 9:03 am
by Vengeance66
reneuend wrote:It looks to me that you are comparing a String with an Integer. I'd need to see your code in order to determine what's going on.

Did you download the files I have listed?


Yes. The code was from the project of yours. When you press the spots in wrong order, message shows in the lower section that is wrong. And if you get the order right, nothing happens...

PostPosted: Thu Jul 28, 2011 3:31 am
by reneuend
I sent you a PM on how to do the sequence you wanted.

PostPosted: Thu Jul 28, 2011 10:38 am
by Vengeance66
reneuend wrote:I sent you a PM on how to do the sequence you wanted.


Thanks a lot reneuend

PostPosted: Thu Jul 28, 2011 11:37 am
by Vengeance66
Ok this is my last try...

This is in the procedures tab:

Code: Select all
function GetSequenceVal(sequence_pos)

  GetSequenceVal = GetWord(sequence_pos,sequence,",")

End Function

sub DisplayFail()

  Message "Wrong melody"


End Sub

sub DisplaySuccess()
  Message "It is correct!"
  ResetGame()

End Sub

sub ResetGame()

  Action.GoToFrame Action.GetCurrentFrameName

End Sub


Function GetWord(index,text,delimiter)

Dim aWords

If ltrim(text) = "" Then
   GetWord = ""
   Exit Function
End If

If index > 0 Then
  index = index - 1
Else
  GetWord = ""
  Exit Function
End If

aWords = Split(text, delimiter)


If ubound(aWords) < index Then
  GetWord = ""
  Exit Function
End If

GetWord = ltrim(aWords(index))

End Function


This is in the hotspots:


Code: Select all
btn_press_count = btn_press_count + 1

keynum = 1


expected_val = GetSequenceVal(btn_press_count)


If keynum = cint(expected_val) Then
    'correct sequence val
    If btn_press_count >= 12 Then
   DisplaySuccess()
    End If
Else
    'WRONG sequence
    DisplayFail()
    ResetGame()
End If


And this is in the correct hotspots, there are 8 correct:

Code: Select all
keycount = keycount + 1

    If keycount = 8 Then
      CorrectTune = CorrectTune + 1
      If CorrectTune = 8 Then
        Action.GoToFrame "room 3 correct"
      Else
        keycount = 0
        CorrectTune = 0
        Action.Message "Incorrect Tune. Try again!"
      End If
    Else
      'do nothing. the player missed.
    End If


Again, and again, and again... I get the same error... Is it because I use Win 7? Is it because I use older version of AM? Or it is the coding?

PostPosted: Thu Jul 28, 2011 2:21 pm
by reneuend
The code I PMed you with doesn't go with the rest of the code. You had asked for a different kind of puzzle in your PM. :wink:

You can remove Everything except the last code box in your message. You only need the code that goes behind the hotspots.

PostPosted: Thu Jul 28, 2011 2:33 pm
by Vengeance66
reneuend wrote:The code I PMed you with doesn't go with the rest of the code. You had asked for a different kind of puzzle in your PM. :wink:

You can remove Everything except the last code box in your message. You only need the code that goes behind the hotspots.


I'll try then with both cases... Thanks!

PostPosted: Thu Jul 28, 2011 2:40 pm
by reneuend
be sure to create 2 integer variables in the variable list:

keycount
CorrectTune

also, I suggest starting with a small sequence. No bigger than 3 hotspots to start with.

PostPosted: Thu Jul 28, 2011 4:18 pm
by Vengeance66
reneuend wrote:be sure to create 2 integer variables in the variable list:

keycount
CorrectTune

also, I suggest starting with a small sequence. No bigger than 3 hotspots to start with.


I kinda made this puzzle right! :D

I put the codes from your project for the third time and I know were it was my mistake. Instead of 8 correct, I've put 12 in the codes of the hotspot. Now when you get the correct tune you go to the correct tune :D

Thanks a lot! You were a huge help to my project...

PostPosted: Thu Jul 28, 2011 7:50 pm
by reneuend
NP. I'm glad you got it working. :wink: