Another "blocks" question

This forum is meant for people to share their knowledge by writing their own tutorials for Adventure Maker.

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

Another "blocks" question

Postby laserman » Tue Mar 25, 2008 3:02 pm

As I am moving along in AM and learning, I had another thought which brings up another question....

Referring to my coloring blocks question in post: http://www.adventuremaker.com/phpBB2/vi ... php?t=3683
Let's say I want to color a few blocks. Then I would like to retain that information and re-open the original set of blocks to color again, then retain that information in addition to the previous, basically doing this over and over again so that I have several different sets (or frames if you will) of differently colored blocks.

I don't want to open all of them at once, but what I would like to do is to be able to cycle through them using an "up" and "down" button, but also be able to "save" it this way. My question is a 2 part one:
Would I have to have several images of the same uncolored blocks and open each one independently each time I want to use different colors (and retain the previously colored ones), or can I use just the original uncolored frame, color the blocks, then press my "up" or "down" button to have the original gray block frame open so that I can re-color them, but be able to save the previous color position?

Did I confuse you? I almost did me.
:)
I included an image to (hopefully) help clarify what it is I want to do.
Thank you in advance for any help.
Attachments
multiblox.jpg
multiblox.jpg (13.89 KiB) Viewed 6913 times
laserman
Member
 
Posts: 16
Joined: Fri Mar 21, 2008 6:06 pm

Postby Lyberodoggy » Tue Mar 25, 2008 3:10 pm

You are able to save the current situation of the blocks and then clear them to repeat the process. To do so, you just need to write the current situation to a .INI file using the command Action.WriteINI.
I 'm going to think about the method and write again when I have it planned.


PS: Please don't write new posts about the same Subject. Just ask your new questions replying to the older post.
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby Lyberodoggy » Tue Mar 25, 2008 4:27 pm

Okay, here's how to solve it:
Create three integer variables: color, framenumber and hotspotnumber.
Now alter the code in the hotspots like this:
Code: Select all
color=InputBox("input a number between 1 and 9","The name")
Select Case color
 case 1
 Action.LoadAPicture Hotspot(Action.GetHotspotNumber), "green.jpg"
 case 2
 Action.LoadAPicture Hotspot(Action.GetHotspotNumber), "red.jpg"
 case 3
 Action.LoadAPicture Hotspot(Action.GetHotspotNumber), "purple.jpg"
 case 4
 Action.LoadAPicture Hotspot(Action.GetHotspotNumber), "yellow.jpg"
 case 5
 Action.LoadAPicture Hotspot(Action.GetHotspotNumber), "black.jpg"
 case 6
 Action.LoadAPicture Hotspot(Action.GetHotspotNumber), "white.jpg"
 case 7
 Action.LoadAPicture Hotspot(Action.GetHotspotNumber), "gray.jpg"
 case 8
 Action.LoadAPicture Hotspot(Action.GetHotspotNumber), "maroon.jpg"
 case 9
 Action.LoadAPicture Hotspot(Action.GetHotspotNumber), "olive.jpg"
End Select
If color=>1 and color=<9 Then
hotspotnumber=Action.GetHotspotNumber
Action.WriteINI "blockrecord.ini",framenumber,hotspotnumber,color
End If


Now create a back and a forward button (two hotspots resembling these buttons anyway :P)
Go to advanced of the back button
Paste this code:
Code: Select all
If framenumber=0 Then
MsgBox "This is the last frame"
Else
framenumber=framenumber-1
For i=1 to 9
color=Action.ConvertToNumber(Action.ReadINI("blockrecord.ini",framenumber,i))
Select Case color
Case 1
 Action.LoadAPicture Hotspot(i), "green.jpg"
Case 2
 Action.LoadAPicture Hotspot(i), "red.jpg"
Case 3
 Action.LoadAPicture Hotspot(i), "purple.jpg"
Case 4
 Action.LoadAPicture Hotspot(i), "yellow.jpg"
Case 5
 Action.LoadAPicture Hotspot(i), "black.jpg"
Case 6
 Action.LoadAPicture Hotspot(i), "white.jpg"
Case 7
 Action.LoadAPicture Hotspot(i), "gray.jpg"
Case 8
 Action.LoadAPicture Hotspot(i), "maroon.jpg"
Case 9
 Action.LoadAPicture Hotspot(i), "olive.jpg"
End Select
Next
End If


Go to Forward button's advanced and paste these lines:

