There's an error I can't figure out the problem for.

Aarak
14 Feb 2022, 22:45

I've had an error that doesn't really tell me why so if you understand, please help. By the way this is it: Error running script: Error compiling expression '': SyntaxError: Unexpected end of fileLine: 1, Column: 1


mrangel
14 Feb 2022, 22:52

That normally means that it's failed to parse the script; so something is wrong in a way that Quest can't give a useful error message.

To give a more detailed answer, we'd need to see the script. If it does that when you do a particular thing, try to find the script for that event. If it happens as soon as you load a game, the file might be corrupt. It could be possible to fix it – an XML validator could help you to find the problem.


Aarak
15 Feb 2022, 00:42

okay i'll show you: pointmenu = NewStringList() list add (pointmenu, "STR") list add (pointmenu, "DEX") list add (pointmenu, "INT") ShowMenu ("Select an ability score to add points in. You have " +game.pov.points+ " available.", , true) { } if (result = "STR") { msg ("How many points do you want for strength? Example 1, 3, 5 ") get input { i = ToInt[result] if (game.pov.points >= i) { game.pov.STR = game.pov.STR + i game.pov.points = game.pov.STR - i msg ("Your strength is " +game.pov.STR+ ".") Ask ("Would you like to add more points?" +game.pov.points+ " points remain.") { if (result = True) { assignpoints } else { msg ("Ok you can always assign points by typing assignpoints;points;pts;pt;score;assign.") MoveObject (game.pov, Entrance_Floor) } } } } }


mrangel
15 Feb 2022, 01:47

It might be easier to read with the line breaks in it.

If you put 3 `s (and nothing else) on the same line, it treats everything as code until it sees another line of 3 backticks.

Like this:

```
Code goes here
if (something) {
  // You can see how it's indented
}
```

More convenient than doing it on one line if you have more than one line of code.

Now, I should probably ask, because a line break in the wrong place could probably cause this error. But I expect your code looks something like this (just adding line breaks to what you posted):

pointmenu = NewStringList()
list add (pointmenu, "STR")
list add (pointmenu, "DEX")
list add (pointmenu, "INT")
ShowMenu ("Select an ability score to add points in. You have " +game.pov.points+ " available.", , true) {
}
if (result = "STR") {
  msg ("How many points do you want for strength? Example 1, 3, 5 ")
  get input {
    i = ToInt[result]
    if (game.pov.points >= i) {
      game.pov.STR = game.pov.STR + i
      game.pov.points = game.pov.STR - i
      msg ("Your strength is " +game.pov.STR+ ".")
      Ask ("Would you like to add more points?" +game.pov.points+ " points remain.") {
        if (result = True) {
          assignpoints
        }
        else {
          msg ("Ok you can always assign points by typing assignpoints;points;pts;pt;score;assign.")
          MoveObject (game.pov, Entrance_Floor)
        }
      }
    }
  }
}

The two issues I see there are that you have i = ToInt[result] instead of i = ToInt(result); and that your ShowMenu call doesn't do anything when the player clicks on a choice.

Remember that ShowMenu works like this:

ShowMenu ("Question?", options, true) {
  // This code is saved until next turn
  // To run when the player chooses an option
  // It looks like you have nothing here
}
// This code is run immediately after *showing* the menu
// before waiting for a response
// you have a lot of code here

But I wouldn't expect either of those things to give that error message, so I'm not sure what is happening.

Ah… you have a parameter missing in the showMenu line. You have two commas with nothing between them, which could be an issue. There's supposed to be a list of options there.

If I'm understanding it right, you might want to make that code something like:

ShowMenu ("Select an ability score to add points in. You have " +game.pov.points+ " available.", Split("STR;DEX;INT"), true) {
  switch (result) {
    case ("STR") {
      msg ("How many points do you want for strength? Example 1, 3, 5 ")
      get input {
        i = ToInt[result]
        if (game.pov.points >= i) {
          game.pov.STR = game.pov.STR + i
          game.pov.points = game.pov.STR - i
          msg ("Your strength is " +game.pov.STR+ ".")
          Ask ("Would you like to add more points?" +game.pov.points+ " points remain.") {
            if (result) {
              assignpoints
            }
            else {
              msg ("Ok you can always assign points by typing assignpoints;points;pts;pt;score;assign.")
              MoveObject (game.pov, Entrance_Floor)
            }
          }
        }
      }
    }
  }
}

Aarak
15 Feb 2022, 03:18

ok thx you were very hepful btw i didnt finish that part yet


mrangel
15 Feb 2022, 11:36

(It looks like the rest of the options are going to be similar… if they are, it might be easier to skip the if (result = "STR") { part entirely, and do something like:

ShowMenu ("Select an ability score to add points in. You have " +game.pov.points+ " available.", Split("strength;dexterity;intelligence"), true) {
  stat = result
  attr = UCase (Left (stat, 3))
  msg ("How many points do you want for " + stat + "? Example 1, 3, 5 ")
  get input {
    if (IsInt (result)) {
      i = ToInt(result)
      if (game.pov.points >= i) {
        set (game.pov, attr, GetAttribute (game.pov, attr) + i)
        game.pov.points = game.pov.points - i
        msg ("Your " + stat + " is " + GetAttribute (game.pov, attr) + ".")
        Ask ("Would you like to add more points?" +game.pov.points+ " points remain.") {
          if (result) {
            assignpoints
          }
          else {
            msg ("Ok you can always assign points by typing assignpoints;points;pts;pt;score;assign.")
            MoveObject (game.pov, Entrance_Floor)
          }
        }
      }
    }
    else {
      msg ("That's not a number. Try again.")
      assignpoints
    }
  }
}