Battle Log with delay (Print Out List With A Delay Between Items)

Hi, here's my code for displaying the battle log (RPG style game).

  1. add a stringlist attribute to the game object, call it "battleLog". This will be the data storage for all the messages that will be to printed.

  2. store every message of the "attacktheplayer" turnscript ("you miss...", "the enemy hits...", etc.) in the stringlist with this code:
    see for reference.

add (game.battleLog, message)
  1. In the "attacktheplayer" turnscript (from RPG combat lib) , paste this code at the end (it shoul be at the end of every cycle of the turnscript):
    foreach(entry, game.battleLog) {
         request(Hide, "Command") // this is for hiding the command bar while while the timer display the logs.
         EnableTimer (displayBattleLog)
  1. create a Timer (I call it "displayBattleLog"), paste this code:
<timer name="displayBattleLog">
			message= StringListItem (game.battleLog, 0)
			msg ("<br>" + message)   // this prints the message
			JS.scrollToEnd ()   // this scrolls the text to the bottom of the GUI
			list remove (game.battleLog, message)     //this removes the message from the list after it is displayed.
			// Now checks if the list is empty. 
                       // If it is, the TIMER stops the the command bar is dislayed, as normal.

			if(ListCount(game.battleLog) = 0){     
				DisableTimer (displayBattleLog)	
				request(Show, "Command")					

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