Up dating an attribute everyturn to trigger an event

So I recently asked how I could give a room a verb. I was referred to making a command and it worked until I got to the attribute. What I'm trying to do is create a attribute that is an integer, that every turn the player uses the command that is check to see it's value to determine which text to show then the interger is update +1. I set up the attribue in the rooms tab, and set it to 0 as an interger. then I made the command. In the script I did if attribute value equals, 0 for example then play this text and add 1 to the interger of the attribute, and did that for six turns. but when I run the game I get this
Error running script: Error compiling expression '': SyntaxError: Unexpected end of fileLine: 1, Column: 1
I don't know what is wrong?


I can't think of any reason you'd be getting that error unless the file is corrupt. I could be missing something, though.

Could you view the command in code view and paste it here, so we can see exactly what you're doing?


line 1 column 1...

did you accidentally remove the '<' from the '

// missing the '<' here:

asl version="550">

// if so, then just add it back:

<asl version="550">

if the error in the code is else where (such as within just your 'whatever' Command), we'd need to see that specific part of code and/or your entire game code, to find and fix it for you


here's an example of what you are trying to do (you can compare it to what you did):

<object name="example_room">

  <inherit name="editor_room" />

  <attr name="example_integer_attribute" type="int">0</attr>

  <attr name="turn_integer_attribute" type="int">0</attr>

  <attr name="description" type="script">
    msg ("{command:example_command:click me}")
  </attr>

  <command name="example_command">

    <pattern>example</pattern>

    <script>

      <![CDATA[

        if (example_room.turn_integer_attribute = 7) {
          example_room.turn_integer_attribute = 0 // resetting its value
          // example_room.example_integer_attribute = 0 // remove the comment 2 forward slashes if you want to reset this value too
        } else {
          if (example_room.turn_integer_attribute = 0) {
            msg ("0")
          } else if (example_room.turn_integer_attribute = 1) {
            msg ("1")
          } else if (example_room.turn_integer_attribute = 2) {
            msg ("2")
          } else if (example_room.turn_integer_attribute = 3) {
            msg ("3")
          } else if (example_room.turn_integer_attribute = 4) {
            msg ("4")
          } else if (example_room.turn_integer_attribute = 5) {
            msg ("5")
          } else if (example_room.turn_integer_attribute = 6) {
            msg ("6")
          } else {
            msg ("N")
          }
          example_room.turn_integer_attribute = example_room.turn_integer_attribute + 1
          example_room.example_integer_attribute = example_room.example_integer_attribute + 1
        }

      ]]>

    </script>

  </command>

</object>

K.V.

It's strange that the game even opens in the editor with that error.


Your right some how when I copy pasted a lot got left out here is the entire message
(Edit)Sorry but every time I try to post the entire error message the forum cuts off a huge chunk of it, how do I get around this?


If you have XML in your post, you need to put a line of three backticks (``` - on a line of their own) above and below it.

Otherwise, I don't know what the problem might be.


Okay got the entire thing this time

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

@hegemonkhan

line 1 column 1...

Unfortunately, not that useful. At some points in quest, the line/column number refers to a position within the expression curently being evaluated. So line 1, column 1 can be the character immediately after the = in an assignment.

@Thickar
In this case, I'm guessing you have something like:

objectname.attributename = +1
when it should be
objectname.attributename = objectname.attributename + 1

Or something like that. It's really hard to work out what is wrong with the code when we can't see the code.

If you have some code that isn't working, please try pasting the code. Then we can look at it, and see what's wrong with it.


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

Support

Forums