Jump to content
  • 0

N>Help on this Script Error


caspa

Question


  • Group:  Members
  • Topic Count:  194
  • Topics Per Day:  0.04
  • Content Count:  499
  • Reputation:   3
  • Joined:  03/11/12
  • Last Seen:  

 - script bg_emp#control -1,{
OnInit:
setarray .rewarditem, 673, 5; // reward to the winning team
set .winningscore, 2; // final score to win
set .eventlasting, 1200; // abort the system if there's no progress, 1200 seconds = 20 mins
sleep 1;
disablenpc .rednpcname$;
disablenpc .bluenpcname$;
end;
OnStart:
if ( getwaitingroomstate( 0, .rednpcname$ ) < .minplayer2start || getwaitingroomstate( 0, .bluenpcname$ ) < .minplayer2start ) end;
set .red, waitingroom2bg( "bat_a01", 171,346, strnpcinfo(0)+"::OnRedQuit", strnpcinfo(0)+"::OnRedDead", .rednpcname$ );
copyarray .team1aid, $@arenamembers, $@arenamembersnum;
set .blue, waitingroom2bg( "bat_a01", 162,50, strnpcinfo(0)+"::OnBlueQuit", strnpcinfo(0)+"::OnBlueDead", .bluenpcname$ );
copyarray .team2aid, $@arenamembers, $@arenamembersnum;
delwaitingroom .rednpcname$;
delwaitingroom .bluenpcname$;
disablenpc .rednpcname$;
disablenpc .bluenpcname$;
bg_warp .red, "bat_a01", 171,346;
bg_warp .blue, "bat_a01", 162,50;
setwall "bat_a01", 154,51, 6, 4, 0, "bg_emp_town_blue";
setwall "bat_a01", 164,347, 6, 4, 0, "bg_emp_town_red";
bg_updatescore "bat_a01", 0, 0;
sleep 6000; if ( .inprogress == 0 ) goto L_Abort;
mapannounce "bat_a01", "Rules are simple. The first one to break the opponent's emperium will get a score.", 0;
sleep 3000; if ( .inprogress == 0 ) goto L_Abort;
mapannounce "bat_a01", "Score "+ .winningscore +" rounds to win ! ... GET READY", 0;
sleep 2000; if ( .inprogress == 0 ) goto L_Abort;
while (1) {
for ( .@i = 5; .@i > 0; .@i-- ) {
mapannounce "bat_a01", .@i +"", 0;
sleep 1000; if ( .inprogress == 0 ) goto L_Abort;
}
if ( .score[1] == .winningscore -1 && .score[2] == .winningscore -1 )
mapannounce "bat_a01", "Final Round start!", 0;
else
mapannounce "bat_a01", "Round "+ .round++ +" start!", 0;
bg_monster .red,"bat_a01",171,346, "--ja--",1915, strnpcinfo(3)+"::OnRedDown";
bg_monster .blue,"bat_a01",162,50, "--ja--",1914, strnpcinfo(3)+"::OnBlueDown";
delwall "bg_emp_town_red";
delwall "bg_emp_town_blue";
sleep .eventlasting * 1000; if ( .inprogress == 0 ) goto L_Abort;
.score[ .winside ]++;
bg_updatescore "bat_a01", .score[1], .score[2];
killmonster "bat_a01", strnpcinfo(3)+"::OnRedDown";
killmonster "bat_a01", strnpcinfo(3)+"::OnBlueDown";
if ( .winside )
mapannounce "bat_a01", .empkiller$ +" has Destroy "+( ( .winside == 1 )?"Blue":"Red" )+"'s side Emperium. "+( ( .winside == 1 )?"Red":"Blue" )+" team score a point !", 0;
if ( .score[1] == .winningscore || .score[2] == .winningscore || !.winside ) break;
sleep 5000; if ( .inprogress == 0 ) goto L_Abort;
bg_warp .red, "bat_a01", 171,346;
bg_warp .blue, "bat_a01", 162,50;
setwall "bat_a01", 154,51, 6, 4, 0, "bg_emp_town_blue";
setwall "bat_a01", 164,347, 6, 4, 0, "bg_emp_town_red";
.winside = 0;
}
if ( .winside ) {
mapannounce "bat_a01", ( ( .winside == 1 )?"Red":"Blue" )+" side wins !", 0;
.@size = getarraysize( getd(".team"+ .winside +"aid") );
for ( .@i = 0; .@i < .@size; .@i++ )
getitem .rewarditem[0], .rewarditem[1], getd(".team"+ .winside +"aid["+ .@i +"]" );
} else
mapannounce "bat_a01", "Time Out. Aborting the match.", 0;
sleep 5000;
L_Abort:
bg_warp .red, "prontera", 155,182;
bg_warp .blue, "prontera", 158,182;
bg_destroy .red;
bg_destroy .blue;
delwall "bg_emp_town_red";
delwall "bg_emp_town_blue";
.round = .winside = .score[0] = .score[1] = .inprogress = 0;
end;
OnRedDown: callsub L_EmpDown, 2;
OnBlueDown: callsub L_EmpDown, 1;
L_EmpDown:
.empkiller$ = strcharinfo(0);
.winside = getarg(0);
awake strnpcinfo(3);
OnRedDead:
OnBlueDead:
end;
}

