Jump to content
  • 0

[Error]: script:op_2: invalid data for operator C_EQ


eloscar23

Question


  • Group:  Members
  • Topic Count:  24
  • Topics Per Day:  0.06
  • Content Count:  49
  • Reputation:   0
  • Joined:  02/21/23
  • Last Seen:  

Hello, I need help with this script, I can not figure it out

[Error]: script:op_2: invalid data for operator C_EQ
[Debug]: Data: number value=0
[Debug]: Data: string value="qwqwqwq"
[Debug]: Source (NPC): muertesmvp (invisible/not on a map)
[Debug]: Source (NPC): muertesmvp is located in: npc/custom/ranking.txt

prontera,155,155,6    script    Ranking    119,{
    set .@rango1, "";
    set .@muertes1, "0";
    set .@rango2, "";
    set .@muertes2, "0";

    mes "Que te gustaria hacer?";
    switch(select("CheckTop:Leave")){
    case 1:
    mes "El rango 1 es "+$rango1$+" con "+$muertes1+" realizadas.";
    mes "El rango 2 es "+$rango2$+" con "+$muertes2+" realizadas.";
    close;
    break;

    case 2:
    mes "pasa buen dia";
    close;

    } //end if
    end;
}


    -    script    muertesmvp    -1,{
    OnNPCKillEvent:
    if(killedrid == 1002){
        set matado, matado + 1;
        dispbottom "Recordatorio "+strcharinfo(0)+" obtenido MvP.";
        callfunc ("rangos",matado,strcharinfo(0));
    }
end;
}

function    script    rangos    {
set @muertes, getarg(0);
set @nombre$, getarg(1);

    if(@muertes > .@muertes1 ){
        if(.@nombre == strcharinfo(0)){
        //si soy el numero 1, solo cuento
            set .@rango1, @nombre$;
            set .@muertes1, @muertes;    

        } else {
        //guardo el anterior 1
            set .@auxn1, .@rango1;
            set .@auxm1, .@muertes1;

        // me vuelvo el 1
            set .@rango1, @nombre$;
            set .@muertes1, @muertes;

        //volvemos el 1 el 2
            set .@auxn1, .@rango2;
            set .@auxm2, .@muertes2;


        } //end iff de rango 1


    } else if(.@muertes > .@muertes2){
        if(.@nombre == strcharinfo(0)){
        set .@rango2, @nombre$;
        set .@muertes2, @muertes;
        } else {
            set .@muertes2, @muertes;
            set .@rango2, @nombre$;
        } // termina el de adentro end 2

    } // end if del if else

}

Edited by eloscar23
Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  232
  • Reputation:   86
  • Joined:  06/30/18
  • Last Seen:  

.@nombre == strcharinfo(0)

You compare a numeric variable with a string.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  24
  • Topics Per Day:  0.06
  • Content Count:  49
  • Reputation:   0
  • Joined:  02/21/23
  • Last Seen:  

3 hours ago, Winterfox said:
.@nombre == strcharinfo(0)

You compare a numeric variable with a string.

what about now? still same issue 

prontera,146,161,5    script    CheckRank    118,{
        
        set.npcranker,"[MvP Ranker]";

        mes.npcranker;        
        mes "Hello, this is an Npc Ranker";
        mes "Would you like to know the MvP Ranking?";
        next;
        switch(select("Top 20:Leave")){

        case 1:
            mes.npcranker;
            mes "The Top 1: " +$top1mvp$ +" Killed: " +$top1mvp +".";
            mes "The Top 2: " +$top2mvp$ +" Killed: " +$top2mvp +".";
            mes "The Top 3: " +$top3mvp$ +" Killed: " +$top3mvp +".";
            mes "The Top 4: " +$top4mvp$ +" Killed: " +$top4mvp +".";    
            mes "The Top 5: " +$top5mvp$ +" Killed: " +$top5mvp +".";
            mes "The Top 6: " +$top6mvp$ +" Killed: " +$top6mvp +".";
            mes "The Top 7: " +$top7mvp$ +" Killed: " +$top7mvp +".";
            mes "The Top 8: " +$top8mvp$ +" Killed: " +$top8mvp +".";
            mes "The Top 9: " +$top9mvp$ +" Killed: " +$top9mvp +".";
            mes "The Top 10: " +$top10mvp$ +" Killed: " +$top10mvp +" .";
            close;
            break;

            case 2:

            mes.npcranker;
            mes "bye";
            close;
        }


}


