DoTake

When using 'Take all' in game, the 'DoTake function will use the take message from each successful take. My issue occurs because I 'ClearTurn' then print a message in the 'script to run after taking' of taken items. Thus, only the last taken object message is shown when 'take all' is used.

I am trying to prevent scrolling of the page and only show the present turn's action. I prefer the look of the game that way. It works great aside from the 'takeAll'.

If I use my own script instead of the default action, this would stop the clearturn but would have to manually add the 'take' script to each item. I can do that but was wondering if anyone could think of a different way.


Clearing the screen for each command individually sounds like it would be a lot of work, and would break for almost every command which supports "all".

If you want to clear the screen every turn, but before any output generated by commands, I would have thought the easiest way would be overriding this function (which is called immediately before echoing the command to the screen; so the top thing on screen would always be the last command entered if you have echoing commands turned on)

  <function name="StartTurnOutputSection">
    ClearScreen
    game.currentturnoutputsection = StartNewOutputSection()
  </function>

Thanks mrangel,
The clear screen removes the room description. I like it to remain and just the action below it is removed. Gives the page a nice appearance. I have not been using the echo command.

I think my best solution is to not 'ClearTurn' on any object that can be taken. Typically there aren't many objects in a room and the page won't fill and start scrolling. I want to keep the room description from scrolling and all the action happen under it.

I could put the room description in it's own 'div'. I'll have to try to figure that out.


The clear screen removes the room description.

You can always put it back.

  <function name="StartTurnOutputSection">
    ClearScreen
    ShowRoomDescription
    game.currentturnoutputsection = StartNewOutputSection()
  </function>

Screen will always contain the room description and the output from your latest command.

Or another way to do the same thing, without needing to override functions. Have a turnscript which does:

if (not Equal (this.room, game.pov.parent)) {
  this.room = game.pov.parent
  this.description = this.currentturnoutputsection
}
if (HasString (game, "lastturnoutputsection") and not Equal (game.lastturnoutputsection, this.description)) {
  RemoveOutputSection (game.lastturnoutputsection)
}

(removes the previous turn's output if it isn't the room description. Not tested yet)


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

Support

Forums