Official Soldat Forums
Server Talk => Scripting Discussions and Help => Topic started by: LORD KILLA on June 17, 2009, 08:14:38 am
-
hi all
i am having a problem with "[Error] (0:0): Variable Expected"
never had this before, someone knows what to do o.O ?
-
You missed placing somewhere a variable, its kinda obvious, but the "coordinates" are weird, as they indicate you missed something at the beginning.
Gief the script so we can see what is the problem.
-
heres the code:
const
SCRIPT_VERSION = '1.2.4.5.2b';
DATE_FORMAT = 'yyyy:mm:dd:hh:nn:ss:zzz';
MAX_SKILLS = 15;
M_EVERY = 8; // Money shown every 8 kills
MP_EVERY = 4; // Mana ...
E_EVERY = 5; // Exp ...
MK_DMG = 149;
KILLS_MAX = 100; // set this two to the same value, else: KABOOM!, nah just joking
MAX_KILLS = 100;
CLASS_MAX = 5;
CONSOLE_ = true;
CONSOLE_L = 3;
CONSOLE_R = 255;
CONSOLE_G = 255;
CONSOLE_B = 255;
NORMAL_ZOMBIES = 10; // how many bots are joining server when admin types /bots, or serevr starts up
BRUTAL_ZOMBIES = 4;
BLOODY_ZOMBIES = 0;
BURNING_ZOMBIES = 0;
BOSS_ZOMBIES = 0;
OMEGA_ZOMBIES = 1;
MAX_ZOMBIES = 15; // total zombies
{DO}MAX_EXP = 0.81; // MaxExp[ID]:= MaxExp[id] + Round ((MaxExp[id] * MAX_EXP) / MAX_EXP_DIV);
{NT}MAX_EXP_DIV = 1.51; // >>>>>>>> DONT MODIFY!!! <<<<<<
{ED}MAX_MANA = 0.22; // MaxMana[ID]:= MaxMana[id] + Round (MaxMana[id] * MAX_Mana);
{IT}MAX_DI = 0.8629827; // DI[id] := DI[id] + MAX_DI; // <- DAMAGE INCRASE "Result := Damage + Round(Damage * DI[Shooter] / 100);"
// 1600 more lines here <.<
-
>_<
Seems like you put somewhere usage of a variable, but didnt put the variable.
Gl with searching the missing variable.
-
So far the script is compiling for me. Weird.
-
ok, heres the full script, 1.3.1.1b (not yet completed)
it's from LK's zombie server
note: DO NOT MODIFY!!! or host it!!!
-
For god's sake your programming style is cruel. Get used to a for human more readable style.
Nevertheless, I pointed out a mistake:
function Aim(const X1,Y1,X2,Y2: single) : single;
begin
if (X2 - X1)<>0 then begin
if X1 > X2 then
result:= arctan((y2 - y1) / (x2 - x1)) + Pi
else
result:= arctan((y2 - y1) / (x2 - x1));
end
else begin
if Y2 > Y1 then result:= Pi/2 + Pi/4;
if Y2 < Y1 then result:= -Pi/2 + Pi/4;
end;
end;
You missed a semicolon in the fifth row above:
result:= arctan((y2 - y1) / (x2 - x1)) + Pi;
EDIT: This results into another comipilation error, therfore I cleaned up the func a bit:
function Aim(const X1,Y1,X2,Y2: single) : single;
begin
if (X2 - X1) <> 0 then begin
if X1 > X2 then
begin
result:= arctan((y2 - y1) / (x2 - x1)) + Pi;
end else
begin
result:= arctan((y2 - y1) / (x2 - x1));
end;
end else
begin
if Y2 > Y1 then result:= Pi/2 + Pi/4;
if Y2 < Y1 then result:= -Pi/2 + Pi/4;
end;
end;
Your "[Error] (0:0): Variable Expected" error still occurs, but I'm not keen on fixing your code with such an evil programming style.
Anyway, good luck in finding the bug(s).
-
He didn't miss semicolon.
function Aim(const X1,Y1,X2,Y2: single) : single;
begin
if (X2 - X1)<>0 then begin
if X1 > X2 then
result:= arctan((y2 - y1) / (x2 - x1)) + Pi
else
result:= arctan((y2 - y1) / (x2 - x1));
end
else begin
if Y2 > Y1 then result:= Pi/2 + Pi/4;
if Y2 < Y1 then result:= -Pi/2 + Pi/4;
end;
end;
this code is correct. It's even better because doesn't have such a number of useless begin-end rooms.
-
He didn't miss semicolon.
function Aim(const X1,Y1,X2,Y2: single) : single;
begin
if (X2 - X1)<>0 then begin
if X1 > X2 then
result:= arctan((y2 - y1) / (x2 - x1)) + Pi
else
result:= arctan((y2 - y1) / (x2 - x1));
end
else begin
if Y2 > Y1 then result:= Pi/2 + Pi/4;
if Y2 < Y1 then result:= -Pi/2 + Pi/4;
end;
end;
this code is correct. It's even better because doesn't have such a number of useless begin-end rooms.
Oh sorry, I take all my statements back except for his evil programming style :P
-
I suppose it's running on LK's Zombie server:
IP : 204.124.182.141
Port: 23073
-
Whenever I receive this error and don't know what I've recently modified (or if I modified different areas), what I do is comment out like half my code, try to compile it; and depending on the error, you know if you commented out the one error.
-
Whenever I receive this error and don't know what I've recently modified (or if I modified different areas), what I do is comment out like half my code, try to compile it; and depending on the error, you know if you commented out the one error.
damn boy...
your problem: INISAVE PARAMETERS ARE WRONG!
procedure iniSave(FileName: string; var iniFile: TINIFile);
inisave('Players/'+GetPlayerStat(ID,'Name')+'.ini','Players/'+GetPlayerStat(ID,'Name')+'.ini');
wasn't really that hard to debug - learn some debugging skills!
and also, i don't even know pascal (or soldatserver) that well. here's a hint: comment out code and see where the error comes from!
-
For god's sake your programming style is cruel. Get used to a for human more readable style.
Nevertheless, I pointed out a mistake:
function Aim(const X1,Y1,X2,Y2: single) : single;
begin
if (X2 - X1)<>0 then begin
if X1 > X2 then
result:= arctan((y2 - y1) / (x2 - x1)) + Pi
else
result:= arctan((y2 - y1) / (x2 - x1));
end
else begin
if Y2 > Y1 then result:= Pi/2 + Pi/4;
if Y2 < Y1 then result:= -Pi/2 + Pi/4;
end;
end;
You missed a semicolon in the fifth row above:
result:= arctan((y2 - y1) / (x2 - x1)) + Pi;
EDIT: This results into another comipilation error, therfore I cleaned up the func a bit:
function Aim(const X1,Y1,X2,Y2: single) : single;
begin
if (X2 - X1) <> 0 then begin
if X1 > X2 then
begin
result:= arctan((y2 - y1) / (x2 - x1)) + Pi;
end else
begin
result:= arctan((y2 - y1) / (x2 - x1));
end;
end else
begin
if Y2 > Y1 then result:= Pi/2 + Pi/4;
if Y2 < Y1 then result:= -Pi/2 + Pi/4;
end;
end;
Your "[Error] (0:0): Variable Expected" error still occurs, but I'm not keen on fixing your code with such an evil programming style.
Anyway, good luck in finding the bug(s).
For some reason the whole if/else block is like one command in pascal so you only need a semicolon at the very end, hence no semicolon at the end of the begin...end block you added.
LORD KILLA I'm going to suggest you do some programming that isn't soldat scripting. Your OnPlayerCommand function is horrible, terrible, kill-it-with-fire bad, and shows that you don't understand the very basics of programming. I recommend getting a good book, taking a class, or just screwing around with a compiler for a while. Here, I'll even give you a resource to guide you on your path (http://www.highercomputingforeveryone.com/).
But no, you're just going to ignore this and keep making pointless threads like this. Ah well, at least I tried.
-
He isn't playing soldat anymore, that's what he said.