Issues with function ordering

Started by Zoo977, Mon 11/06/2012 15:10:03

Previous topic - Next topic

Zoo977

Right now, I'm working with getting the hang of coding for a game I'm working on. I'm having problems with a certain line of script, however;

function oKnife_Interact()
{
  cEgo.Walk(147,  131);
  Display("You pick it up, and place it in your purse.");
  Display("Woah, wait, no. You're not a nosy reporter. Either way, you have a stabby now. Horray!");
  oKnife.Visible = false;
  player.AddInventory(iKnife);
}

What I want for it to do is have every function occur in the order it's listed in. However, when I do this, it shifts the movement to the end of the function. What can I do to fix this problem?
☆**☆.ãâ,¬â€š.:*ãÆ'»ã‚Å"☆.ãâ,¬â€š.*  s  u  f  f  e  r  i  n  g .ãâ,¬â€š.☆ã‚Å"ãÆ'»*:.ãâ,¬â€š.☆**☆.ãâ,¬â€š

monkey0506

Quote from: The ManualWalk
(Formerly known as MoveCharacter, which is now obsolete)
(Formerly known as MoveCharacterBlocking, which is now obsolete)
(Formerly known as MoveCharacterDirect, which is now obsolete)

Character.Walk(int x, int y, optional BlockingStyle,
                             optional WalkWhere);

Starts the character moving from its current location to (X,Y), whilst playing his walking animation.

If blocking is eNoBlock (the default) then control returns to the script immediately, and the character will move in the background.

If blocking is eBlock then this command will wait for the character to finish moving before your script resumes.

So you need to do this:

Code: ags
function oKnife_Interact()
{
  cEgo.Walk(147, 131, eBlock);
  Display("You pick it up, and place it in your purse.");
  Display("Woah, wait, no. you're not a nosy reporter. Either way, you have a stabby now. Hooray!");
  oKnife.Visible = false;
  player.AddInventory(iKnife);
}

Zoo977

Okay, the script is working now. Thank you!
☆**☆.ãâ,¬â€š.:*ãÆ'»ã‚Å"☆.ãâ,¬â€š.*  s  u  f  f  e  r  i  n  g .ãâ,¬â€š.☆ã‚Å"ãÆ'»*:.ãâ,¬â€š.☆**☆.ãâ,¬â€š

SMF spam blocked by CleanTalk