Nexus variables

by Unknown

Back to Mechanic's Corner.

Unknown2006-05-28 17:43:32
Does anyone know a simple way to search for a greatest value in Nexus? For example you have three variables with different values and you wanted the script to select the one with the greatest value. Any help is appreciated.
Mirk2006-05-29 17:46:18
#if a > b(might need a $) {if a> c
stuff if a is largest}
} elsif b < c { stuff if b is largest
} else {stuff if c is largest }
Daganev2006-05-29 17:57:33
odd, I lost what I wrote...

CODE

#if $a > $b {
#if $a> $c { a is largest } elsif b < c { b is largest }
else {c is largest }


Make sure the elsif is on the same line as the #if.
Mirk2006-05-29 23:16:39
QUOTE(daganev @ May 29 2006, 12:57 PM) 292046

odd, I lost what I wrote...

CODE

#if $a > $b {
#if $a> $c { a is largest } elsif b < c { b is largest }
else {c is largest }


Make sure the elsif is on the same line as the #if.

actually, it should be

CODE
#if $a > $b {
         #if $a > $c {stuff for a being largest }
} (<--you forgot that thingy, otherwise it would never think c or b is largest) elsif $b > $c {
          Stuff for b beling largest
} else {stuff for c}
Shiri2006-05-30 00:50:55
For the "c is largest" Daganev put you'd have to do something like "#set largestvariable c". Then have whatever you need to know the largest variable for do "#echo $largestvariable" or whatever.
Mirk2006-05-30 01:18:46
QUOTE(Shiri @ May 29 2006, 07:50 PM) 292096

For the "c is largest" Daganev put you'd have to do something like "#set largestvariable c".

You'd need to put a $ in front of c, unless you wanted the largest variable just stored as c (where c means something like ego).

Just a note: you can't use a variable to use another alias for nexus. In other words, you can't do this:
CODE

Alias: clup
Group: whatever
Code:Climb up
Cling
-------------------------
Alias: cldown
Group: whatever
code:
climb down
-------------------------
Alias: elchange
Group: whatever
Code:
#if $aboveground = 1 {
     #set donext cldown
     } else {
     #set donext clup}
$donext
--------------------------
Trigger: You have recovered balance...
Group: default
Code: $donext

So what that is supposed to do is if you're above ground, tell it to climb down when you regained balance, or vice versa, but what happens is you send cldown or clup to lusternia which won't do anything, not the nexus client (I learned this the hard way...)
Unknown2006-05-30 01:18:51
Thanks very much. Again I really appreciate it.
Shiri2006-05-30 01:44:56
QUOTE(Mirk @ May 30 2006, 02:18 AM) 292103

You'd need to put a $ in front of c, unless you wanted the largest variable just stored as c (where c means something like ego).

That's what I meant, yea.
QUOTE

Just a note: you can't use a variable to use another alias for nexus. In other words, you can't do this:
CODE

Alias: clup
Group: whatever
Code:Climb up
Cling
-------------------------
Alias: cldown
Group: whatever
code:
climb down
-------------------------
Alias: elchange
Group: whatever
Code:
#if $aboveground = 1 {
     #set donext cldown
     } else {
     #set donext clup}
$donext
--------------------------
Trigger: You have recovered balance...
Group: default
Code: $donext

So what that is supposed to do is if you're above ground, tell it to climb down when you regained balance, or vice versa, but what happens is you send cldown or clup to lusternia which won't do anything, not the nexus client (I learned this the hard way...)


Hmm, are you sure? What you described as being impossible is exactly the way I used to do it on java Pre-Nexus, so I would think my system would be dying if you couldn't do that, but it isn't. unsure.gif

EDIT: I just tested it. If I set an alias "testing" to execute "$test", and set variable "test" to stand, the alias "testing" executes stand. Maybe that's not what you meant though.

EDIT: Nevermind, that isn't what you meant. doh.gif