This should be simple (and probably is)....

When I run this:

if (GetBoolean(player, "talkbj2")) {
  if ( = 1) {
    msg ("You're in B.J's bedroom <small>(AKA the dumpster)</small>. Hurt within an inch of your life.")
  else if ( > 26) {
    msg ("Feeling good enough.")
  else if ( > 10) {
    msg ("Feeling better but not good enough.")
else {
  msg ("here be else statement.")

I get this:

Error running script: Error compiling expression ' => 26': SyntaxError: Unexpected token ">"; expected one of "-", <INTEGER>, <REAL>, <STRING_LITERAL>, "True", "False", <HEX_LITERAL>, <CHAR_LITERAL>, "null", <DATETIME>, <TIMESPAN>, "(", <IDENTIFIER>, "if", or "cast"Line: 1, Column: 24

In the error message I get this ' => 26' but I typed in this ( > 26)

And it make me feel like this:

When reading my code I get a haunting feeling this will end in embarrassment. So be it.

Alright try entering the code in again. And refreshing the page.

Maybe you have a problem with your formating, it appears to be the 'health > 20' part. Every once in a while, the game thinks that the code is formatted improperly when it isn't check to see if the code is formatted correctly. Alternatively, the player's health attribute is not set up right. If those fail, copy the code into word or another function, delete the code, and then make the code again.

I bet it's in a different script.

Open the game in full code view, then hit CTRL+F and search for => 26.

Try changing it to >= 26

ya, KV's probably got it right, as the formatting requires for the equal sign to be on the RIGHT SIDE (just something to memorize), when doing:

greater than or equal to: >=
lesser than or equal to: <=
// here's an example (max to min):

if (test.score >= 90) {
  test.grade = "A"
} else if (test.score >= 80) {
  test.grade = "B"
} else if (test.score >= 70) {
  test.grade = "C"
} else if (test.score >= 60) {
  test.grade = "D"
} else {
  test.grade = "F"

// or the reverse (min to max) example:

if (test.score <= 59) {
  test.grade = "F"
} else if (test.score <= 69) {
  test.grade = "D"
} else if (test.score <= 79) {
  test.grade = "C"
} else if (test.score <= 89) {
  test.grade = "B"
} else {
  test.grade = "A"

as this (having the equal sign on the LEFT side of a greater than sign) is a Script Attribute Assignment operation/operator:

create ("example_object")

example_object.example_script_attribute => {
  msg ("blah blah blah")

do (example_object, "example_script_attribute")

// output: blah blah blah

I probably would not have figured that out on my own.
Thanks guys!!!

I myself always forgot which side the equal sign vs the greater/lesser than sign... lol... I always have to look it up... so it's just something you got to remember (and which I have a hard time at remembering, lol)

I bookmarked this thread for future reference. I'll forget too!

I always make that mistake in Perl after I've not used it for a while. (In Perl, the arrow operator is weird. It acts like a comma in an argument list, except that if the item to the left of it is a single word it gets treated as a string rather than an identifier)

This topic is now closed. Topics are closed after 60 days of inactivity.