Timer help

Started by RyeGuy83, Thu 06/10/2011 18:44:29

Previous topic - Next topic

RyeGuy83

Ok all.  here's the situation.  I am creating a game in which a guy is burning from the inside.  I have it set to timer 1 with setTimer(1,40)

in GlobalScript.asc
---------------------------------------------------
function repeatedly_execute()
{
   if (IsTimerExpired(1)==1)
    {
      heatUp();
      SetTimer(1, 100);
    }
}

That function works fine.   I have a water bottle that currently lowers the character's heat value by a defined value.  That also works.  I am now trying to pause the heatUp() function for 60 seconds after using the water bottle, then continue.   I have tried to create my own timer to decrament in a while loop for the pause, but it doesn't seem to work.


function iWaterBtl_Interact()
{
   coolOff();                                                              // cools off player and designated amount
   waterToken -= 1;                                                 // decrements waterToken by 1, starting at 4 (declared in global variables)
   if (waterToken ==0)                                             // if waterToken reaches 0, remove iWaterBtl from inventory
   {
      cChristian.LoseInventory(iWaterBtl);
   }
   mouse.Mode=eModeInteract;
     while (waterTimer >= 0)                                    // water timer declared in global variables as int 60
     {                                                                        // while waterTimer is greater than 0
     heatIndex = heatIndex;                                    // set heatIndex to itself (aka.. pause heatIndex)
     waterTimer -= 1;                                                // decrement waterTimer by 1
     }
}

pcj

Don't post the same question in more than one forum at the same time - it won't be answered any faster.

http://www.adventuregamestudio.co.uk/yabb/index.php?topic=44580.0
Space Quest: Vohaul Strikes Back is now available to download!

RyeGuy83

Quote from: pcj on Thu 06/10/2011 19:04:42
Don't post the same question in more than one forum at the same time - it won't be answered any faster.

http://www.adventuregamestudio.co.uk/yabb/index.php?topic=44580.0

Yeah.. wasn't trying to get it faster.  Just wasn't sure which forum to post it in.  See the response in Beginner forum.

SMF spam blocked by CleanTalk