An Action / Counter question...

Questions about how to create your own dungeons and replacement graphics and sounds.

Moderator: George Gilbert

Forum rules
Please read the Forum rules and policies before posting. You may Image to help finance the hosting costs of this forum.
Post Reply
User avatar
Simplicus
Neophyte
Posts: 9
Joined: Fri Jul 24, 2009 11:27 pm
Location: Dallas, TX USA

An Action / Counter question...

Post by Simplicus »

Hello, all...

I would like to have a set of four levers that when activated in a particular way, will open a door. Here's the idea, and what I've been able to come up with so far:

Four levers in a row, with numbers scattered around as wall text. When the player adds up the numbers, the sum is 13. The levers are designated (from left to right) "8, 4, 2, and 1." The proper combination to open the door is therefore "up, up, down, up." (8 + 4 + 1).

Is there a way to use an Action wall item to set the value of a specific counter (or add / subtract a value from a single counter), then use a relay to open the door based on the count value in the counter? Is there a better way to acheive the same result? I would like the player to set the switches, then click a master switch to do the polling, check the count, and open the door. There would also have to be a "reset" switch, that would set the value of the counter back to zero.

I know that the Action wall item will set the value of a counter, but I have not been able to figure out how to get a particular counter to be its target. (There is no target option for the Action wall item...).

I apologize for being obtuse, but I've only been working with the RTC editor for about two weeks.

Thanks, and Cheers!

Simplicus.
__________________________________________
300,000 Kilometres/Sec. Not just a good idea, it's the law!
User avatar
Simplicus
Neophyte
Posts: 9
Joined: Fri Jul 24, 2009 11:27 pm
Location: Dallas, TX USA

Re: An Action / Counter question...

Post by Simplicus »

My last experiment with this was to set four Actions and a Counter in the same wall tile. The Actions are all ACTION_COUNTER_SET, with the "Strenth" attribute set to 8, 4, 2, and 1 respectively. The "1" switch then triggers the Action with the Strength attribute of 1, the "2" switch triggers the Action with the strength attribute of 2, and so on. A button (the "door open" button), then triggers a Relay which checks if the value of the counter is EQUAL_TO 13, and targets the door.

I reallize that IF the above would work, it would do so not on the positions of the switches, but only on the switches that were thrown (only the 8, 4, and 1 switch should be thrown). This would (if the swtches are in the UP position to start) result in a "down, down, up, down" configuration opening the door, with only one try allowed.

To aid in debugging, is there an simple way to display the current value of the counter (say, as wall text) as it changes?

Thanks in advance,

Simplicus.
__________________________________________
300,000 Kilometres/Sec. Not just a good idea, it's the law!
User avatar
Simplicus
Neophyte
Posts: 9
Joined: Fri Jul 24, 2009 11:27 pm
Location: Dallas, TX USA

Re: An Action / Counter question...

Post by Simplicus »

Nevermind... the proper action is ACTION_COUNTER_INCREMENT. Trial and error is the best teacher.

Simplicus.
__________________________________________
300,000 Kilometres/Sec. Not just a good idea, it's the law!
User avatar
beowuuf
Archmastiff
Posts: 20686
Joined: Sat Sep 16, 2000 2:00 pm
Location: Basingstoke, UK

Re: An Action / Counter question...

Post by beowuuf »

Actually, there was another way - one of the other threads from raf68 showed how you can have a 3 up to down arrangement - there should be a link by me to a lever / counter example. In this case, you can ignore the need to give the levers an inherent value!
Was unable to (permenantly) kill off ian_scho (Haynuus), Ameena, oh_brother (Westian), money (Falkor), raixel (Petal) and Lord_Bones (Aurek) in the DM D&D game Time's Champions!

CONGRATULATIONS TO THOSE WHO MADE THE GAME WHAT IT WAS - GREAT!
User avatar
Simplicus
Neophyte
Posts: 9
Joined: Fri Jul 24, 2009 11:27 pm
Location: Dallas, TX USA

Re: An Action / Counter question...

Post by Simplicus »

Thanks, beowuuf... I saw that one last night after resolving the issue the other way. I guess I should have read all the posts first, but I'm working my way through them.
__________________________________________
300,000 Kilometres/Sec. Not just a good idea, it's the law!
User avatar
beowuuf
Archmastiff
Posts: 20686
Joined: Sat Sep 16, 2000 2:00 pm
Location: Basingstoke, UK

Re: An Action / Counter question...

Post by beowuuf »

