Attention! Animated numerical puzzle?

This forum is meant for posting anything related to Adventure Maker that doesn't fit in the other forums.Please post technical questions in the Technical Support Forum!

Moderators: time-killer-games, Vengeance66, Candle, reneuend, GM-Support

Attention! Animated numerical puzzle?

Postby Aiden » Sun Aug 26, 2007 7:17 pm

Hey!
I want to create animated numerical pazzle. Now i know how i can make static numerical puzzle:
http://adventuremaker.com/phpBB2/viewtopic.php?t=1276
Thanks to
riobros76

But i want to make numerical relieve one another, i want to make CLASSIC CODE LOCK.
But how?
Attachments
test_codelock1.jpg
test_codelock1.jpg (121.02 KiB) Viewed 7496 times
Aiden
Member
 
Posts: 20
Joined: Fri Jun 08, 2007 9:30 am

Postby Mystery » Mon Aug 27, 2007 1:46 am

Let me ask you: What do you understand under animated numerical puzzle? Would you like to have the numbers on the suitcase, and every time you click a number, it will increase (e.g. from 0 to 9)? And the player has to match the digits with the required code numbers?

If so, I would try to make an integer variable for each of the digits of the code, decrease them with every click, and display for every value another hotspot picture with the corresponding number. And when the number is correct it should have the value of 1 for example. :?

Sorry, just thinking loud since I haven't tried to do such a thing yet just planning to use it aswell, and I'm not very experienced with scripting. I'll try out something tomorrow (it's already very late here), and post if I have a more detailed idea that might work...

But I'm conviced that ShadowHunter would come up with a very elegant solution within minutes, lol :)

EDIT:
Yes, my idea works, but it's probably not a very elegant way of scripting it. :oops:
Anyhow, here is what I have done for a 3-digit lock. I've created 6 integer variables (maybe it would also work with only 3, I'm not sure): Digit1, Digit2, Digit3, Lock1, Lock2, Lock3. I've added 10 digits as hotspot images to the project (0.GIF, 1.GIF ..... 9.GIF).

I've loaded 0.GIF as image for all the 3 hotspots of the lock.
For the first lock that should have the value 5 if the player does it correctly, I've added the following code to the advanced tab of the hotspot properties:

Code: Select all
Digit1 = Digit1-1
If Digit1 = -1 then Action.LoadAPicture Hotspot(1), "1.GIF"
If Digit1 = -2 then Action.LoadAPicture Hotspot(1), "2.GIF"
If Digit1 = -3 then Action.LoadAPicture Hotspot(1), "3.GIF"
If Digit1 = -4 then Action.LoadAPicture Hotspot(1), "4.GIF"
If Digit1 = -5 Then Action.LoadAPicture Hotspot(1), "5.GIF"
If Digit1 = -6 then Action.LoadAPicture Hotspot(1), "6.GIF"
If Digit1 = -7 then Action.LoadAPicture Hotspot(1), "7.GIF"
If Digit1 = -8 then Action.LoadAPicture Hotspot(1), "8.GIF"
If Digit1 = -9 then Action.LoadAPicture Hotspot(1), "9.GIF"

If Digit1 = -5 Then
  Lock1=1
Else
  Lock1=0
End If


I did similarly with the other two locks.

Then I created a hotspot over the handle of the suitcase, and added the following code:
Code: Select all
If Lock1+Lock2+Lock3 = 3 Then
  Message "You opened the chest."
Else
  Message "It's locked."
End If


The question is still what happens after the player has reached the digit 9 on the lock: Should it go to zero, or get "stuck" on 9 (and a hotspot image of 0.GIF loaded when the player leaves) etc.

Well, this is probably a too complicated way, but it works :wink:
You could still wait for ShadowHunter's idea. :)
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Postby Aiden » Wed Aug 29, 2007 9:27 pm

Thanks Mystery!
That is one of most main puzzle of adventure i think.

I try it letar...
Aiden
Member
 
Posts: 20
Joined: Fri Jun 08, 2007 9:30 am

Postby Mystery » Thu Aug 30, 2007 1:31 am

Okay, and let me know if you need more help :)
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Postby Aiden » Fri Sep 07, 2007 2:01 pm

Mystery wrote:The question is still what happens after the player has reached the digit 9 on the lock: Should it go to zero, or get "stuck" on 9 (and a hotspot image of 0.GIF loaded when the player leaves) etc.


Yes! It should go to zero (loop).
Help again please...
Aiden
Member
 
Posts: 20
Joined: Fri Jun 08, 2007 9:30 am

