Ok, this one's a bit zany, but 0.35 is so much more powerful than any previous RTC, and this one would be another huge step in that direction.
Right now, counters are useful for simplistic purposes, but their functionality is somewhat limited. I propose to add some sort of a "counter query" object that will allow counters to be used as generalized variables. Its first target is, of course, a counter. Alternatively (if this is simpler) it could simply control any counters in the same square as it.
It then has the standard list of actions (ACTIVATE, DEACTIVATE, TOGGLE) etc. and a list of relays, triggers, and so on to target. The trick is that each of these is paired with a condition: "Less Than," "Greater Than," or "Equal To," and a number.
When the counter query gets an ACTIVATE, it checks its list of targets, and only sends the applicable signal to a target if the condition is matched. For example, if a door is targeted with "Equal to 3", and the Counter Query gets an ACTIVATE, the door will only be opened (or shut) if the counter is set to 3. If it is instead "Less than 3", it will get sent the signal any time the counter is less than three.
An object like this would allow an emulation of DM AND/OR gates, make "shops" and such much easier, and probably allow even more interesting and insidious counter puzzles. (Combination locks, anyone?)
[Done for V0.38] Some kind of "Counter Query" Wall
Moderator: George Gilbert
Forum rules
Please read the Forum rules and policies before posting. You may
to help finance the hosting costs of this forum.
Please read the Forum rules and policies before posting. You may

- George Gilbert
- Dungeon Master
- Posts: 3022
- Joined: Mon Sep 25, 2000 11:04 am
- Location: London, England
- Contact:
Done for V0.38
The way I've implemented this is by having a condition on relays which must be met before it will trigger. The condition is made up of two parameters (which each evaluate to an integer) and an operator (==,!=,>,>=,<,<=, AND, OR, XOR, NAND, NOR). If it evaluates to TRUE then the relay will fire, if it doesn't it won't.
The parameters each (independently) can be one of:
1) A pure number (e.g. 1, 2, 3...)
2) An item reference (e.g. item010203-4). This will evaluate to the number associated with the item (for counters this is the count, monsters their health, standard objects their charge etc). For more information about this see - http://www.dungeon-master.com/forum/vie ... hp?t=25476 - which uses the same background mechanism.
3) A number associated with the item up the chain that triggered this relay (e.g. the triggering strength, or attributes of the character that triggered it e.g. health, fighter level, load carried etc).
4) A number associated with the party (e.g. their position in the dungeon, the highest stamina, poison level etc).
Using this in conjunction with counters you can create variables (e.g. storing a value in the COUNT parameter of an item, writing to it using COUNTER_SET actions and reading from it using method 2 above). You can also trivially create complex for / while loops and obviously if statements by combining chains of counters and relays which can read and write to/from character attributes and control dungeon mechanics.
I've put some examples of how to use this feature into the advanced actions dungeon.
The way I've implemented this is by having a condition on relays which must be met before it will trigger. The condition is made up of two parameters (which each evaluate to an integer) and an operator (==,!=,>,>=,<,<=, AND, OR, XOR, NAND, NOR). If it evaluates to TRUE then the relay will fire, if it doesn't it won't.
The parameters each (independently) can be one of:
1) A pure number (e.g. 1, 2, 3...)
2) An item reference (e.g. item010203-4). This will evaluate to the number associated with the item (for counters this is the count, monsters their health, standard objects their charge etc). For more information about this see - http://www.dungeon-master.com/forum/vie ... hp?t=25476 - which uses the same background mechanism.
3) A number associated with the item up the chain that triggered this relay (e.g. the triggering strength, or attributes of the character that triggered it e.g. health, fighter level, load carried etc).
4) A number associated with the party (e.g. their position in the dungeon, the highest stamina, poison level etc).
Using this in conjunction with counters you can create variables (e.g. storing a value in the COUNT parameter of an item, writing to it using COUNTER_SET actions and reading from it using method 2 above). You can also trivially create complex for / while loops and obviously if statements by combining chains of counters and relays which can read and write to/from character attributes and control dungeon mechanics.
I've put some examples of how to use this feature into the advanced actions dungeon.
- George Gilbert
- Dungeon Master
- Posts: 3022
- Joined: Mon Sep 25, 2000 11:04 am
- Location: London, England
- Contact:
Now added a 5th possibility of "CHARACTER" so you can limit relays to only fire for a very specific character.
For example:
CONDITION=(TRIGGERING:CHARACTER,EQUALS,CHARACTER:CHARACTER_ZED)
will only fire if Zed was the person who triggered it. This allows you to do all sorts of interesting things from the obvious (e.g. As in Conflux having messages that only appear if certain people are in your party), to the more subtle (e.g. preventing certain characters, say those that are non-human, from wearing armour).
For example:
CONDITION=(TRIGGERING:CHARACTER,EQUALS,CHARACTER:CHARACTER_ZED)
will only fire if Zed was the person who triggered it. This allows you to do all sorts of interesting things from the obvious (e.g. As in Conflux having messages that only appear if certain people are in your party), to the more subtle (e.g. preventing certain characters, say those that are non-human, from wearing armour).