Author Topic: HELP bug -> [Error] (202:2): 'BEGIN' expected  (Read 2476 times)

0 Members and 1 Guest are viewing this topic.

Offline dominikkk26

  • Camper
  • ***
  • Posts: 404
    • PMGsite
HELP bug -> [Error] (202:2): 'BEGIN' expected
« on: October 21, 2010, 12:21:28 pm »
I want to join the script but I have a problem, the following error!

-> [Error] (202:2): 'BEGIN' expected

Code: (pascal) [Select]
procedure AppOnIdle(Ticks: integer);
begin
for PlayersIteration := 1 to 32 do
begin
if PlayersPending[PlayersIteration] = 1 then
    begin
      BlowMe(PlayersIteration);
      dec(PlayersPending[PlayersIteration],1);
      Continue;
    end;
    if PlayersPending[PlayersIteration] > 1 then
    begin
      dec(PlayersPending[PlayersIteration],1);
      WriteConsole(PlayersIteration,'You have '+inttostr(PlayersPending[PlayersIteration])+' seconds of life out of hell left', TextColor);
    end;   
  end; 
end;
 //Ping Track
 if (TrackOrNot = true) then
      begin
      for i:=1 to 12 do
            begin
            if Track[i]=true then
                 begin
                  if TrackCount[i] = 0 then
                        begin
                        TrackPing[i] := TrackPing[i] + GetPlayerStat(i,'ping');
                        WriteConsole(0,'Track result for '+IDToName(i)+':',Color);
                        WriteConsole(0,'Max Ping:'+inttostr(TrackPingMax[i])+'  Avarage:'+inttostr(Round(TrackPing[i]/4)),Color);
                        // reset vars
                        TrackPingMax[i] := 0;
                        TrackPing[i] := 0;
                        Track[i] := false;
                        end
                  else if TrackCount[i] > 0 then
                        begin
                        TrackPing[i] := TrackPing[i] + GetPlayerStat(i,'ping');
                        if GetPlayerStat(i,'ping') > TrackPingMax[i] then TrackPingMax[i] := GetPlayerStat(i,'ping');
                        TrackCount[i] := TrackCount[i] - 1;
                        end;
                  end;
             end;
        end;
    end;

Offline Gizd

  • Flagrunner
  • ****
  • Posts: 586
  • (Re)tired
    • Eat-this! community site
Re: HELP bug -> [Error] (202:2): 'BEGIN' expected
« Reply #1 on: October 21, 2010, 12:48:57 pm »
1. Which line is it?
2. It means you have too many ends and not enough begins.

Offline dominikkk26

  • Camper
  • ***
  • Posts: 404
    • PMGsite
Re: HELP bug -> [Error] (202:2): 'BEGIN' expected
« Reply #2 on: October 21, 2010, 01:05:17 pm »
In the above, line 20

Offline Furai

  • Administrator
  • Veteran
  • *****
  • Posts: 1908
    • TransHuman Design
Re: HELP bug -> [Error] (202:2): 'BEGIN' expected
« Reply #3 on: October 21, 2010, 01:09:41 pm »
In line 17 delete end;

EDIT: Actually move it to the end of script.
« Last Edit: October 21, 2010, 01:12:21 pm by Wookash »
"My senses are so powerful that I can hear the blood pumping through your veins."

Offline dominikkk26

  • Camper
  • ***
  • Posts: 404
    • PMGsite
Re: HELP bug -> [Error] (202:2): 'BEGIN' expected
« Reply #4 on: October 22, 2010, 08:25:10 am »
-> [Error] (390:15): Unknown identifier 'PlayerCMD'
Hey now I have a problem the script has been shortened but the key was. The error is in line 56

Code: (pascal) [Select]
function OnCommand(ID: Byte; Text: string): boolean;
var
 Name: string;
 TheID: integer;
 who: byte;
