Nexus!

by Alaskar

Back to Mechanic's Corner.

Alaskar2006-05-13 23:47:02
I downloaded MUSH but I rather like Nexus. So, I was thinking, why not have a system of variables for things like being on fire, frozen, etc.

so, to see if it could be done, i made the following system of triggers and variables

VARIABLES:
fire (fore being on fire, of course)
purge (for purgative balance/potion balance 0=off balance, 1=on balance)

TRIGGERS:
Flames erupt on your skin, blistering your flesh.
#set fire 1
#if purge>0 { sip frost }

The potion flows down your throat without effect.
#if fire>0 { sip frost }

Steam rises from your skin as the fires that plague you are extinguished.
#set fire 0

Now, I meant for it to, when I'm set ablaze, to check for purgative balance, then sip. Or, incase I'm off balance and it sips, it would wait until I regain balance to sip again.

Now that I think about it, would this work?

VARIABLES:
the same

TRIGGERS:
Flames erupt on your skin, blistering your flesh.
#set fire 1
#if purge>0 { sip frost } elseif purge<1 { }

-or-

Flames erupt on your skin, blistering your flesh.
#set fire 1
#if purge>0 { } elseif purge<1 { sip frost}

Steam rises from your skin as the fires that plague you are extinguished.
#set fire 0

The potion flows down your throat without effect.
#if fire>0 {
---#if purge>0 { sip frost }
}
maybe that'd work?

The problem with the first way was that it would continually sip the vial. Which is a great way to waste an entire vial, by the way, if your into that sort of stuff.

Well, hope I made sense, and thanks.
Unknown2006-05-14 00:23:13
You've got the gist of it. The best you can probably do in Nexus is as follows:

- triggers for affliction lines, which set the variable for that affliction to 1 and take the appropriate cure only if balance is available for it, e.g.:
QUOTE
Flames erupt on your skin, blistering your flesh.
#set fire 1
#if purge>0 { sip frost }


- triggers for unaffliction lines, which set the variable for that affliction to 0, e.g.:
QUOTE
Steam rises from your skin as the fires that plague you are extinguished.
#set fire 0


- triggers for balance recovery lines, which set the variable for that balance to 1, e.g.:
QUOTE
You may eat another herb.
#set herb_balance 1


And then you need a few giant aliases, one for each cure type, that go: if I have herb balance, check if I have stupidity; if I have stupidity, eat pennyroyal; if not, check if I have recklessness; if I have recklessness, eat horehound, and so on down the list in priority. Have each balance recovery trigger call the appropriate alias. You can always start off with the triggers mentioned above, which'll be a step up from manual curing, then put this in later, possibly only with a couple of afflictions per alias at first and adding more in as you get the kinks worked out.

This is bad:

QUOTE(alaskar @ May 14 2006, 12:47 AM) 287765

The potion flows down your throat without effect.
#if fire>0 { sip frost }

No wonder you keep sipping. This says, "If I take a sip of frost and it turns out I'm not on purgative balance, take another sip of frost anyway."

This is redundant:
QUOTE(alaskar @ May 14 2006, 12:47 AM) 287765

Flames erupt on your skin, blistering your flesh.
#set fire 1
#if purge>0 { sip frost } elseif purge<1 { }

There's no point in having an elseif that does nothing. Just omit it, and you'll get the same effect. Plus, your variable can only have two states: 0 and 1. If you've already checked whether the variable is > 0, you already know if it's < 1, no point checking again.

This is also pointless:
QUOTE(alaskar @ May 14 2006, 12:47 AM) 287765

Flames erupt on your skin, blistering your flesh.
#set fire 1
#if purge>0 { } elseif purge<1 { sip frost}

The if statement does the exact same thing as: #if purge<1 {sip frost}, but with extra code. Besides, I think you got it the wrong way around, and want to sip frost if purge > 0.

And this is also pointless:
QUOTE(alaskar @ May 14 2006, 12:47 AM) 287765

The potion flows down your throat without effect.
#if fire>0 {
---#if purge>0 { sip frost }
}


The trigger line tells you you don't have purgative balance; that isn't going to change while your if statement is executing, so that trigger will *never* result in you sipping frost. What you need instead is:
QUOTE
The potion flows down your throat without effect.
#set purge 0


Then a trigger for the purgative balance recovery line that sets purge to 1 and calls that big alias I mentioned earlier.

Hope that's relatively clear!
Alaskar2006-05-14 00:49:02
doh.gif Heh, I knew what the problem was, but I wasn't thinking right! Thanks.

Now, would a large system like that be feasable in nexus? Or would it be nothing compared to MUSH, zMud, etc., etc., so on and so forth?

And, the big alias, would it be something like

CURE

#if stupid>0 { penny (my alias for outr pennyroyal, eat pennyroyal) }
#if herbbalance>0 {
---#if recklessness>0 { hore }
}
#if herbbalance>0 {
---#if blah { anotheralias }
}

?
Unknown2006-05-14 01:15:07
QUOTE(alaskar @ May 14 2006, 01:49 AM) 287781
#if stupid>0 { penny (my alias for outr pennyroyal, eat pennyroyal) }
#if herbbalance>0 {
---#if recklessness>0 { hore }
}
#if herbbalance>0 {
---#if blah { anotheralias }
}


Hmm, first of all, check for herbbalance and anorexia right at the top, and nest the rest of it in that if statement. If you don't have herbbalance or are anorexic, there's absolutely no point in the rest of the checks. You'll probably also want to check for aeon/sap...

#if herbbalance > 0 {
---everything else goes in here
}

Second, if you tried the code you gave above, you would eat an herb for every single affliction you had each time you ran the alias and had herb balance, like this:

Call alias. Do I have herb balance? Yes. Do I have recklessness? Yes. Eat horehound. Again, do I have herb balance? Yes, this isn't going to change while a single alias is executing. Do I have epilepsy? Yes. Eat kombu. Etc...

You have to either (1) #set herbbalance 0 somewhere in there, or (2) nest all your if statements, so you stop checking whenever you encounter the first true one, and have a trigger for "You eat a(wildcard)" that sets herbbalance to 0. The latter is really ugly, and you'll wind up with a thousand closing brackets, but it won't set herbbalance to 0 when you don't wind up eating the herb. (Imagine if you try eating something while you have anorexia, or if the eating gets messed up by stupidity. You've set your herbbalance variable to 0, and unless you've got another check somewhere that'll reset it after a while, you'll stop herb curing all together.) Here's how this goes:

#if herbbalance > 0 {
---#if anorexia < 1 {
------#if stupidity > 0 {penny} else {
---------#if recklessness > 0 {hore} else {
------------#if epilepsy > 0 {kombu}}}}}

I think I counted all those brackets correctly... unsure.gif I've never done something like this in Nexus, so it might turn out to be incredibly slow as it gets more complex. I really recommend opting for a standalone client if you're actually going to try to code a system. The logic described here is similar to the way zMUD runs; MUSHclient scripting allows you to use much nicer, cleaner, more understandable coding IMO.