there's alot of posts, plus that was buried. as long as you get a solution and learn from it, better yours anyway!
Was unable to (permenantly) kill off ian_scho (Haynuus), Ameena, oh_brother (Westian), money (Falkor), raixel (Petal) and Lord_Bones (Aurek) in the DM D&D game Time's Champions!

CONGRATULATIONS TO THOSE WHO MADE THE GAME WHAT IT WAS - GREAT!
User avatar
Paul Stevens
CSBwin Guru
Posts: 4322
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Re: An Action / Counter question...

Post by Paul Stevens »

I would like to have a set of four levers that when activated in a particular way,
Did RTC neglect to implement AND gates? That is
hard to believe but a couple of threads that I have
read leads me to wonder when I read your proposed,
complicated solutions.
User avatar
Gambit37
Should eat more pies
Posts: 13769
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: An Action / Counter question...

Post by Gambit37 »

RTC does in fact have relays that can test various logical operations (including AND) but I don't think it's anything like the way it works in the original DM engine.

Logic gates never made any sense to me anyway. Can someone teach me?
Simplicus wrote:To aid in debugging, is there an simple way to display the current value of the counter (say, as wall text) as it changes?
See here, the very last option:
http://dmwiki.atomas.com/wiki/RTC/Substitution_Strings
User avatar
beowuuf
Archmastiff
Posts: 20686
Joined: Sat Sep 16, 2000 2:00 pm
Location: Basingstoke, UK

Re: An Action / Counter question...

Post by beowuuf »

Basic AND/XOR is easy, flexible counters take their place. However, having multiple inputs into an OR set up, or more complex set ups, create bigger problems. Still I think the basic building blocks still can create powerful solutions.
Was unable to (permenantly) kill off ian_scho (Haynuus), Ameena, oh_brother (Westian), money (Falkor), raixel (Petal) and Lord_Bones (Aurek) in the DM D&D game Time's Champions!

CONGRATULATIONS TO THOSE WHO MADE THE GAME WHAT IT WAS - GREAT!
User avatar
Paul Stevens
CSBwin Guru
Posts: 4322
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Re: An Action / Counter question...

Post by Paul Stevens »

I probably don't know what is going on.
I thought the original poster wanted
something to happen if:

Lever A on
AND
Lever B on
AND
Lever C off
AND
Lever D on

A natural problem for a 4-input AND gate.

There is an example of this just beyond the
riddle room in DM where there are four
small switches in the wall. I'm sure the
makers of DM would never have struggled
with counters to solve a logic problem.
(I haven't actually looked however.)
User avatar
Simplicus
Neophyte
Posts: 9
Joined: Fri Jul 24, 2009 11:27 pm
Location: Dallas, TX USA

Re: An Action / Counter question...

Post by Simplicus »

I actually considered using (lever 1 on) AND (lever 2 on) for one relay, then (lever 3 off) AND (lever 4 on) for a second relay. But I couldn't figure out how to AND the two relays together into a third. Each relay can function as a two-input gate, but not a four-input gate.

This would be the (pardon the pun) logical way to approach the problem... If anyone can educate me on how to chain logical relays, that would be very cool.

Thanks,

Simplicus.
__________________________________________
300,000 Kilometres/Sec. Not just a good idea, it's the law!
User avatar
beowuuf
Archmastiff
Posts: 20686
Joined: Sat Sep 16, 2000 2:00 pm
Location: Basingstoke, UK

Re: An Action / Counter question...

Post by beowuuf »

Firstly, levers should be set to toggle.

To create a NOT gate, you need to do the following thing - you need to put your lever that must be off through a counter already at 0. What happens is that if this lever is not pulled, the counter believes it has sent its normal message, and if he lever gets pulled, and the counter goes to -1, then it behaves as if at 1. In this case, it sents its 'not there yet' message.

This counter, and the three good levers, should target a counter at 3. As long as the three good levers get pulled, and the bad lever does not, this new counter will be decremented to 0 and will operate.

However, if the bad lever is pulled, the final result is that the new counter is increased by 1, and so will never get to a 0 state.


Hope that makes sense! The example I mentioned should show this, but with two bad levers and three good levers.

@Paul: As you can see, counters act like AND gates since, unlike normal DM, the counter can be increased and decreased.
Was unable to (permenantly) kill off ian_scho (Haynuus), Ameena, oh_brother (Westian), money (Falkor), raixel (Petal) and Lord_Bones (Aurek) in the DM D&D game Time's Champions!

CONGRATULATIONS TO THOSE WHO MADE THE GAME WHAT IT WAS - GREAT!
User avatar
Paul Stevens
CSBwin Guru
Posts: 4322
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Re: An Action / Counter question...

Post by Paul Stevens »

OK. But George must have been familiar with
DM's extensive use of AND gates when he
produced DMUTE. I cannot believe he did
not include them in RTC. Recreating some
of those effects with counters could be ugly,
as you have ably demonstrated ;-)
unlike normal DM, the counter can be increased and decreased
Normal DM must have been different.
They can go both ways in Atari CSB.
User avatar
Sophia
Concise and Honest
Posts: 4306
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: An Action / Counter question...

