Page 1 of 1
Good and bad levers
Posted: Fri Jul 17, 2009 2:30 pm
by linflas
Here's a little problem asked by pm from a new member called RAF68. I had a quick look at the RTC editor but couldn't manage to make it work fine for all possibilities. Maybe i need more training
A room, 5 levers, a closed door. 3 levers are the good ones, 2 are bad. The door will never open and will close each time one of the 2 levers is activated.
Re: Good and bad levers
Posted: Fri Jul 17, 2009 2:57 pm
by Gambit37
My brain hurts today and I can't think straight, but I reckon this is easily solvable using a counter.
Re: Good and bad levers
Posted: Fri Jul 17, 2009 7:13 pm
by Jan
linflas wrote:The door will never open.

Heh? I don't see the point of a closed door that would never open. Or do I understand it correctly? Probably not. Man, it's so hot here, my brain is melting - or what was left of it.
Re: Good and bad levers
Posted: Fri Jul 17, 2009 7:51 pm
by beowuuf
I think the second part is saying the problem?
It sounds like you need the three good levers going to a 3 counter. The two bad levers should also go to this counter, but with a reversed activation so they will increase the counter if pressed.
Re: Good and bad levers
Posted: Fri Jul 17, 2009 9:50 pm
by Jan
Ah, sorry, I see, you're right. As usually.
Re: Good and bad levers
Posted: Fri Jul 17, 2009 10:26 pm
by beowuuf
The greatest trick the devil ever pulled was convincing the world he did not exist, the second was that he was always right

Re: Good and bad levers
Posted: Sat Jul 18, 2009 11:12 am
by linflas
beowuuf wrote:It sounds like you need the three good levers going to a 3 counter. The two bad levers should also go to this counter, but with a reversed activation so they will increase the counter if pressed.
Thanks beo but i've already did this and it doesn't work exactly as i meant.
Levers have two states, let's say UP and DOWN. at the init, they are all UP.
if the good levers activate the counter and the bad deactivate it, the counter value can be all messed up if you switch more than one time any lever.
which means that you can only TOGGLE (yes i shout like RAF68

) counter(s).
Re: Good and bad levers
Posted: Sat Jul 18, 2009 12:03 pm
by beowuuf
Ah, darn, that rings a bell. Then can't you wash the bad toggle messages through additional counters and so that the decativation/activation messages occur with the toggles. Have a counter at 0 and a counter at 1 that each bad lever must go through?
Re: Good and bad levers
Posted: Sat Jul 18, 2009 1:14 pm
by linflas
hmmm... i am not using them the way you expect i think...
here's the actual code (you can make a new dungeon and paste this to replace the layout and items sections). The 2 first levers are bad, the 3 further are good. It seems that the condition i put on the relay is not even working !
Code: Select all
/******************************************************************************/
/* Layout */
/******************************************************************************/
[Layout]
; Level 0
WALLSET......=(WALLSET_DEFAULT)
LIGHT_AMBIENT=(100)
LIGHT_MINIMUM=(5)
LIGHT_MAXIMUM=(1000)
OFFSET.......=(0,0)
SIZE.........=(7,6)
ITEM_PREFIX..=(ref00)
DESCRIPTION..=()
1000000
1000000
1111111
0001000
0001000
0001000
/******************************************************************************/
/* Items */
/******************************************************************************/
[Items]
; Level 0
ref000305-1 WALLITEM_RELAY 3 0 0 CENTRE CONDITION=(VALUE:ref000104-1,EQUAL_TO,NUMBER:0) ACTION=(DEACTIVATE) TARGET=(ref000203-1)
ref000205-1 WALLITEM_COUNTER 1 1 0 CENTRE COUNT=(0) ACTION=(ACTIVATE) TARGET=(ref000305-1)
ref000204-2 WALLITEM_COUNTER 2 1 0 CENTRE COUNT=(0) ACTION=(ACTIVATE) TARGET=(ref000305-1)
ref000003-1 WALLITEM_SWITCH_LEVER 1 3 0 NORTH OPBY=(HAND) ACTION=(TOGGLE) TARGET=(ref000204-3,ref000205-1)
ref000003-2 WALLITEM_SWITCH_LEVER 2 3 0 NORTH OPBY=(HAND) ACTION=(TOGGLE) TARGET=(ref000204-1,ref000204-2)
ref000203-1 DOOR_PORTCULLIS 3 3 0 STATE=(CLOSED)
ref000203-2 FLOORITEM_DOORFRAME 3 3 0
ref000103-1 WALLITEM_SWITCH_LEVER 4 3 0 NORTH OPBY=(HAND) ACTION=(TOGGLE) TARGET=(ref000104-1)
ref000303-1 WALLITEM_SWITCH_LEVER 5 3 0 NORTH OPBY=(HAND) ACTION=(TOGGLE) TARGET=(ref000104-1)
ref000403-1 WALLITEM_SWITCH_LEVER 6 3 0 NORTH OPBY=(HAND) ACTION=(TOGGLE) TARGET=(ref000104-1)
ref000204-3 WALLITEM_COUNTER 1 4 0 CENTRE COUNT=(1) ACTION=(ACTIVATE) TARGET=(ref000203-1)
ref000204-1 WALLITEM_COUNTER 2 4 0 CENTRE COUNT=(1) ACTION=(ACTIVATE) TARGET=(ref000203-1)
ref000104-1 WALLITEM_COUNTER 5 4 0 CENTRE COUNT=(3) ACTION=(DEACTIVATE) TARGET=(ref000203-1)
Re: Good and bad levers
Posted: Sat Jul 18, 2009 3:19 pm
by Gambit37
I didn't check your code, but had some ideas about how to do it, might be too complex though?
1) Setup 2 counters, "A" starts at 3, and "B" starts at 2 -- counters should do nothing (no activates, etc), they are just to store these values
2) Create the 3 good levers to toggle counter A
3) Create the 2 bad levers to toggle counter B
4) create 5 more levers on the same tiles as the existing levers. These levers should activate 2 relays, X and Y
5) Relay X should have a conditional check on the value of counter A. If it's 0, send a Deactivate to the door (opens it)
5) Relay Y should have a conditional check on the value of counter B. If it's NOT 2, send an Activate to the door (closes it)
This works in principle, but the problem is with sending two signals to the door at the same time -- which message "wins" so to speak? Maybe if there's a 1 tick delay on the Activate to close the door, that might work? The door will then always close if counter B is not zero, ie, any of the bad levers have been switched down.
I'm not the most logical person in the world and I've probably made some big mistake with this or made it too complex. Forgive me if this is all wrong!
Re: Good and bad levers
Posted: Sat Jul 18, 2009 8:39 pm
by linflas
well, that's the point : your relays depend on the value of the counters, but it seems that conditions with counters don't work (or i am not using relays properly)..
your solution seems more complex than mine, theorically.. i'll check it in my example and tell you.
Re: Good and bad levers
Posted: Sat Jul 18, 2009 9:24 pm
by linflas
and it.... almost worked !
the only little glitch is when you manage to make the door open and decide to switch again one of the good levers : the door remains open.
anyway, problem solved ! thanks everyone