-    script    npcmvpranker    -1,{
    OnNPCKillEvent:
    if(killedrid == 1002){
    set muertos, muertos + 1;
    dispbottom "You have obtained 1 Rank Point Now you have " +muertos +".";
    callfunc ("mvpranker",muertos,strcharinfo(0));
    }
}

function    script    mvpranker    {
set $allkill, getarg(0);
set $nomb$, getarg(1);

    if($allkill > $top1mvp){
        if($top1mvp$ == strcharinfo(0)){
            set $top1mvp, $allkill;
            set $top1mvp$, $nomb$;
        } else {
            set $aux$, $top1mvp$;
            set $aux, $top1mvp;

            set $top1mvp$, $nomb$;
            set $top1mvp, $allkill;

            set $top2mvp$, $aux$;
            set $top2mvp, $aux;

        }
        


    } else if($allkill > $top2mvp){
        if($top2mvp$ == strcharinfo(0)){
            set $top2mvp, $allkill;
            set $top2mvp$, $nomb$;
        } else {
            set $aux$, $top2mvp$;
            set $aux, $top2mvp;

            set $top2mvp$, $nomb$;
            set $top2mvp, $allkill;

            set $top3mvp$, $aux$;
            set $top3mvp, $aux;

        }
        
        } else if($allkill$ > $top3mvp){
                if($top3mvp$ == strcharinfo(0)){
                set $top3mvp, $allkill;
                set $top3mvp$, $nomb$;
                } else {
                set $aux$, $top3mvp$;
                set $aux, $top3mvp;

                set $top3mvp$, $nomb$;
                set $top3mvp, $allkill;

                set $top4mvp$, $aux$;
                set $top4mvp, $aux;

        }


}
 

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  232
  • Reputation:   86
  • Joined:  06/30/18
  • Last Seen:  

I didn't test it, but I would do write the kind of script you want to do like this:
 

prontera,146,161,5    script    CheckRank    118,{
        mes .npc_name;        
        mes "Hello, this is a MvP Ranker";
        mes "Would you like to know the MvP Ranking?";
        next;
        if(select("Top 20:Leave") == 2) {
            mes.npcranker;
            mes "Bye";
            close;
        }

        mes.npc_name;
        for(.@i = 0; .@i < 20; .@i++)
            mes "The Top " + (.@i + 1) + " MVP: " + $top_mvp_names$[.@i] + " Killed: " + $top_mvp_kills$[.@i] + ".";
        close;

    OnInit:
        .npc_name = "[MvP Ranker]";
}


-    script    MVP_RANKER    FAKE_NPC,{
    OnNPCKillEvent:
        if(killedrid != 1002) end;

        mvp_rank_points++;
        dispbottom("You have obtained 1 Rank Point. You now have " + mvp_rank_points + ".");
        callfunc("updateMVPRank", strcharinfo(0), mvp_rank_points);
}

function    script    updateMVPRank    {
    .@curr_name$ = getarg(0);
    .@curr_kills = getarg(1);

    for(.@i = 0; .@i < 20; .@i++) {
        if($top_mvp_kills$[.@i] < .@curr_kills && $top_mvp_names$[.@i] != .@curr_name$) {
            .@new_name = .@curr_name;
            .@new_kills = .@curr_kills;

            .@curr_name = $top_mvp_names$[.@i];
            .@curr_kills = $top_mvp_kills$[.@i];

            $top_mvp_names$[.@i] = .@new_name;
            $top_mvp_kills$[.@i] = .@new_kills;

            continue;
        }

        if($top_mvp_kills$[.@i] < .@curr_kills) {
            $top_mvp_kills$[.@i] = .@curr_kills;
            break;
        }
    }
}

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  24
  • Topics Per Day:  0.06
  • Content Count:  49
  • Reputation:   0
  • Joined:  02/21/23
  • Last Seen:  

9 minutes ago, Winterfox said:

I didn't test it, but I would do write the kind of script you want to do like this:
 

prontera,146,161,5    script    CheckRank    118,{
        mes .npc_name;        
        mes "Hello, this is a MvP Ranker";
        mes "Would you like to know the MvP Ranking?";
        next;
        if(select("Top 20:Leave") == 2) {
            mes.npcranker;
            mes "Bye";
            close;
        }

        mes.npc_name;
        for(.@i = 0; .@i < 20; .@i++)
            mes "The Top " + (.@i + 1) + " MVP: " + $top_mvp_names$[.@i] + " Killed: " + $top_mvp_kills$[.@i] + ".";
        close;

    OnInit:
        .npc_name = "[MvP Ranker]";
}


-    script    MVP_RANKER    FAKE_NPC,{
    OnNPCKillEvent:
        if(killedrid != 1002) end;

        mvp_rank_points++;
        dispbottom("You have obtained 1 Rank Point. You now have " + mvp_rank_points + ".");
        callfunc("updateMVPRank", strcharinfo(0), mvp_rank_points);
}

function    script    updateMVPRank    {
    .@curr_name$ = getarg(0);
    .@curr_kills = getarg(1);

    for(.@i = 0; .@i < 20; .@i++) {
        if($top_mvp_kills$[.@i] < .@curr_kills && $top_mvp_names$[.@i] != .@curr_name$) {
            .@new_name = .@curr_name;
            .@new_kills = .@curr_kills;

            .@curr_name = $top_mvp_names$[.@i];
            .@curr_kills = $top_mvp_kills$[.@i];

            $top_mvp_names$[.@i] = .@new_name;
            $top_mvp_kills$[.@i] = .@new_kills;

            continue;
        }

        if($top_mvp_kills$[.@i] < .@curr_kills) {
            $top_mvp_kills$[.@i] = .@curr_kills;
            break;
        }
    }
}

 

I fixed now this is the problem. image.png.683ae2101e5992797cd9da77adfa2147.png it overwritte the previous one. here is the new script 

 

prontera,146,161,5    script    CheckRank    118,{
        

                
        mes "Hello, this is an Npc Ranker";
        mes "Would you like to know the MvP Ranking?";
        next;
        switch(select("Top 20:Leave")){

        case 1:
        mes "Top 1 is : [" +$n1$ +"], Kills : [" +$k1 +"] MVPS";
        mes "Top 2 is : [" +$n2$ +"], Kills : [" +$k2 +"] MVPS";
        mes "Top 3 is : [" +$n3$ +"], Kills : [" +$k3 +"] MVPS";
        mes "Top 4 is : [" +$n4$ +"], Kills : [" +$k4 +"] MVPS";
        mes "Top 5 is : [" +$n5$ +"], Kills : [" +$k5 +"] MVPS";
        mes "Top 6 is : [" +$n6$ +"], Kills : [" +$k6 +"] MVPS";
        mes "Top 7 is : [" +$n7$ +"], Kills : [" +$k7 +"] MVPS";
        mes "Top 8 is : [" +$n8$ +"], Kills : [" +$k8 +"] MVPS";
        mes "Top 9 is : [" +$n9$ +"], Kills : [" +$k9 +"] MVPS";
        mes "Top 10 is : [" +$n10$ +"], Kills : [" +$k10 +"] MVPS";
        close;
        break;

        case 2:
        mes "Have a nice day";
        mes "bye";
        close;
        end;

        }// end switch

}// end npc

-    script    count    -1,{
    OnNPCKillEvent:
    if(killedrid == 1002){
        set @rankp, @rankp + 1;
        dispbottom "You have obtained 1 Rank Point, now you have "+@rankp+" .";
        callfunc ("mvpladder",@rankp,strcharinfo(0));
    }


}


function    script    mvpladder    {
    set @puntos, getarg(0);
    set @nombres$, getarg(1);

    if (@puntos > $k1) {
        // Si el nombre se repite, eso se verifica con strcharinfo
        if (@nombres$ == strcharinfo(0)) {
            set $k1, @puntos;
            set $n1$, @nombres$;
        } else {
            // Guardo el top1 anterior
            set @oldn1$, $n1$;
            set @oldk1, $k1;

            // Ahora el top 2 se vuelve top1
            set $k1, $k2;
            set $n1$, $n2$;

            // Ahora el top1 que teníamos guardado se vuelve top2
            set $k2, @oldk1;
            set $n2$, @oldn1$;
        }
    } else if (@puntos > $k2) {
        if (@nombres$ == strcharinfo(0)) {
            set $k2, @puntos;
            set $n2$, @nombres$;
        } else {
            // Guardo el top2 anterior
            set @oldn2$, $n2$;
            set @oldk2, $k2;

            // El nuevo top2 toma el lugar del antiguo top2
            set $k2, $k3;
            set $n2$, $n3$;

            // El antiguo top2 se convierte en el nuevo top3
            set $k3, @oldk2;
            set $n3$, @oldn2$;
        }
    }


 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  24
  • Topics Per Day:  0.06
  • Content Count:  49
  • Reputation:   0
  • Joined:  02/21/23
  • Last Seen:  

17 minutes ago, Winterfox said:

I didn't test it, but I would do write the kind of script you want to do like this:
 

prontera,146,161,5    script    CheckRank    118,{
        mes .npc_name;        
        mes "Hello, this is a MvP Ranker";
        mes "Would you like to know the MvP Ranking?";
        next;
        if(select("Top 20:Leave") == 2) {
            mes.npcranker;
            mes "Bye";
            close;
        }

        mes.npc_name;
        for(.@i = 0; .@i < 20; .@i++)
            mes "The Top " + (.@i + 1) + " MVP: " + $top_mvp_names$[.@i] + " Killed: " + $top_mvp_kills$[.@i] + ".";
        close;

    OnInit:
        .npc_name = "[MvP Ranker]";
}


-    script    MVP_RANKER    FAKE_NPC,{
    OnNPCKillEvent:
        if(killedrid != 1002) end;

        mvp_rank_points++;
        dispbottom("You have obtained 1 Rank Point. You now have " + mvp_rank_points + ".");
        callfunc("updateMVPRank", strcharinfo(0), mvp_rank_points);
}

function    script    updateMVPRank    {
    .@curr_name$ = getarg(0);
    .@curr_kills = getarg(1);

    for(.@i = 0; .@i < 20; .@i++) {
        if($top_mvp_kills$[.@i] < .@curr_kills && $top_mvp_names$[.@i] != .@curr_name$) {
            .@new_name = .@curr_name;
            .@new_kills = .@curr_kills;

            .@curr_name = $top_mvp_names$[.@i];
            .@curr_kills = $top_mvp_kills$[.@i];

            $top_mvp_names$[.@i] = .@new_name;
            $top_mvp_kills$[.@i] = .@new_kills;

            continue;
        }

        if($top_mvp_kills$[.@i] < .@curr_kills) {
            $top_mvp_kills$[.@i] = .@curr_kills;
            break;
        }
    }
}

 

can you explain it for me in text the Npc? I would like to understand the function part.

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...