Postby Mystery » Fri Sep 07, 2007 6:51 pm

I think that this might work, if you add two lines in the Advanced tab of your first lock.
Code: Select all
Digit1 = Digit1-1
If Digit1 = -1 then Action.LoadAPicture Hotspot(1), "1.GIF"
If Digit1 = -2 then Action.LoadAPicture Hotspot(1), "2.GIF"
If Digit1 = -3 then Action.LoadAPicture Hotspot(1), "3.GIF"
If Digit1 = -4 then Action.LoadAPicture Hotspot(1), "4.GIF"
If Digit1 = -5 Then Action.LoadAPicture Hotspot(1), "5.GIF"
If Digit1 = -6 then Action.LoadAPicture Hotspot(1), "6.GIF"
If Digit1 = -7 then Action.LoadAPicture Hotspot(1), "7.GIF"
If Digit1 = -8 then Action.LoadAPicture Hotspot(1), "8.GIF"
If Digit1 = -9 then Action.LoadAPicture Hotspot(1), "9.GIF"
If Digit1 = -10 then Digit1 = 0
If Digit1 = 0 then Action.LoadAPicture Hotspot(1), "0.GIF"


If Digit1 = -5 Then
  Lock1=1
Else
  Lock1=0
End If

Try it, and let me know if there are any problems :)
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Postby ShadowHunter » Fri Sep 07, 2007 10:03 pm

Hi,

You can strongly reduce the code by passing the variable to the filename :D

Code: Select all
Digit1 = Digit1-1
If Digit1 = -10 then Digit1 = 0: Exit Sub
Action.LoadAPicture Hotspot(1), ABS(Digit1) & ".GIF"
If Digit1 = -5 Then  Lock1=1 Else Lock1=0

Need some slight adjustment

ABS returns the absolute value so -1 becomes 1 adding this to .GIF with the & symbol results in 1.GIF :D

Isn't coding GREAT 8)

Good luck,

With best regards,

ShAdOwHuNtEr
User avatar
ShadowHunter
Forum Admin and Games Page admin
 
Posts: 1304
Joined: Fri Jun 06, 2003 10:37 pm
Location: Belgium

Postby Mystery » Sat Sep 08, 2007 12:55 am

Yay, finally; I was waiting for your elegant solution as mentioned above :D
Thank you!
Yes, coding is great if someone is able to use it in an elegant way :lol:
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Postby Aiden » Sat Sep 08, 2007 10:46 am

Mystery wrote:Then I created a hotspot over the handle of the suitcase, and added the following code:
Code: Select all
If Lock1+Lock2+Lock3 = 3 Then
  Message "You opened the chest."
Else
  Message "It's locked."
End If



I use your code because in Shadowhunter code becomes something strange with number 0. It just not appear.

Anyway some kind of lock need automatic unlock after right combination.
So code

Code: Select all
If Lock1+Lock2+Lock3 = 3 Then
  Message "You opened the chest."
End If


need to run automatically...How?

Final step, Mystery. :)

[/quote]
Aiden
Member
 
Posts: 20
Joined: Fri Jun 08, 2007 9:30 am

Postby Mystery » Sat Sep 08, 2007 6:35 pm

Yes, indeed the 0.GIF doesn't load in ShadowHunter's solution.
Shadow, any ideas how to fix this?

@Aiden
Just add to every Advanced Tab of your locks at the end something like:
Code: Select all
If Lock1+Lock2+Lock3 = 3 Then
  Action.GoToFrame "OpenChest"
End If
 


For me it worked, but please test it thoroughly :)
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Postby ShadowHunter » Sun Sep 09, 2007 12:47 am

Hi,

If refering to the -10 value, remove the "Exit Sub" command.

The absolute value of 0 is 0 so that cannot be the culprit 8)

Good luck,

With best regards,

ShAdOwHuNtEr
User avatar
ShadowHunter
Forum Admin and Games Page admin
 
Posts: 1304
Joined: Fri Jun 06, 2003 10:37 pm
Location: Belgium

Postby Mystery » Sun Sep 09, 2007 12:54 am

Great, just tried, everything works fine. Thank you! :)
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Postby ShadowHunter » Sun Sep 09, 2007 1:15 am

Glad it works :D
User avatar
ShadowHunter
Forum Admin and Games Page admin
 
Posts: 1304
Joined: Fri Jun 06, 2003 10:37 pm
Location: Belgium


Return to Adventure Maker General Discussion

Who is online

Users browsing this forum: No registered users and 0 guests

cron