[Done for V0.38] Some kind of "Counter Query" Wall

Messages are moved here (should anyone ever want to see them again) once they are no longer applicable to the current version (e.g. suggestions that have been implemented or bugs that have been fixed).

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
Sophia
Concise and Honest
Posts: 4307
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

[Done for V0.38] Some kind of "Counter Query" Wall

Post by Sophia »

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?)
User avatar
George Gilbert
Dungeon Master
Posts: 3022
Joined: Mon Sep 25, 2000 11:04 am
Location: London, England
Contact:

Post by George Gilbert »

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.
User avatar
beowuuf
Archmastiff
Posts: 20686
Joined: Sat Sep 16, 2000 2:00 pm
Location: Basingstoke, UK

Post by beowuuf »

WOOHOO! This is super sweet! Thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you
User avatar
Lunever
Grand Druid
Posts: 2712
Joined: Thu Feb 14, 2002 4:47 pm

Post by Lunever »

Absolutely great!
Parting is all we know from Heaven, and all we need of hell.
User avatar
George Gilbert
Dungeon Master
Posts: 3022
Joined: Mon Sep 25, 2000 11:04 am
Location: London, England
Contact:

Post by George Gilbert »

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).
Post Reply