Post by Sophia »

I think beo might be confusing counters not being able to go both ways with counters being able to be fired multiple times. When a counter in DM hits 0, it's done, right? That's what I remember, anyway.
User avatar
beowuuf
Archmastiff
Posts: 20686
Joined: Sat Sep 16, 2000 2:00 pm
Location: Basingstoke, UK

Re: An Action / Counter question...

Post by beowuuf »

Sorry, I did mean 'can be increased after they fire at 0', but aslo that they can be 'toggled' up and down, which I do not believe is possible with DM counters, that is AND gate functionaility.

I think GG was only looking to duplicate all the functions currently in DM / CSB with simple objects to start with, and if you like the counter and relay are only two object that can duplicate the basic weird effects seen. he had thought this would let people build up insanely complex interaction while not needing anything more complex than a relay and a counter.

To completely go OT from the topic at hand - happy birthday Simplicus!
Was unable to (permenantly) kill off ian_scho (Haynuus), Ameena, oh_brother (Westian), money (Falkor), raixel (Petal) and Lord_Bones (Aurek) in the DM D&D game Time's Champions!

CONGRATULATIONS TO THOSE WHO MADE THE GAME WHAT IT WAS - GREAT!
User avatar
Jan
Mighty Pirate
Posts: 2760
Joined: Tue Sep 23, 2008 4:55 pm
Location: Scumm Bar, Czech Republic

Re: An Action / Counter question...

Post by Jan »

beowuuf wrote:happy birthday Simplicus!
*nods*
Finally playing and immensely enjoying the awesome Thimbleweed Park-a-reno!
User avatar
Paul Stevens
CSBwin Guru
Posts: 4322
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Re: An Action / Counter question...

Post by Paul Stevens »

Sophia and beowuuf:

I think we are pretty much agreed now.
User avatar
Lord_BoNes
Jack of all trades
Posts: 1064
Joined: Mon Dec 01, 2008 12:36 pm
Location: Ararat, Australia.

Re: An Action / Counter question...

Post by Lord_BoNes »

To make a counter go in either direction just fire relays at it the activate or deactivate... ACTIVATE to DECREMENT(-1) the counter, DEACTIVATE to INCREMENT(+1) the counter. You can then do whatever you want with the value, check it with relays, etc. So you just have each switch target its own counter, if the lever is down to start the use DEACTIVATE(+1) and set the counter to 0, otherwise use ACTIVATE(-1) and set the counter to 1. Switches do the opposite action when they are triggered back. Then just go through 4 relays checking each counter's value IE: 1,1,0,1.

As for the AND/OR gate problem.... anything you trigger off the same relay is an OR while anything that consecutive relays trigger are ANDs. A relay that targets 4 relays, each those relays can trigger on their own, therefore they are ORs, but each individual relay is also it's own little AND statment to the triggering relay.

EG:
RELAY1
|
RELAY2
|
RELAY3
If (RELAY1 = true & RELAY2 = true & RELAY3 = true) then....

RELAY1
|------------|------------|------------|
RELAY2      RELAY3      RELAY4      RELAY5
If (RELAY1 = true & RELAY2 = true) then....
OR
If (RELAY1 = true & RELAY3 = true) then....
OR
If (RELAY1 = true & RELAY4 = true) then....
OR
If (RELAY1 = true & RELAY5 = true) then....

By "true" I meant that it met its conditions. I hope that this helps.
 
Image

1 death is a tragedy,
10,000,000 deaths is a statistic.
- Joseph Stalin

Check out my Return to Chaos dungeon launcher
And my Dungeon Master Clone
User avatar
Gambit37
Should eat more pies
Posts: 13769
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: An Action / Counter question...

Post by Gambit37 »

Thanks for the description, but I still don't understand this in the context of RTC relays. One relay can only test for one thing, so your examples confuse me. What is the RTC setup for these?
User avatar
Lord_BoNes
Jack of all trades
Posts: 1064
Joined: Mon Dec 01, 2008 12:36 pm
Location: Ararat, Australia.

Re: An Action / Counter question...

Post by Lord_BoNes »