begin
         if regExpMatch('^/(bronie|bron|bron|wepon|weapons|shot|broni|wep|weap|wepo|wepon|wepons|dowalki|dodatki|ons1|appendix|appendix1|append|appendi|apend|apendi|appen|apen)$',lowercase(Text)) then begin
                WriteConsole(ID,'Spawn Desert Eagles - /Desert Eagles',$EE00FFFF);
                WriteConsole(ID,'Spawn HK MP5 - /HK MP5',$EE00FFFF);
                WriteConsole(ID,'Spawn AK-74 - AK-74',$EE00FFFF);
                WriteConsole(ID,'Spawn Steyr AUG - Steyr AUG',$EE00FFFF);
                WriteConsole(ID,'Spawn Spas-12 - Spas-12',$EE00FFFF);
                WriteConsole(ID,'Spawn Ruger 77 - Ruger 77',$EE00FFFF);
                WriteConsole(ID,'Spawn M79 - M79',$EE00FFFF);
                WriteConsole(ID,'Spawn Barrett M82A1 - Barrett M82A1',$EE00FFFF);
                WriteConsole(ID,'Spawn FN Minimi - FN Minimi',$EE00FFFF);
                WriteConsole(ID,'Spawn USSOCOM - USSOCOM',$EE00FFFF);
                WriteConsole(ID,'Spawn Combat Knife - Combat Knife',$EE00FFFF);
                WriteConsole(ID,'Spawn M72 LAW - M72 LAW',$EE00FFFF);
                WriteConsole(ID,'Spawn M2 Stationary Gun - /stat569',$EE00FFFF);
        end;
        if regExpMatch('^/(bonuses|bonusy|bonus|ons2|onus|bon|bonu|appendix2|append2|appendi2|apend2|apendi2|appen2|apen2)$',lowercase(Text)) then begin
                WriteConsole(ID,'Spawn Medikit bonus - /bon1',$EE00FFFF);
                WriteConsole(ID,'Spawn Grenades bonus - /bon2',$EE00FFFF);
                WriteConsole(ID,'Spawn Flame God bonus - /bon3',$EE00FFFF);
                WriteConsole(ID,'Spawn Bulletproof Vest bonus - /bon4',$EE00FFFF);
                WriteConsole(ID,'Spawn Predator bonus - /bon5',$EE00FFFF);
                WriteConsole(ID,'Spawn Berserker bonus - /bon6',$EE00FFFF);
                WriteConsole(ID,'Spawn Cluster Grenades bonus - /bon7',$EE00FFFF);
        end;
        //Można dać koło kogoś broń oraz bonus
        if Copy(Text, 1, 4) = '/daj' then try
             TheID := StrToInt(GetPiece(Text, ' ', 1));
             SpawnObject(GetPlayerStat(TheID,'x'),GetPlayerStat(TheID,'y'),StrToInt(GetPiece(Text,' ',2)));
        except
           WriteConsole(TheID,'Nie udało się dac broni lub bonusu, prawdopodobnie złe ID',$FF474A);
           WriteConsole(TheID,'Could not give weapons or bonus, probably wrong ID',$FF474A);
        end;
        //Można zamienić komuś broń
        if regExpMatch('^/(zmien|zamien|zamien|zmien|changewep|change|replace|changeswep|changes)+',lowercase(Text)) then try
             TheID := StrToInt(GetPiece(Text, ' ', 1));
             WriteConsole(ID,'hhahah działa?',$FFF33DC);
             forceWeapon(TheID,StrToInt(GetPiece(Text,' ',2)),GetPlayerStat(TheID,'Primary'),0);
        except
          WriteConsole(ID,'Nie udało sie zamienic broni, prawdopodobnie złe ID',$FF474A);
          WriteConsole(ID,'Failed to replace the weapons, probably wrong ID',$FF474A);
        end;           
        if Text = '/stat569' then begin
                SpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y'),15);
                WriteConsole(ID,'You have been given the M2 Stationary Gun',$EE00FFFF);
        end;
        if regExpMatch('^/(medic|med|health|med pack|bon1|bon 1|bon-1)$',lowercase(Text)) then begin
                SpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y'),16);
                WriteConsole(ID,'You have been given the Medikit bonus',$EE00FFFF);
        end;
 //Bomb ID       
  if GetPiece(PlayerCMD, ' ', 0) = armCMD then
  begin
    //set timer to the number of seconds..
    if Length(PlayerCMD) <> Length(armCMD) then who := strtoint(GetPiece(PlayerCMD, ' ', 1)) else who := TheID;
    PlayersPending[who] := Seconds;
    //tell me how to abort
    WriteConsole(who,'You have '+inttostr(Seconds)+' seconds to live. Press '+disarmCMD+' to cancel.', TextColor);
  end;
 
  //ah f**k it. I'd rather live than be blown to bits. Wait, I'd like to be blown...
  if GetPiece(PlayerCMD, ' ', 0) = disarmCMD then
  begin
    //save me!
    if Length(PlayerCMD) <> Length(armCMD) then who := strtoint(GetPiece(PlayerCMD, ' ', 1)) else who := TheID;
    if PlayersPending[who] > 0 then
    begin
      //take away my countdown
      PlayersPending[who] := 0;
      //tell me
      WriteConsole(who,'Bomb disarmed.', TextColor);
    end;
  end;
end;

