Please login or register.

Login with username, password and session length
Advanced search  

News:

For WME related articles and tutorials visit WME Resource Center.

Author Topic: infinte loop  (Read 3296 times)

0 Members and 1 Guest are viewing this topic.

Drax

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 78
  • This engine rocks!
    • View Profile
    • Ganja Joe - And the myth of the holy pot
infinte loop
« on: February 11, 2004, 01:51:04 PM »

I have a litte problem with an infinte loop in a scene.

a little introduction:

theres a dog in the scene, and if the actor walks to near,  the dog starts to bark, and the actor turns arround an walks  back an says something.

it should be removed (the script) if the dog is away.

now my solution:

I attached this script in the scene_init.script to the Game:
Code: [Select]
#include "scripts\base.inc"
#include "scripts\keys.inc"
global dogflag=true;

while(dogflag){

if(actor.X<=260){
   actor.Reset;
   actor.GoTo(650,500);
   actor.TurnTo(DI_DOWN);
   actor.Talk("bla");
}
if(actor.Y<=450){
   actor.Reset;
   actor.GoTo(650,500);
   actor.TurnTo(DI_DOWN);
   actor.Talk("bla");
}
   
Sleep(20);
}   


It works fine the first time I 'overwalk' one of the borders. but then, the script dosn't work. Why?  ???


 
Logged
I'm Lost!

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re:infinte loop
« Reply #1 on: February 11, 2004, 02:04:04 PM »

Hmmm, try putting Game.Interactive = false / true around the two blocks so that the script cannot be interupted while the actor is walking/talking.

Other than that, I can't see anything wrong with the code...
« Last Edit: February 11, 2004, 02:04:14 PM by Mnemonic »
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Drax

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 78
  • This engine rocks!
    • View Profile
    • Ganja Joe - And the myth of the holy pot
Re:infinte loop
« Reply #2 on: February 11, 2004, 02:11:39 PM »

that it was! can't believe your reading my post, and immediatly posting the correct answer, the whole time! Your a living debugger. (Thats not human.....tzz.....)

thanx a lot!
Logged
I'm Lost!

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re:infinte loop
« Reply #3 on: February 11, 2004, 03:10:43 PM »

A living debugger, lol :)
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave
 

Page created in 0.029 seconds with 20 queries.