Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Harlowe: Choose highest value

Hi,

I have 4 variables each of them is different

A: 1
B: 4
C: 2
D: 6

In the game only the highest variable shall be shown. So variable D shall be shown in my example.

How do I do that in Harlowe?

Comments

  • You can use the Javascript Math.max function:
    (set: $var1 to 1)
    (set: $var2 to 3)
    (set: $var3 to 9)
    (set: $var4 to 7)
    
    max: (print: Math.max($var1, $var2, $var3, $var4))
    
  • You can also use the standard (max:) macro:
    (max: $var1, $var2, $var3, $var4)
    
    There's also (floor:), (ceil:), (round:), (min:), (abs:), (sign:), (sin:), (cos:), (tan:), and a few more esoteric ones (pow, log, log10, log2, sqrt, exp), if you need other maths functions normally only usable in JS.
  • thanks a lot
Sign In or Register to comment.