prontera,156,186,5 script gm_start 100,{
if ( getgmlevel() < 99 ) {
mes "I only talk to gm";
close;
}
if ( getvariableofnpc( .inprogress, "bg_emp#control" ) ) {
mes "abort ?";
next;
if ( select ( "Yes", "No" ) == 2 ) close;
awake "bg_emp#control";
killmonster "bat_a01", strnpcinfo(3)+"::OnRedDown";
killmonster "bat_a01", strnpcinfo(3)+"::OnBlueDown";
delwaitingroom getvariableofnpc( .rednpcname$, "bg_emp#control" );
delwaitingroom getvariableofnpc( .bluenpcname$, "bg_emp#control" );
disablenpc getvariableofnpc( .rednpcname$, "bg_emp#control" );
disablenpc getvariableofnpc( .bluenpcname$, "bg_emp#control" );
announce strcharinfo(0) +" has abort the battleground", 0;
close;
}
mes "select how many players to start";
next;
input .@a;
if ( .@a == 0 || .@a > 30 ) close;
set getvariableofnpc( .minplayer2start, "bg_emp#control" ), .@a;
announce strcharinfo(0) +" has hosted "+ .@a +"vs"+ .@a +" battleground", 0;
enablenpc getvariableofnpc( .rednpcname$, "bg_emp#control" );
enablenpc getvariableofnpc( .bluenpcname$, "bg_emp#control" );
donpcevent getvariableofnpc( .rednpcname$, "bg_emp#control" ) +"::OnStart";
donpcevent getvariableofnpc( .bluenpcname$, "bg_emp#control" ) +"::OnStart";
set getvariableofnpc( .inprogress, "bg_emp#control" ), 1;
close;
}

prontera,155,182,5 script Red side#bg_emp 100,{
end;
OnStart:
waitingroom "Red side", getvariableofnpc( .minplayer2start, "bg_emp#control" ) +1, "bg_emp#control::OnStart", getvariableofnpc( .minplayer2start, "bg_emp#control" );
end;
OnInit:
set getvariableofnpc( .rednpcname$, "bg_emp#control" ), strnpcinfo(0);
end;
}

prontera,158,182,5 script Blue side#bg_emp 100,{
end;
OnStart:
waitingroom "Blue side", getvariableofnpc( .minplayer2start, "bg_emp#control" ) +1, "bg_emp#control::OnStart", getvariableofnpc( .minplayer2start, "bg_emp#control" );
end;
OnInit:
set getvariableofnpc( .bluenpcname$, "bg_emp#control" ), strnpcinfo(0);
end;
}

