Author Topic: "[Error] (0:0): Variable Expected" <- never seen, how do i fix it?  (Read 1295 times)

0 Members and 1 Guest are viewing this topic.

Offline LORD KILLA

  • Camper
  • ***
  • Posts: 254
  • Happie
hi all
i am having a problem with "[Error] (0:0): Variable Expected"
never had this before, someone knows what to do o.O ?

Offline croat1gamer

  • Veteran
  • *****
  • Posts: 1327
  • OMG CHANGING AVATAR!!! ^ω^
Re: "[Error] (0:0): Variable Expected" <- never seen, how do i fix it?
« Reply #1 on: June 17, 2009, 08:19:41 am »
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.
Last year, I dreamt I was pissing at a restroom, but I missed the urinal and my penis exploded.

Offline LORD KILLA

  • Camper
  • ***
  • Posts: 254
  • Happie
Re: "[Error] (0:0): Variable Expected" <- never seen, how do i fix it?
« Reply #2 on: June 17, 2009, 08:29:11 am »
heres the code:
Code: [Select]
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 <.<

Offline croat1gamer

  • Veteran
  • *****
  • Posts: 1327
  • OMG CHANGING AVATAR!!! ^ω^
Re: "[Error] (0:0): Variable Expected" <- never seen, how do i fix it?
« Reply #3 on: June 17, 2009, 08:32:01 am »
>_<
Seems like you put somewhere usage of a variable, but didnt put the variable.
Gl with searching the missing variable.
Last year, I dreamt I was pissing at a restroom, but I missed the urinal and my penis exploded.

Offline CurryWurst

  • Camper
  • ***
  • Posts: 265
    • Soldat Global Account System
Re: "[Error] (0:0): Variable Expected" <- never seen, how do i fix it?
« Reply #4 on: June 17, 2009, 08:35:16 am »
So far the script is compiling for me. Weird.
Soldat Global Account System: #soldat.sgas @ quakenet

Offline LORD KILLA

  • Camper
  • ***
  • Posts: 254
  • Happie
Re: "[Error] (0:0): Variable Expected" <- never seen, how do i fix it?
« Reply #5 on: June 17, 2009, 09:27:24 am »
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!!!

Offline CurryWurst

  • Camper
  • ***
  • Posts: 265
    • Soldat Global Account System
Re: "[Error] (0:0): Variable Expected" <- never seen, how do i fix it?
« Reply #6 on: June 17, 2009, 10:16:45 am »
For god's sake your programming style is cruel. Get used to a for human more readable style.
Nevertheless, I pointed out a mistake:

Code: [Select]
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:

Code: [Select]
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).
« Last Edit: June 17, 2009, 10:33:48 am by CurryWurst »
Soldat Global Account System: #soldat.sgas @ quakenet

Offline tk

  • Soldier
  • **
  • Posts: 235
Re: "[Error] (0:0): Variable Expected" <- never seen, how do i fix it?
« Reply #7 on: June 17, 2009, 10:37:06 am »
He didn't miss semicolon.
Code: [Select]
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.

Offline CurryWurst

  • Camper
  • ***
  • Posts: 265
    • Soldat Global Account System
Re: "[Error] (0:0): Variable Expected" <- never seen, how do i fix it?
« Reply #8 on: June 17, 2009, 11:01:20 am »
He didn't miss semicolon.
Code: [Select]
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
Soldat Global Account System: #soldat.sgas @ quakenet

Offline CurryWurst

  • Camper
  • ***
  • Posts: 265
    • Soldat Global Account System
Re: "[Error] (0:0): Variable Expected" <- never seen, how do i fix it?
« Reply #9 on: June 17, 2009, 11:33:47 am »
I suppose it's running on LK's Zombie server:

IP  : 204.124.182.141
Port: 23073
Soldat Global Account System: #soldat.sgas @ quakenet

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: "[Error] (0:0): Variable Expected" <- never seen, how do i fix it?
« Reply #10 on: June 17, 2009, 12:47:43 pm »
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.

Offline zyxstand

  • Veteran
  • *****
  • Posts: 1106
  • Mother of all Bombs
Re: "[Error] (0:0): Variable Expected" <- never seen, how do i fix it?
« Reply #11 on: July 09, 2010, 09:21:38 pm »
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!
Code: [Select]
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!
Can't think of anything original to put here...

Offline iDante

  • Veteran
  • *****
  • Posts: 1966
Re: "[Error] (0:0): Variable Expected" <- never seen, how do i fix it?
« Reply #12 on: July 10, 2010, 12:40:20 am »
For god's sake your programming style is cruel. Get used to a for human more readable style.
Nevertheless, I pointed out a mistake:

Code: [Select]
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:

Code: [Select]
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.

But no, you're just going to ignore this and keep making pointless threads like this. Ah well, at least I tried.

Offline Swompie

  • Camper
  • ***
  • Posts: 390
Re: "[Error] (0:0): Variable Expected" <- never seen, how do i fix it?
« Reply #13 on: July 10, 2010, 02:20:30 am »
He isn't playing soldat anymore, that's what he said.