Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

AAARRGGHH! This is so frustrating! The best I've come up with is:

integers {
   turns : integer_dynamic {(turns())}
}

on_command {

   : match "score _"  {
      : print {(
         "You have scored " + score + " points in " + turns + " turns."
      )}
   }
}

You can also use ticks() instead of turns(). However, on the first move, it says, "... 1 turns.", then it increases by 2 on every turn. What's going on here?

You are using the old document Garry, don't refer to that, that version of adventuron 0.5.x has been largely re-written, and a lot of the placeholder functions are still there, written in the wrong format. The only document you should use is the one with the built in tutorial, and the document in the MENU button of the editor.

Anyway ... 

turns() is simply a function that returns an integer. You can only use functions like that in expressions:

e.g.

: if (turns() < 10) {

    // some code

}


You can also use turns in dynamic integers, as you described before:

integers {
   turns : integer_dynamic {(turns())}
}

But, you can also use turns in the expression form that is supported by some commands (such as print and append):

on_command {

   : match "score _"  {

      // NOTICE -- No need for a dynamic integer, just call the function directly.

          : print {(  "You have scored " + score + " points in " + turns() + " turns."       )} 

 } 

}

turns() returns the number of times that a command was submitted

ticks() returns the number of times the on_tick() method was executed.

Some commands, such as inventory, is (supposed) to stop an onward game tick. Actually there is a bug with inventory that it is not doing that. Just for the clarification.