View Full Version : Progress report help
Hey,
For some reason i can't get my progress report right.
It report only the stats of the last round.
But no of all the previous rounds :(
Here is my script.
http://villavu.com/forum/showthread.php?t=57191
All works out fine now, thx for the help.
Blumblebee
06-07-2010, 09:22 PM
it should be
Players[CurrentPlayer].Integers[10] := Players[CurrentPlayer].Integers[10]+Gems;
instead of
Players[CurrentPlayer].Integers[10] := Gems
alternatively you can also do
IncEx(Players[CurrentPlayer].Integers[10], Gems)
tell me if that works I looked at your script for all of 15 seconds.
Coh3n
06-07-2010, 09:26 PM
You don't set Players[CurrentPlayer].Integers[1], so everytime Proggy is called, TotalOres will be set to 0 (Players[CurrentPlayer].Integers[1] is 0 if not set) + Ores, so you'll always only get one load.
You have to do something like:
IncEx(Players[CurrentPlayer].Integers[1], Ores); //will add 'Ores' to Integers[1];
for i := 0 to High(Players) do
IncEx(TotalOres, Players[i].Integers[1]); //will add each players ores to the total script ores
I had no idea the integers were set to 0 every time a procedures is called.
procedure count;
var
a:integer;
begin
a:=0;
repeat
a:=a+1;
writeln(inttostr(a));
until(a>10)
end;
Would this be the same as?
procedure count;
var
a:integer;
begin
// not set a to 0 because this is done automatic?
repeat
a:=a+1;
writeln(inttostr(a));
until(a>10)
end;
EDIT: after i posted it i wounder why i didnt test it myself ( i am lazy)
But i did test it and it is indeed the same.
Thx for the clarification tough.
I ll let my code here for some ppl that might have the same issue.
Coh3n
06-08-2010, 09:54 PM
I just want to clarify, it's only local variables that are automatically set to 0 when the procedure is called. Global variables are set to 0 when the script starts and is never reset to 0 (unless the scripter manually resets of course).
i luffs yeww
06-09-2010, 11:37 AM
And it's good practice to "reset" local variables at the beginning of every procedure/function.
Coh3n
06-09-2010, 09:13 PM
And it's good practice to "reset" local variables at the beginning of every procedure/function.
Guess it depends who you talk to. I don't find it necessary to reset them when they're already done automatically. Just takes up lines for no real purpose. That's just me though.
Guess it depends who you talk to. I don't find it necessary to reset them when they're already done automatically. Just takes up lines for no real purpose. That's just me though.
Sometimes it bugs out and they don't initialize automatically..
Coh3n
06-09-2010, 09:20 PM
Sometimes it bugs out and they don't initialize automatically..
I've never had that problem that I know of, but I didn't know that. :p
Sometimes it bugs out and they don't initialize automatically..
What do you mean they don't initialize? They don't get set to 0? Then what would they equal?...
What do you mean they don't initialize? They don't get set to 0? Then what would they equal?...
They equal whatever they were at the time the procedure ended last..
Like you call a procedure one of the variables in it is set to like 5 and then it ends and you call the procedure again and instead of the variable starting as 0 it starts as 5 and messes shit up.
3Garrett3
06-09-2010, 09:31 PM
They equal whatever they were at the time the procedure ended last..
Like you call a procedure one of the variables in it is set to like 5 and then it ends and you call the procedure again and instead of the variable starting as 0 it starts as 5 and messes shit up.
That should probably be fixed inside of simba/scar then ;)
It is a problem with their interpreter..
I reported in the bugs tracker. Also I heard this isn't a problem in SCAR?
Powered by vBulletin® Version 4.2.1 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.