Ah, so I need to upgrade to the current version. Thanks
By the way, I finished my system for detecting sentences. I haven't triggered it yet, but it is quite the abomination! It would take about 36 DCs, two switches, and
682 triggers (not including the EUDs)!
The idea was to make a system where you could store a predefined string (converted into charcodes) into a set of 32 death counters, which essentially act as an array. The trigger system would simply watch for keypresses and keep track of where we are in the target string, and what charcode to watch for next.
I actually can't describe it in prose... I have a kind of weird JS-like pseudocode for it. It's long because it uses a LOT of binary countoffs to check for equality between death counters. (If there were some better way to check if two death counters are equal, that would likely make this system
far more efficient and worthwhile to implement.)
So here it is, for anyone who wants to waste a few days triggering it. It's probably not worth the effort.
EDIT: Almost forgot: the charcodes are the death counts as listed
here. The EUD triggers would just listen to those death counts, and set $$Keycode to equal the count. (We need another counter because you can't edit EUD death counters.)
Collapsable Box
// $$var = death counter
// $_var = switch
// __var = Shorthand notation, like an array. Each element is a separate death counter.
$$Keycode = 0; // last character pressed by player
$$CurrentChar = 0; // character (code) we're waiting for
$$KeyIndex = 0; // index of $$CurrentChar ( $$CurrentChar == __String.charCodeAt($$KeyIndex) )
$$TEMP1 = 0; // temporary variable
$_Keypress = false; // SWITCH: are we responding to a keypress and comparing $$Keycode and $$CurrentChar?
$_GettingFromIndex = true; // SWITCH: are we updating $$CurrentChar based on $$KeyIndex?
// Note that $_GettingFromIndex is SET by default.
__String = [357,354,375,362,357,363,356,368,355,355,0]; // "davidjcobb" and a terminating null charcode
// max size 32 death counters. (4 units, 8 players for each)
when ($_GettingFromIndex == true) { // System of multiple triggers
$$CurrentChar = 0;
// The remainder of this WHILE does the following: $$CurrentChar = __String[$$KeyIndex]
// For each value A from 0 to 31 inclusive, repeat the following IF:
if ($$KeyIndex == A) {
// Binary countoff: set $$CurrentChar = $$TEMP1 = __String[A], and sacrifice __String[A]
// For each value B from 9 to 0 inclusive, repeat the following IF
if (__String[A] >= 2^B) {
__String[A] -= 2^B;
$$CurrentChar += 2^B;
$$TEMP1 += 2^B;
}
// Binary countoff: set __String[A] = $$TEMP1, sacrificing $TEMP1
// For each value C from 9 to 0 inclusive, repeat the following IF
if ($$TEMP1 >= 2^C) {
__String[A] += 2^C;
$$TEMP1 -= 2^C;
}
}
$_GettingFromIndex = false;
}
// $$CurrentChar should now equal 357, our charcode for "d"
// $$KeyIndex should equal 0, meaning the first character in our string
// Such that (in JS), $$CurrentChar == __String.charCodeAt($$KeyIndex), except we're not using ASCII charcodes.
when (Neutral has suffered exactly 357 deaths of UnitID:1059) { // player pressed "d"
$$Keycode = 357;
$_Keypress = true;
}
when ($_Keypress == true) { // Trigger system: comparing $$Keycode and $$CurrentChar
// This whole thing is a binary countoff to check if $$Keycode == $$CurrentChar
// For each value D from 9 to 0 inclusive, repeat the following four IFs. (each of them is a separate trigger)
if ($$Keycode >= 2^D) {
$$Keycode -= 2^D;
}
if ($$CurrentChar >= 2^D) {
$$CurrentChar -= 2^D;
}
if ($$Keycode == 0 && $$CurrentChar >= 1) { // the two are not equal -- reset to first char of __String
$_Keypress = false;
$$KeyIndex = 0;
$_GettingFromIndex = true;
}
if ($$Keycode >= 1 && $$CurrentChar == 0) { // the two are not equal -- reset to first char of __String
$_Keypress = false;
$$KeyIndex = 0;
$_GettingFromIndex = true;
}
if ($$Keycode == 0 && $$CurrentChar == 0) { // the two are equal -- move on, wait for next char of __String
$_Keypress = false;
$$KeyIndex += 1;
$_GettingFromIndex = true;
}
}
Post has been edited 1 time(s), last time on Dec 14 2009, 3:07 am by DavidJCobb. Reason: Forgot to list the charcodes.
None.