« Last Edit: October 22, 2010, 08:29:25 am by dominikkk26 »

Offline Gizd

  • Flagrunner
  • ****
  • Posts: 586
  • (Re)tired
    • Eat-this! community site
Re: HELP bug -> [Error] (202:2): 'BEGIN' expected
« Reply #5 on: October 23, 2010, 01:39:05 pm »
Did you have the idea to read the error or you just paste them here?

Offline Furai

  • Administrator
  • Veteran
  • *****
  • Posts: 1908
    • TransHuman Design
Re: HELP bug -> [Error] (202:2): 'BEGIN' expected
« Reply #6 on: October 24, 2010, 10:08:57 am »
Did you have the idea to read the error or you just paste them here?

I think he's only copying it here...

Define "PlayerCMD" somewhere.
EDIT: You copied part of other script below line 56 - that's why it isn't working. You're lacking vars...
When you define PlayerCMD, you'll get error like: "-> [Error] (390:15): Unknown identifier 'armCMD' "
And so on...
« Last Edit: October 24, 2010, 10:13:22 am by Wookash »
"My senses are so powerful that I can hear the blood pumping through your veins."

Offline dominikkk26

  • Camper
  • ***
  • Posts: 404
    • PMGsite
Re: HELP bug -> [Error] (202:2): 'BEGIN' expected
« Reply #7 on: October 24, 2010, 02:13:12 pm »
Attach download!

DarkCrusade

  • Guest
Re: HELP bug -> [Error] (202:2): 'BEGIN' expected
« Reply #8 on: October 24, 2010, 02:16:55 pm »
So please tell us what we should do with your code

Offline dominikkk26

  • Camper
  • ***
  • Posts: 404
    • PMGsite
Re: HELP bug -> [Error] (202:2): 'BEGIN' expected
« Reply #9 on: October 25, 2010, 08:33:24 am »
To run the error is in the section //BOMB

Offline Furai

  • Administrator
  • Veteran
  • *****
  • Posts: 1908
    • TransHuman Design
Re: HELP bug -> [Error] (202:2): 'BEGIN' expected
« Reply #10 on: October 25, 2010, 09:42:08 am »
You had whole day to do "debugging"...and you still ask for help to fix that bug for you? It's really easy to fix that. Anyway, look for the original script from which you've ripped off that //BOMB part and look at variables/constants list. Copy what you need to your variables/constants declaration and ... *tadaaaaaa* everything should work just fine.
"My senses are so powerful that I can hear the blood pumping through your veins."

Offline dominikkk26

  • Camper
  • ***
  • Posts: 404
    • PMGsite
Re: HELP bug -> [Error] (202:2): 'BEGIN' expected
« Reply #11 on: October 25, 2010, 12:10:27 pm »
# function OnCommand(ID: Byte; Text: string): boolean; 
# var 
# Name: string; 
# TheID: integer; 
# who: byte; 
# PlayerCMD: integer;
# begin

...

  if Text = armCMD then
  begin
    //set timer to the number of seconds..
    if Length(PlayerCMD) <> Length(armCMD) then who := strtoint(GetPiece(PlayerCMD, ' ', 1)) else who := TheID;
    PlayersPending[who] := Seconds;
    //tell me how to abort
    WriteConsole(who,'You have '+inttostr(Seconds)+' seconds to live. Press '+disarmCMD+' to cancel.', TextColor);
  end;
 
  //ah f**k it. I'd rather live than be blown to bits. Wait, I'd like to be blown...
  if Text = disarmCMD then
  begin
    //save me!
    if Length(PlayerCMD) <> Length(armCMD) then who := strtoint(GetPiece(PlayerCMD, ' ', 1)) else who := TheID;
    if PlayersPending[who] > 0 then
    begin
      //take away my countdown
      PlayersPending[who] := 0;
      //tell me
      WriteConsole(who,'Bomb disarmed.', TextColor);
    end;
  end;
end;

DarkCrusade

  • Guest
Re: HELP bug -> [Error] (202:2): 'BEGIN' expected
« Reply #12 on: October 25, 2010, 01:09:12 pm »
Nice that you explained what the problem is. Thanks, really. This will help us help you

Offline Furai

  • Administrator
  • Veteran
  • *****
  • Posts: 1908
    • TransHuman Design
Re: HELP bug -> [Error] (202:2): 'BEGIN' expected
« Reply #13 on: October 25, 2010, 01:41:25 pm »
How string could be an integer? I'm just too lazy to fix that script for you. You've made before some scripts and I thought that you are able to script already but it seems I was wrong...maybe I'll see to it...
"My senses are so powerful that I can hear the blood pumping through your veins."