The crude "trees" in the diagrams above represent relays and their targets all using "Activate". So by:
RELAY1
|------------|------------|------------|
RELAY2 RELAY3 RELAY4 RELAY5
I'm refering to RELAY1 being a single relay that targets 4 other relays. And by:
If (RELAY1 = true & RELAY2 = true) then....
OR
If (RELAY1 = true & RELAY3 = true) then....
OR
If (RELAY1 = true & RELAY4 = true) then....
OR
If (RELAY1 = true & RELAY5 = true) then....
I was refering to the method in which you'd represent it in code form. And by "= true" I'm meaning whether the relay meets ITS (single) triggering condition. I hope you understand me better.
 
Image

1 death is a tragedy,
10,000,000 deaths is a statistic.
- Joseph Stalin

Check out my Return to Chaos dungeon launcher
And my Dungeon Master Clone
User avatar
Gambit37
Should eat more pies
Posts: 13769
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: An Action / Counter question...

Post by Gambit37 »

Nope! What is testing for the IF...THEN conditions that follow your tree? Another realy? If so, where is that attached?

Sorry, I'm a numpty when it comes to logic stuff and your explanations seem to be missing some steps to my poor old brain :D
User avatar
beowuuf
Archmastiff
Posts: 20686
Joined: Sat Sep 16, 2000 2:00 pm
Location: Basingstoke, UK

Re: An Action / Counter question...

Post by beowuuf »

The whole system is the 'if...else if...else' and each relay is one 'if' statement.

Basically if relay 1's condition is true (say specific member is alive), then it will fire on the other relays (say 'if member holds a special sword, special axe, or special bow)

That way, you can ensure something fires only if a certain person is alive, but will fire for three different weapons.
Was unable to (permenantly) kill off ian_scho (Haynuus), Ameena, oh_brother (Westian), money (Falkor), raixel (Petal) and Lord_Bones (Aurek) in the DM D&D game Time's Champions!

CONGRATULATIONS TO THOSE WHO MADE THE GAME WHAT IT WAS - GREAT!
User avatar
Lord_BoNes
Jack of all trades
Posts: 1064
Joined: Mon Dec 01, 2008 12:36 pm
Location: Ararat, Australia.

Re: An Action / Counter question...

Post by Lord_BoNes »

Thank you for that very accurate summary. It's not really an 'if...else if...else', though.
It's more of an 'if...then OR if...then'...
"if (i=1) then... OR if (i NOT = 1) then..." now THAT's an else statment. It requires 2 relays to actually do it. So you just have something trigger both of them, and 1 of them WILL fire, which one determines the answer. You just have to have the opposing condition, effectively, you have to design your own little "else".
 
Image

1 death is a tragedy,
10,000,000 deaths is a statistic.
- Joseph Stalin

Check out my Return to Chaos dungeon launcher
And my Dungeon Master Clone
User avatar
Gambit37
Should eat more pies
Posts: 13769
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: An Action / Counter question...

Post by Gambit37 »

See, this is why I can't follow it. I understand if..then..else from a coding point of view, but your example above still makes no sense to me as written.

Would it be possible for you to sketch this out as a flowchart representing the RTC constructs, with some comments on each relay showing exactly how each should be setup? Once I can see a working example i'n situ' so to speak, then I will more likely understand it.

Unfortunately reading your explanations above all I see is "Relay1 blah blah Relay2 blah blah relay3 Counter blah blah." It's not that I'm not trying to understand, I just have a different mental process which is heavily visual and so descriptions like this don't really help. It's why I was never any good at maths, and much better at art :-)

Also:
beowuuf wrote:Basically if relay 1's condition is true (say specific member is alive), then it will fire on the other relays (say 'if member holds a special sword, special axe, or special bow)That way, you can ensure something fires only if a certain person is alive, but will fire for three different weapons.
What do you mean by "then it will fire on the other relays"? Do you mean "It will THEN fire the OTHER relays", or something else? It doesn't seem to make sense as you've written it. :? :?
User avatar
beowuuf
Archmastiff
Posts: 20686
Joined: Sat Sep 16, 2000 2:00 pm
Location: Basingstoke, UK

Re: An Action / Counter question...

Post by beowuuf »

Yes, sorry, don't know where the "on" came from. Relay one in my example would target three other relays
Was unable to (permenantly) kill off ian_scho (Haynuus), Ameena, oh_brother (Westian), money (Falkor), raixel (Petal) and Lord_Bones (Aurek) in the DM D&D game Time's Champions!

CONGRATULATIONS TO THOSE WHO MADE THE GAME WHAT IT WAS - GREAT!
Post Reply