bat_a01 mapflag battleground 2
bat_a01 mapflag nosave SavePoint
bat_a01 mapflag nowarp
bat_a01 mapflag nowarpto
bat_a01 mapflag noteleport
bat_a01 mapflag nomemo
bat_a01 mapflag nopenalty
bat_a01 mapflag nobranch
bat_a01 mapflag noicewall 

-Also, I'm using 3ceAm

post-3034-0-55778600-1351463501_thumb.jpg

Edited by caspa
Link to comment
Share on other sites

19 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1130
  • Joined:  05/27/12
  • Last Seen:  

3CeAM doesn't support direct variable assignment, so use the 'set' command instead (or switch to rAthena).

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  194
  • Topics Per Day:  0.04
  • Content Count:  499
  • Reputation:   3
  • Joined:  03/11/12
  • Last Seen:  

Is it possible for me to ask you sir Euphy to fix the script into 3ceAm File?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1130
  • Joined:  05/27/12
  • Last Seen:  

use the 'set' command

for(set .@i,5; .@i>0; set .@i,.@i-1)

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  205
  • Reputation:   19
  • Joined:  10/12/12
  • Last Seen:  

EDIT: ups! XD

Commands like var++; will not work. You have to use the full version: var = var + 1;

Plus, as people says, 3CeAM doesn't support direct variable settings, so set command is actually needed.

set .@a, <value>;
for( set .@i, 0; .@i < 10; set .@i, .@i + 1 ) //Just sample values.
set .@a, .@a + 1;

Edited by Ryokem
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

I was the one who wrote that script

http://rathena.org/b...ng/#entry148440

Actually, eAthena is not C++.

Commands like var++; will not work. You have to use the full version: var = var + 1;

I understand if you say var++ doesn't work, but has to use set var, var +1;

but why you say var = var + 1; ?

prontera,152,191,5    script    woe    100,{
   while ( .@i < 5 )
       mes "Counting "+ .@i++;
   close;
}

it works you know

post-8685-0-32575200-1351513876_thumb.jpg

or have you messed up this rathena forum and eathena forum ? /hmm

I'm not going to adjust my script to compatible with other emulator

after all this is rathena forum

Edited by AnnieRuru
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  194
  • Topics Per Day:  0.04
  • Content Count:  499
  • Reputation:   3
  • Joined:  03/11/12
  • Last Seen:  

@ annie : ms. annie can you make this script usable into eathena SVN files or the 3ceAm SVN files plsssssss..........

===========================================================================================

Coz this is what i'll use for the GOTM =D

Edited by caspa
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  205
  • Reputation:   19
  • Joined:  10/12/12
  • Last Seen:  

I understand if you say var++ doesn't work, but has to use set var, var +1;

but why you say var = var + 1; ?

Was speaking about 3CeaM as he said he was using it.

prontera,152,191,5	script	woe	100,{
while ( .@i < 5 )
	mes "Counting "+ .@i++;
close;
}

it works you know

Does it? .@i is supposed to be 0 and .@i++ is supposed to do the following:

1. execute the command in which it is called.

2. Increase the variable .@i by 1.

So where's the "0"? The code you wrote would be recognized as (++.@i) from all imperial programming languages, unless the variable starts from 1.

Actually, the output should be "0 1 2 3 4".

or have you messed up this rathena forum and eathena forum ? /hmm

Sure it can be xD I always have both opened xD

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

I'm don't have any programming background so I don't know anything about those .... blah blah language

I just write that simple script out, and the screenshot tells me it gives me 1,2,3,4,5 :blink:

that's all I know, and that's how I learned rathena scripting LMAO

from what I understand, .@i++ also means ( set .@i, .@i +1 )

prontera,152,191,5	script	woe	100,{
while ( .@i < 5 )
	mes "Counting "+ .@i++;
close;
}

