viewing paste castle data swap | Athena

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
 
 
 
-   script  sample_castle_swap  -1,{
 
OnInit:
    bindatcmd "swapcastle",strnpcinfo(3)+"::OnAtcommand";
    end;
 
OnAtcommand:
    if ( .@atcmd_numparameters != 2 ) {
        dispbottom "Enter 2 caslte map.";
        dispbottom .@atcmd_command$+" <map1> <map2>";
    }
    else if ( getmapflag( .@atcmd_parameters$[0],mf_castle_gvg ) ) {
        dispbottom "Map : "+.@atcmd_parameters$[0]+" isnt a castle.";
    }
    else if ( getmapflag( .@atcmd_parameters$[1],mf_castle_gvg ) ) {
        dispbottom "Map : "+.@atcmd_parameters$[1]+" isnt a castle.";
    }
    else {
        callsub( OnSwap,.@atcmd_parameters$[0],.@atcmd_parameters$[1] );
    }
    end;
    
OnSwap:
    .@castle_1$ = getarg(0);
    .@castle_2$ = getarg(2);
    
    for ( .@i = 1; .@i <= 17; .@i++ ) {
        .@arg_1[.@i] = getcastledata( .@castle_1$,.@i );
        .@arg_2[.@i] = getcastledata( .@castle_2$,.@i );
        
        setcastledata( .@castle_1$,.@i,.@arg_2[.@i] );
        setcastledata( .@castle_2$,.@i,.@arg_1[.@i] );
    }
    dispbottom "Done swap to castle ( "+.@castle_1$+" <-> "+.@castle_2$+" ).";
    end;
}
}
Viewed 1215 times, submitted by Emistry.