SYNOPSIS

compat mode void reset( int arg)
native mode void reset( void)

DESCRIPTION

The H_RESET(H) hook defines the function or closure to be called when the driver needs to reset an object. In older drivers this was hardwired to the lfun reset(A), and a lot of hook implementations still follow this tradition.

In compat mode, reset(A) was called with arg 0 after the object was compiled, and with arg != 0 every once in a while. In native mode, create(A) is called after compiling, and reset(A) is called without arguments every once in a while.

So, if the argument is zero, the parser is running in compat mode, and reset(A) may call your create(A) code. If create(A) is called, you’re on the new version and reset(A) is not called for object creation. You may call reset(A) from create(A) and vice versa, but make sure they do not call each other recursively on either type of driver.

reset(A) will be called only in objects that have been used since the last call to reset(A), i.e. a function in them was called (other than reset(A) or clean_up(A)), or it was moved around.

This function can be used to reset the state of the object or do some checks or what ever. The game wouldn’t be fun if no challenges remained.

HISTORY

  • changed (3.2.1) – the mudlib can be programmed to call an other lfun than reset(A) to reset an object with reset(H)