prontera,154,191,5	script	woe2	100,{
while ( .@i < 5 )
	mes "Counting "+ set( .@i, .@i +1 );
close;
}

prontera,156,191,5	script	woe3	100,{
while ( .@i < 5 ) {
	set .@i, .@i +1;
	mes "Counting "+ .@i;
}
close;
}

tested these 3 npcs gives me the same dialog

if you think this is wrong ... then its rathena script engine error ?

I dunno ... as I never learn any other programming language

I learn scripting from what my test server told me, not from what others told me

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  194
  • Topics Per Day:  0.04
  • Content Count:  499
  • Reputation:   3
  • Joined:  03/11/12
  • Last Seen:  

hahahahahahaha.................. this topic has become who know's the code more rather than fixing the script =D .................... BOOM!!

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  379
  • Reputation:   304
  • Joined:  11/10/11
  • Last Seen:  

hahahahahahaha.................. this topic has become who know's the code more rather than fixing the script =D .................... BOOM!!

You already have the answer to fix your script :)
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1130
  • Joined:  05/27/12
  • Last Seen:  

hahahahahahaha.................. this topic has become who know's the code more rather than fixing the script =D .................... BOOM!!

#5

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  194
  • Topics Per Day:  0.04
  • Content Count:  499
  • Reputation:   3
  • Joined:  03/11/12
  • Last Seen:  

my next error encounter

post-3034-0-96712000-1351525516_thumb.jpg

post-3034-0-67490700-1351525523_thumb.jpg

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1130
  • Joined:  05/27/12
  • Last Seen:  

my next error encounter

Are you reading anything being posted in this topic? >.>

var = x    -->    set var,x;
var++    -->    set var,var+1
var--    -->    set var,var-1

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  379
  • Reputation:   304
  • Joined:  11/10/11
  • Last Seen:  

Well:

.@var++; // (set(.@var, .@var+1 )-1);
.@var--; // (set(.@var, .@var-1 )+1);
++.@var; // set(.@var, .@var+1);
--.@var; // set(.@var, .@var-1);
.@var = x;// set .@var, x;
// etc.

Euphy: What the hell, Euphy faster and use "x" like me °°', scary !

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  194
  • Topics Per Day:  0.04
  • Content Count:  499
  • Reputation:   3
  • Joined:  03/11/12
  • Last Seen:  

so i should put || set .score, [.winside]+1; || is this correct?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  379
  • Reputation:   304
  • Joined:  11/10/11
  • Last Seen:  

so i should put || set .score, [.winside]+1; || is this correct?

set .score[.winside], .score[.winside]+1;

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  194
  • Topics Per Day:  0.04
  • Content Count:  499
  • Reputation:   3
  • Joined:  03/11/12
  • Last Seen:  

plss give me the conversion codes for the errors and the for set code on image number 2..... coz im a stupid person who cant understand even a simple variable changes............... thx in advanced

post-3034-0-54539300-1351530823_thumb.jpg

post-3034-0-05581700-1351530825_thumb.jpg

Edited by caspa
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  205
  • Reputation:   19
  • Joined:  10/12/12
  • Last Seen:  

if you think this is wrong ... then its rathena script engine error ?

I dunno ... as I never learn any other programming language

Nah, I just said rAthena is not C++ or other languages, that's all ^^ Just to let him know that not everything about the other programming languages is correct also on rAthena and viceversa. :P

plss give me the conversion codes for the errors and the for set code on image number 2..... coz im a stupid person who cant understand even a simple variable changes............... thx in advanced

The errors you are showing up are basically all the same.

You can't change the value of a variable by a direct set if using 3CeaM unless you did implement it by yourself.

So:

<variable> = <value>; //This is not allowed in 3CeaM
set <variable>, <value>; //This has the same meaning of the command above, but works in 3CeaM

Same with your error:

set .@size, getarraysize([...]);

Also, line 61 (for cicle) presents the same error

for( set .@i, 0; .@ i < .@size; set .@i, .@i + 1 )

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...