clickable objects

Help bring our custom Ages to life! Share tips and tricks, as well as code samples with other developers.

clickable objects

Postby mar » Tue Jul 08, 2008 1:40 pm

First I didn't know of it is allowed to ask for help in the time I workat my shell for the RAD2 contest. If it is not allowed then tell me and I ask after the contest again. :?:
If it is OK, then I have the following question. I have in mind that a door is opening after you have click at four "clickable "objects in a definite sequence.
For example I have clickable objects A,B,C,D. and a door E
Then:
B AND C AND D AND A = E
Is this possible ? I think I must make a clickable region for each object and then there must be something written in python
that when all conditions are meet the door can opened.
Can someone help me with that. :P
User avatar
mar
 
Posts: 182
Joined: Sat Sep 29, 2007 8:04 am

Re: clickable objects

Postby GPNMilano » Tue Jul 08, 2008 2:17 pm

What you're looking for is a python script similar to The door in Kirel. I believe the python file is nb01GardenLights. I suggest taking a look at that to get an idea of what you want for your own puzzle door. You'll need your age to have an sdl and the variables set up in that sdl for it to work though. So if someone has an easier solution it would probably be better to use theirs.
You can't stop the truth. IC Blog
User avatar
GPNMilano
 
Posts: 1155
Joined: Mon Apr 21, 2008 5:50 am

Re: clickable objects

Postby Grogyan » Wed Jul 09, 2008 12:49 am

Take a peek at Roberts shell and it should give you a clue, he has only 1 click region but several clickable objects within it

as for getting the right sequence, you'll need to do a shift sequence
eg
Buttons = A, B, C and D
Data variables = a, b, c, d, temp

All data will be through SDL

initialize sequence to zero
while sequence does not equal DCBA
if D is pushed
copy d to temp
copy c to d
copy b to c
copy a to b
copy temp to a

if C is pushed
copy c to temp
copy c to d
copy b to c
copy a to b
copy temp to A

if B is pushed
copy b to temp
copy c to d
copy b to c
copy a to b
copy temp to a
etc

from the above example you can see that d is always over written, hence you copy any variable first

Does this help?
Better to have loved and lost than never to have loved at all
User avatar
Grogyan
 
Posts: 1203
Joined: Thu Oct 11, 2007 1:27 am

Re: clickable objects

Postby Jojon » Wed Jul 09, 2008 1:25 pm

Hmm, I really need to learn scripting... Why couldn't one have just a sequence_ok_so_far flag and a last_pressed variable and simply check those for each button press hook? Actually, I suppose the flag too could be swallowed by the variable. (..say by setting it to NULL, or "F", or something, whenever the sequence is broken.)

EDIT: Oh and another one: would I be correct or wrong, in observing that there is not really such a thing as a specific "click" region entity, but that it's just A region, plain vanilla, whose only purpose is to ensure you can't stand at the opposite end of the entire age and click the object? :7
Jojon
 
Posts: 1116
Joined: Sun Sep 30, 2007 5:49 am

Re: clickable objects

Postby mar » Thu Jul 10, 2008 6:59 am

Thks for answering all of you.
I have tried to look inNB01garden lights with Plasmashop but I can't get in. Have I used the wrong program :?:

Further I have looked in the SDL file from Robert and I saw what he has done, but I don't understand it. What I saw is that he have 6 sets with 4 variable. Robert make each variable 1 with a default also 1.
I don't understand the example you gave Groyan and can"t see what you have done if the good object with the right color
is clicked. But is this maybe a good version.
BDW where is INT and BOO standing for. I think BOO for Boolean but INT???????

Jojon what you suggest was also my thougt but maybe that is to simple.

After all I have decided to do this stuff after the RADcontest.Then I will going to stop my brains there in all that Pythonstuff!!!!!!! :twisted: :twisted: :twisted: :twisted:
User avatar
mar
 
Posts: 182
Joined: Sat Sep 29, 2007 8:04 am

Re: clickable objects

Postby Jojon » Thu Jul 10, 2008 8:58 am

Sounds like an INTeger - a number without decimals.
Jojon
 
Posts: 1116
Joined: Sun Sep 30, 2007 5:49 am

Re: clickable objects

Postby Grogyan » Thu Jul 10, 2008 11:19 am

I'm not sure what you're after.

The example above will loop until the condition are true, using just straight booleans

Unless you want to try and do something as complicated as what I am going to do with my shell where
you push a button and it changes colour and there are 3 buttons
after that you'll need to push them again for a period to "engage" that colour to the sequence.

effectively i'll be using the example above and one more.


My head is about to explode while i'm figuring out how to get an object to follow a bezier path with its local Y axis constrained to the path
Better to have loved and lost than never to have loved at all
User avatar
Grogyan
 
Posts: 1203
Joined: Thu Oct 11, 2007 1:27 am

Re: clickable objects

Postby Robert The Rebuilder » Thu Jul 10, 2008 1:09 pm

mar: I agree that it would be better to wait until the contest has finished before attempting the Python scripting for this button sequence. That way, we can give you actual Python code to do this without disqualifying you from the contest.
Can we rebuild it? Yes, we can - here's how.

MOULagain KI# 1299

Myst Movie coming soon - spread the word!
User avatar
Robert The Rebuilder
 
Posts: 1383
Joined: Sat Sep 29, 2007 7:24 am
Location: Virginia, US

Re: clickable objects

Postby BAD » Thu Jul 10, 2008 4:34 pm

Moved. :)
BAD is as good as he gets
User avatar
BAD
 
Posts: 832
Joined: Sat Sep 29, 2007 9:44 am


Return to Scripting

Who is online

Users browsing this forum: No registered users and 0 guests

cron