Re: Good and bad levers
Posted: Sat Jul 18, 2009 9:41 pm
by beowuuf
Re: Good and bad levers
Posted: Sat Jul 18, 2009 9:48 pm
by beowuuf
I know I was a little slow, but the above also means that the door opens and closes if the right/wrong levers are pressed again
Now, I'm embarrassed to say I don't know why this is working! Though I can guess.
My understanding is that a counter in a non-zero state (even negative) acts one way (either toggles back, or nothing). A counter in a zero state acts another way. Now, I do recall GG saying something about that if you had an open on 0, then a close would be reinforced on any other state. I had thought that I mis remembered.
However, all I have done is wash the bad levers through a counter already at zero set to give an open signal. I had a different counter, set to 1, to give a close signal, so that when the levelrs were first set down, a close would go off, and when they were brought back up, an open would go off.
However, as all designers can appreciate, I accidentally forgot to have the firstbad lever target the 1 counter. Yet the system worked! Wich pointed to that counter at zero doing both parts for me!
So apparently, if a counter has an open signal on zero, it must reinforce a close when switching out of that state, Which in a way is good, for this problem, but in general I can see that being a problem. Say for someone who just wants say an open on a zero counter, and even if the count is reset to a high number, a close isn't given. For example, wouldn't this cause a shooter, that activates on open or close, to fire when you 'reset' it?
Re: Good and bad levers
Posted: Sat Jul 18, 2009 10:54 pm
by Gambit37
@Beo: What version of the game/editor did you create this with? It crashes RTC Editor 0.49. -- what's the date/time of your RTCeditor.exe?
Re: Good and bad levers
Posted: Sun Jul 19, 2009 1:58 am
by linflas
wooot ! that worked, thanks beo

gambit : i had the same crash at first attempt, and converted the file to DOS mode.
Re: Good and bad levers
Posted: Sun Jul 19, 2009 2:49 am
by beowuuf
The text file has probably got buggered by browsers, if you viewed it then saved. I have RTC 0.49 and the file should still be a normal text file.
Re: Good and bad levers
Posted: Thu Jul 23, 2009 10:28 pm
by RAF68
THANK YOU FOR YOUR ASSISTANT ENGRAVED(BURNT) TO YOU I MADE A SUCCESS
Re: Good and bad levers
Posted: Thu Jul 23, 2009 10:32 pm
by beowuuf
Good to hear!