Code: Select all
framenumber=framenumber+1
For i=1 to 9
color=Action.ConvertToNumber(Action.ReadINI("blockrecord.ini",framenumber,i))
Select Case color
Case 0
 Action.LoadAPicture Hotspot(i), ""
Case 1
 Action.LoadAPicture Hotspot(i), "green.jpg"
Case 2
 Action.LoadAPicture Hotspot(i), "red.jpg"
Case 3
 Action.LoadAPicture Hotspot(i), "purple.jpg"
Case 4
 Action.LoadAPicture Hotspot(i), "yellow.jpg"
Case 5
 Action.LoadAPicture Hotspot(i), "black.jpg"
Case 6
 Action.LoadAPicture Hotspot(i), "white.jpg"
Case 7
 Action.LoadAPicture Hotspot(i), "gray.jpg"
Case 8
 Action.LoadAPicture Hotspot(i), "maroon.jpg"
Case 9
 Action.LoadAPicture Hotspot(i), "olive.jpg"
End Select
Next


supposing that you have these names for the pictures of the blocks. Replace them with the ones you use.

Lastly go to frame's advanced and paste this one:
Code: Select all
For i=1 to 9
color=Action.ConvertToNumber(Action.ReadINI("blockrecord.ini",framenumber,i))
Select Case color
Case 0
 Action.LoadAPicture Hotspot(1), ""
Case 1
 Action.LoadAPicture Hotspot(i), "green.jpg"
Case 2
 Action.LoadAPicture Hotspot(i), "red.jpg"
Case 3
 Action.LoadAPicture Hotspot(i), "purple.jpg"
Case 4
 Action.LoadAPicture Hotspot(i), "yellow.jpg"
Case 5
 Action.LoadAPicture Hotspot(i), "black.jpg"
Case 6
 Action.LoadAPicture Hotspot(i), "white.jpg"
Case 7
 Action.LoadAPicture Hotspot(i), "gray.jpg"
Case 8
 Action.LoadAPicture Hotspot(i), "maroon.jpg"
Case 9
 Action.LoadAPicture Hotspot(i), "olive.jpg"
End Select
Next


This is the best I can do, hope it solved the problem.
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby laserman » Tue Mar 25, 2008 5:19 pm

Ok, thanks.

I will play around with it over the next few days and let you know. Rather than confuse the 2 posts I would think I should reply to this post here, and future questions to the original post in the Tutorial section.

Thank you very much for your help, I greatly appreciate it.
laserman
Member
 
Posts: 16
Joined: Fri Mar 21, 2008 6:06 pm

Postby Lyberodoggy » Tue Mar 25, 2008 9:11 pm

You are always welcome...
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby Candle » Tue Mar 25, 2008 9:33 pm

Moved to Post Your Own Tutorials.
Please don't PM me questions, ask here in the forums!
``````````````
Between grand theft and a legal fee, there only stands a law degree.
User avatar
Candle
Administrator
 
Posts: 3077
Joined: Sat Feb 07, 2004 2:21 am
Location: Rudy's Bar

Postby Lyberodoggy » Tue Mar 25, 2008 9:44 pm

Okay Candle! I thought of doing it too, but since I 'm a new moderator, I didn't want to take such an initiative (I don't know if that's the right word, I mean an action that is taken without asking first.)
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby laserman » Sat Apr 05, 2008 4:33 pm

Boy, for some reason my employer thinks I should be working more than playing around with AM. Sheesh... what's this world coming to? :lol:

Anyhow, I have another question regarding this particular piece of code.
In the line: Action.WriteINI "blockrecord.ini",framenumber,hotspotnumber,color is there a way to have blockrecord.ini generated as a different name when the entire file is saved as a different name? What I mean specifically is...

Say I save the file as blox1 (and whatever extension AM gives it). I then have a file named blox1 and a blockrecord.ini associated with it. Now I want to enter different information and save the file as blox2, but I don't want blockrecord.ini to have any information that is from blox1 in it. What I would like is to have (for example): blockrecord1, blockrecord2, blockrecord3 and so on. Is there a way to have a separate ini file for each saved filename?

I hope I was clear enough and thanks for any help.
laserman
Member
 
Posts: 16
Joined: Fri Mar 21, 2008 6:06 pm

Postby Lyberodoggy » Sat Apr 05, 2008 6:18 pm

Yes, you can do that using a variable to make the player select a name for the ini...
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens


Return to Post Your Own Tutorials

Who is online

Users browsing this forum: No registered users and 0 guests

cron