Inventory cursor time-out ?

Started by AndersM, Wed 22/10/2003 18:07:27

Previous topic - Next topic

AndersM

When you have picked an inventory object from the inventory-list, and this is used as a cursor, you are stuck with it in the cursor-cycle untill you pick up something else or lose the inventory item.

can I somehow put a 'time-out' for the item, so the cursor-cycle returns to 'normal' after let's say one minute (but without loosing the object from the inventory-list) or maybee some script that shows the item for let's say 5 cycles and then returns to normal (again without loosing the object from the inventory-list)

Do you get it?

Kweepa

In III Spy, I call this function from the "Player enters screen (before fadein)" script:

function EnteredRoom()
{
 character[EGO].activeinv = -1;
 if (GetCursorMode() < 6)
 {
   SetCursorMode(MODE_WALK);
 }
}

It basically sets the cursor mode to walk and clears the active inventory item.

If you wanted to have it time out, you could do something like this in the global script:

int oldActiveInv = -1;
int activeInvTimeout = 500;

then add to function repeatedly_execute()

int activeInv = character[EGO].activeinv;
if (activeInv != -1)
{
 if (activeInv != oldActiveInv)
 {
   oldActiveInv = activeInv;
   activeInvTimeout = 500;
 }
 else
 {
   activeInvTimeout--;
   if (activeInvTimeout <= 0)
  {
    character[EGO].activeinv = -1;
    if (GetCursorMode() == 4) // use with
   {
     SetCursorMode(MODE_WALK);
   }
 }
}
oldActiveInv = activeInv;

If you wanted to reset it after a certain number of moves, put a similar thing in function on_mouse_click().

Cheers,
Steve
Still waiting for Purity of the Surf II

AndersM

Thank Thee, Steve, my new best friend. I choosed the

function EnteredRoom()
{
character[EGO].activeinv = -1;
if (GetCursorMode() < 6)
{
SetCursorMode(MODE_WALK);
}
}

alternatvie, and it did not work. Then, after 15 minutes of
'code-control', I notised that my character isn't named 'EGO'.....

SMF spam blocked by CleanTalk