Jump to content
  • 0
Sign in to follow this  
Helena

Can't find donpcevent label.

Question

Hi Hercules! It's been a while. 

 

I am using this script and it's giving me headaches, I can't get this one part working. It's a Capture the Flag event, and at the end of the event (when 5 points are made by a team), it is suppose to go to an donpcevent label, but my mapserver keeps saying it cant find it ("CTF::OnEventGameOverClassic").

 

This is the part of the code that errors, the rest of the script works perfectly fine so I will not include it; it's a huge script.

 

Help is greatly appreciated :)

 

 

bat_c01,149,52,5	script	Red Base::red_base	1026,{ getmapxy($@redbase$,$@redbasex,$@redbasey,1);getmapxy($@rbasetouch$,$@rbasetouchx,$@rbasetouchy,0); if (distance($@redbasex,$@redbasey,$@rbasetouchx,$@rbasetouchy) <= 2){ If (@team == 2) {	if ($@flagcarrier$ == strcharinfo(0))	{	movenpc "neutral_flag2",65,116;	set $@nredpt, $@nredpt + 1;	set #fcapt, #fcapt + 1;	set fcapt, fcapt + 1;	set ctfpt, ctfpt + 10;	set tctfpt, tctfpt + 10;	announce "The Blue Team has "+$@nbluept+" points.",bc_map;	announce "The Red Team has "+$@nredpt+" points.",bc_map;	set $@flaggone, 0;	set $@flagcarrier$, "-";		 if ($@nredpt >= 5)		{		mapannounce "bat_c01", "The Red Team has won the match",0;		set $@nbluept, 0;		set $@nredpt, 0;		set $@nblueqt, 0;		set $@nredqt, 0;		set $@flagcarrier$, "-";		set $@nredwin, 1;		donpcevent "CTF::OnEventGameOverClassic";	}}	if ($@reddropped == 1)	 {	 //Return the Flag	movenpc "neutral_flag",134,65;	set $@redgone, 0;	 set $@reddropped, 0;	set #freturn, #freturn + 1;	set freturn, freturn + 1;	announce "The Red Flag has been returned.",bc_map; }}}} bat_c01,50,131,4	script	Blue Base::blue_base	1188,{ getmapxy($@bluebase$,$@bluebasex,$@bluebasey,1);getmapxy($@bbasetouch$,$@bbasetouchx,$@bbasetouchy,0); if (distance($@bluebasex,$@bluebasey,$@bbasetouchx,$@bbasetouchy) <= 2){ If (@team == 1) {	if ($@flagcarrier$ == strcharinfo(0))	{	movenpc "neutral_flag",134,67;	set $@nbluept, $@nbluept + 1;	set #fcapt, #fcapt + 1;	set fcapt, fcapt + 1;	set ctfpt, ctfpt + 10;	set tctfpt, tctfpt + 10;	announce "The Blue Team has "+$@nbluept+" points.",bc_map;	announce "The Red Team has "+$@nredpt+" points.",bc_map;	set $@flaggone, 0;	set $@flagcarrier$, "-";		if ($@nbluept >= 5)		{		mapannounce "bat_c01", "The Blue Team has won the match",0;		set $@nbluept, 0;		set $@nredpt, 0;		set $@nblueqt, 0;		set $@nredqt, 0;		set $@flagcarrier$, "-";		set $@nbluewin, 1;		donpcevent "CTF::OnEventGameOverClassic";	}	}	if ($@bluedropped == 1)	 {	 //Return the Flag //	movenpc "blue_flag",65,116;	set $@bluegone, 0;	set $@bluedropped, 0;	set #freturn, #freturn + 1;	set freturn, freturn + 1;	announce "The Blue Flag has been returned.",bc_map;	 }}}}  OnEventGameOverClassic:set .@classqt, getarraysize($@classic);set .@cctf, 0; over:if (.@cctf < .@classqt){	{	attachrid $@classic[.@cctf];	if (@classic == 1)		{		if (@team == 2)			{			 if ($@redwin == 1)				{				set #win, #win + 1;				set win, win + 1;				}			 if ($@bluewin == 1)				{				set #lose, #lose + 1;				set lose, lose + 1;				}			}		 if (@team == 1)			{			 if ($@redwin == 1)				{				set #lose, #lose + 1;				set lose, lose + 1;				}			 if ($@bluewin == 1)				{				set #win, #win + 1;				set win, win + 1;				}			}		}	 save originmap$, (originx), (originy);	mapwarp "prt_are01","prontera",156,182;	callfunc("setlook2", 6, hair);	callfunc("setlook2", 7, body);	set Hp, charhp;	set Sp, charsp;	set @playing, 0;	set @classic, 0;	set @heal, 0;	detachrid;	set .@cctf, .@cctf + 1;	goto over;	}}for (set .@i, 0; .@i < getarraysize($@classic); set .@i, .@i+1) {	setarray $@classic[.@i], 0;}end;} 

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

If you test the file on your server's parser, or other online checkers such as Haru's (and fix the header tabs), you'll see the following output:

 

 

[Warning]: script error in file '(DIRECT INPUT)' line 10 column 1     parse_syntax: use of deprecated keyword (use 'if' instead).      7: if (distance($@redbasex,$@redbasey,$@rbasetouchx,$@rbasetouchy) <= 2)      8: {      9: *   10: If (@team == 2)         ^     11: {     12:     if ($@flagcarrier$ == strcharinfo(0))     13:     { [Error]: script error in file '(DIRECT INPUT)' line 10 column 1     parse_line: expect command, missing function name or calling undeclared function      7: if (distance($@redbasex,$@redbasey,$@rbasetouchx,$@rbasetouchy) <= 2)      8: {      9: *   10: If (@team == 2)         ^     11: {     12:     if ($@flagcarrier$ == strcharinfo(0))     13:     { [Warning]: script error in file '(DIRECT INPUT)' line 59 column 1     parse_syntax: use of deprecated keyword (use 'if' instead).     56: if (distance($@bluebasex,$@bluebasey,$@bbasetouchx,$@bbasetouchy) <= 2)     57: {     58: *   59: If (@team == 1)         ^     60: {     61:     if ($@flagcarrier$ == strcharinfo(0))     62:     { [Error]: script error in file '(DIRECT INPUT)' line 59 column 1     parse_line: expect command, missing function name or calling undeclared function     56: if (distance($@bluebasex,$@bluebasey,$@bbasetouchx,$@bbasetouchy) <= 2)     57: {     58: *   59: If (@team == 1)         ^     60: {     61:     if ($@flagcarrier$ == strcharinfo(0))     62:     { [Error]: npc_parsesrcfile: Unknown syntax in file '(DIRECT INPUT)', line '100'. Stopping...  * w1=OnEventGameOverClassic:  * w2=  * w3=  * w4= 

 

 

The event label problem is because it's outside of a script, and last closing curly brace seems so lonely without its respective opening one. Maybe you're missing a script header out there?

 

Try adding a NPC header before the OnEventGameOverClassic label, such as:

-	script	CTF	-1,{

 

If you fix the if cases and add the NPC header, it works. Try the following code:

bat_c01,149,52,5	script	Red Base::red_base	1026,{ getmapxy($@redbase$,$@redbasex,$@redbasey,1);getmapxy($@rbasetouch$,$@rbasetouchx,$@rbasetouchy,0); if (distance($@redbasex,$@redbasey,$@rbasetouchx,$@rbasetouchy) <= 2){ if (@team == 2) {    if ($@flagcarrier$ == strcharinfo(0))    {    movenpc "neutral_flag2",65,116;    set $@nredpt, $@nredpt + 1;    set #fcapt, #fcapt + 1;    set fcapt, fcapt + 1;    set ctfpt, ctfpt + 10;    set tctfpt, tctfpt + 10;    announce "The Blue Team has "+$@nbluept+" points.",bc_map;    announce "The Red Team has "+$@nredpt+" points.",bc_map;    set $@flaggone, 0;    set $@flagcarrier$, "-";         if ($@nredpt >= 5)        {        mapannounce "bat_c01", "The Red Team has won the match",0;        set $@nbluept, 0;        set $@nredpt, 0;        set $@nblueqt, 0;        set $@nredqt, 0;        set $@flagcarrier$, "-";        set $@nredwin, 1;        donpcevent "CTF::OnEventGameOverClassic";    }}    if ($@reddropped == 1)     {     //Return the Flag    movenpc "neutral_flag",134,65;    set $@redgone, 0;     set $@reddropped, 0;    set #freturn, #freturn + 1;    set freturn, freturn + 1;    announce "The Red Flag has been returned.",bc_map; }}}} bat_c01,50,131,4	script	Blue Base::blue_base	1188,{ getmapxy($@bluebase$,$@bluebasex,$@bluebasey,1);getmapxy($@bbasetouch$,$@bbasetouchx,$@bbasetouchy,0); if (distance($@bluebasex,$@bluebasey,$@bbasetouchx,$@bbasetouchy) <= 2){ if (@team == 1) {    if ($@flagcarrier$ == strcharinfo(0))    {    movenpc "neutral_flag",134,67;    set $@nbluept, $@nbluept + 1;    set #fcapt, #fcapt + 1;    set fcapt, fcapt + 1;    set ctfpt, ctfpt + 10;    set tctfpt, tctfpt + 10;    announce "The Blue Team has "+$@nbluept+" points.",bc_map;    announce "The Red Team has "+$@nredpt+" points.",bc_map;    set $@flaggone, 0;    set $@flagcarrier$, "-";        if ($@nbluept >= 5)        {        mapannounce "bat_c01", "The Blue Team has won the match",0;        set $@nbluept, 0;        set $@nredpt, 0;        set $@nblueqt, 0;        set $@nredqt, 0;        set $@flagcarrier$, "-";        set $@nbluewin, 1;        donpcevent "CTF::OnEventGameOverClassic";    }    }    if ($@bluedropped == 1)     {     //Return the Flag //    movenpc "blue_flag",65,116;    set $@bluegone, 0;    set $@bluedropped, 0;    set #freturn, #freturn + 1;    set freturn, freturn + 1;    announce "The Blue Flag has been returned.",bc_map;     }}}} -	script	CTF	-1,{OnEventGameOverClassic:set .@classqt, getarraysize($@classic);set .@cctf, 0; over:if (.@cctf < .@classqt){    {    attachrid $@classic[.@cctf];    if (@classic == 1)        {        if (@team == 2)            {             if ($@redwin == 1)                {                set #win, #win + 1;                set win, win + 1;                }             if ($@bluewin == 1)                {                set #lose, #lose + 1;                set lose, lose + 1;                }            }         if (@team == 1)            {             if ($@redwin == 1)                {                set #lose, #lose + 1;                set lose, lose + 1;                }             if ($@bluewin == 1)                {                set #win, #win + 1;                set win, win + 1;                }            }        }     save originmap$, (originx), (originy);    mapwarp "prt_are01","prontera",156,182;    callfunc("setlook2", 6, hair);    callfunc("setlook2", 7, body);    set Hp, charhp;    set Sp, charsp;    set @playing, 0;    set @classic, 0;    set @heal, 0;    detachrid;    set .@cctf, .@cctf + 1;    goto over;    }}for (set .@i, 0; .@i < getarraysize($@classic); set .@i, .@i+1) {    setarray $@classic[.@i], 0;}end;}

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.