|
7 registered members (fairtrader, Quad, miwok, Martin_HH, AndrewAMD, alibaba, dpn),
581
guests, and 0
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
It does what it likes -.-
#306650
01/23/10 21:00
01/23/10 21:00
|
Joined: Dec 2008
Posts: 605 47°19'02.40" N 8°32'54.67" E...
hopfel
OP
User
|
OP
User
Joined: Dec 2008
Posts: 605
47°19'02.40" N 8°32'54.67" E...
|
Hi, me again. I'm programming on a little rpg and I made this little very easy code to check, if the player went out 5 fire:
while(firenumber<5){wait(1);} //wait as long as the player went out all fires
And in the function from the fire:
if( -water on me-) firenumber+=1;
But now, if I went out all fires ingame, nothing happens. I made a digit for the variable firenumber, and it's on 5 and anyway nothing happens. I worked with beep(); so i'm sure the fault is in the Code, which I wrote here.
Hilf mir, dir zu helfen!
|
|
|
Re: It does what it likes -.-
[Re: Oxy]
#306658
01/23/10 22:04
01/23/10 22:04
|
Joined: Dec 2008
Posts: 605 47°19'02.40" N 8°32'54.67" E...
hopfel
OP
User
|
OP
User
Joined: Dec 2008
Posts: 605
47°19'02.40" N 8°32'54.67" E...
|
I tried this: beep(); while(firenumber<5){wait(1);} beep(); The first beep comed, but not the second  And how I said, I made a digit on a panel for the variable "firenumber", and it counts fine... EDIT: I tried this: beep(); while(firenumber<5){beep();wait(-1);} //beep every second beep();beep();beep();beep(); //make four fast beeps Ingame, it beeped first, then it beeped every second. But when I extinguished one fire, it stopped beeping, but not four fast beeps. The whole function got stuck (maybe) It's so confusing :S
Last edited by hopfel; 01/23/10 22:12.
Hilf mir, dir zu helfen!
|
|
|
Re: It does what it likes -.-
[Re: hopfel]
#306724
01/24/10 14:39
01/24/10 14:39
|
Joined: Apr 2006
Posts: 737 Ottawa, Canada
Ottawa
User
|
User
Joined: Apr 2006
Posts: 737
Ottawa, Canada
|
Hi! try
beep();
while(firenumber<5)
{
for (var i=1; i<5; i++)
{
beep();wait(-1);
} //beep every second
}
not tested
Hope this helps! Ottawa  Ver 7.86.2 Pro and Lite-C
|
|
|
Re: It does what it likes -.-
[Re: hopfel]
#306728
01/24/10 15:08
01/24/10 15:08
|
Joined: Apr 2006
Posts: 737 Ottawa, Canada
Ottawa
User
|
User
Joined: Apr 2006
Posts: 737
Ottawa, Canada
|
Hi hopfel! if I extinguished one of the five fires, it stopped beeping
Verify your panel to make sure that it shows the numbers going from 1 to 5. Make the wait longer to slow things down.
Hope this helps! Ottawa  Ver 7.86.2 Pro and Lite-C
|
|
|
Re: It does what it likes -.-
[Re: Ottawa]
#306733
01/24/10 15:35
01/24/10 15:35
|
Joined: Dec 2008
Posts: 605 47°19'02.40" N 8°32'54.67" E...
hopfel
OP
User
|
OP
User
Joined: Dec 2008
Posts: 605
47°19'02.40" N 8°32'54.67" E...
|
I wrote this code: beep(); var i = 0; while(firenumber<5) { for (i=1; i<5; i++) { test = i; beep();wait(-2); } //beep every second } This was the operational sequence: - firenumber = 0 *beep* *beep* (1 second later) *beep* - i = 1 (1 second later) *beep* - i = 2 (1 second later) *beep* - i = 3 (1 second later) *beep* - i = 4 (1 second later) *beep* - i = 1 - I extinguished one of the five fires - firenumber = 1 (1 second later) -nothing happened, i stayed on 1. - I extinguished the other four fires - firenumber = 5 - nothing happened I think it's the same strange problem from here: http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Main=36996&Number=302333#Post302333
Hilf mir, dir zu helfen!
|
|
|
Re: It does what it likes -.-
[Re: hopfel]
#306740
01/24/10 16:13
01/24/10 16:13
|
Joined: Apr 2006
Posts: 737 Ottawa, Canada
Ottawa
User
|
User
Joined: Apr 2006
Posts: 737
Ottawa, Canada
|
Hi!
Once the value of firenumber is 5 it stays 5 until you reset it in your code. Do you reset it for the next fire?
Hope this helps! Ottawa  Ver 7.86.2 Pro and Lite-C
|
|
|
Re: It does what it likes -.-
[Re: hopfel]
#306795
01/25/10 00:04
01/25/10 00:04
|
Joined: Apr 2006
Posts: 737 Ottawa, Canada
Ottawa
User
|
User
Joined: Apr 2006
Posts: 737
Ottawa, Canada
|
Hi! A few questions How many players are putting the fire out? Is this the situation? You have 5 fires You have to put water on them
firenumber is 0 when your start code to repeat this action until firenumber is 5 the fire is on put water on this fire firenumber is +1 fire is out repeat
You will have to give us some code to work with.
Hope this helps! Ottawa  Ver 7.86.2 Pro and Lite-C
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|