Jump to content
  • 0

npc_event not found help!


Question

Posted (edited)
i cant find any problem on this script but when i put it
 
its keep saying npc_event not found [shop1;;OnShop]
 
please help me

prontera,151,181,5    script    Dynamic Shop    909,{
mes "Choose your Shop";
switch (select ("Upper HeadGear:Middle HeadGear:Low Headgear:Acessrry")) {
Case 1:    doevent "Shop1::OnShop";    end;
Case 2:    doevent "Shop2::OnShop";    end;
Case 3:    doevent "Shop3::OnShop";    end;
Case 4:    doevent "Shop4::OnShop";    end;
    }

}




// -- ***************************************** F I R S T    S H O P **********************************************

-    shop    quest_shop1    -1,501:50
-    script    Shop1    -1,{
OnShop:
    set @i,0;
    mes "[Shop Quest NPC]";
    mes "Which item do you wish to obtain?";
    mes "Select only one.";
    callshop "quest_shop1",1;
    npcshopattach "quest_shop1";
    end;

OnBuyItem:
    if(.BuildQuest) {
        for(set .e,0; !compare(getarg(.e+1),"Zeny"); set .e,.e+2) {}
        npcshopadditem "quest_shop1",getarg(.e+2),0;
        setarray .Shop[.i],getarg(.e+2);
        set .i,.i+1;
        goto Quest_Setup;
    }
    if(.Shop[@i]!=@bought_nameid) for(set @i,1; 1; set @i,@i+1) if(.Shop[@i]==@bought_nameid) { set .i,@i; callsub Quest_Setup; }
    for(set @i,1; !@e; set @i,@i+1) if(.Shop[@i]==@bought_nameid) { set @e,1; set .i,@i; callsub Quest_Setup; }
    mes "[Shop Quest NPC]";
    mes "I require the following:";
    for(set @i,0; !compare(getarg(@i+1),"Zeny"); set @i,@i+2) mes "^FF0000" + ((countitem(getarg(@i))>=getarg(@i+1))? "^00FF00":"") + "" + getarg(@i+1) + " " + getitemname(getarg(@i)) + " [" + countitem(getarg(@i)) + "/" + getarg(@i+1) + "]";
    if(getarg(@i)) mes "^FF0000" + ((Zeny>=getarg(@i))? "^00FF00":"") + "" + getarg(@i) + " Zeny";
    mes "^000000In exchange, I will give you:^0000FF";
    for(set @i,@i+2; getarg(@i); set @i,@i+2) mes getarg(@i+1) + " " + getitemname(getarg(@i));
    switch(select("Exchange:" + (((((getiteminfo(@bought_nameid,5) & 1) || (getiteminfo(@bought_nameid,5) & 256) || (getiteminfo(@bought_nameid,5) & 512)) && @equip==0))? "Preview Item":"") + ":No thanks")) {
        case 1:
            for(set @i,0; !compare(getarg(@i+1),"Zeny"); set @i,@i+2) if(countitem(getarg(@i)) < getarg(@i+1)) {
                next;
                mes "You have " + countitem(getarg(@i)) + " " + getitemname(getarg(@i)) + ", while I require " + getarg(@i+1) + ".";
                mes "Please obtain ^FF0000" + (getarg(@i+1)-countitem(getarg(@i))) + " more " + getitemname(getarg(@i)) + "^000000.";
                close;
            }
            if(Zeny<getarg(@i)) {
                next;
                mes "You do not have enough Zeny.";
                mes "Please obtain ^FF0000" + (getarg(@i)-Zeny) + " more Zeny^000000.";
                close;
            }
            for(set @i,0; !compare(getarg(@i+1),"Zeny"); set @i,@i+2) delitem getarg(@i),getarg(@i+1);
            set Zeny,Zeny-getarg(@i);
            for(set @i,@i+2; getarg(@i); set @i,@i+2) getitem getarg(@i),getarg(@i+1);
            close;
        case 2:
            set @bottomview, getlook(3);
            set @topview, getlook(4);
            set @midview, getlook(5);
            addtimer 1000, strnpcinfo(3)+"::On_Leave";
            set @equip,getiteminfo(@bought_nameid, 5);
            set @view, getiteminfo(@bought_nameid, 11);
            if(@equip != -1 && @view > 0) {
                if(@equip & 1) atcommand "@changelook 3 " + @view;
                if(@equip & 256) atcommand "@changelook 1 " + @view;
                if(@equip & 512) atcommand "@changelook 2 " + @view;
            }
            next;
            goto OnBuyItem;
        case 3:
            close;
    }
On_Leave:
    atcommand "@changelook 1 " + @topview;
    atcommand "@changelook 2 " + @midview;
    atcommand "@changelook 3 " + @bottomview;
    set @equip,0;
    set @view,0;
    set @topview,0;
    set @midview,0;
    set @bottomview,0;
    end;
OnInit:
    npcshopitem "quest_shop1",0,0;
    set .BuildQuest,1;
    set .i,1;
Quest_Setup:
    switch(.i) {
        default: set .BuildQuest,0; set .e,0; set .i,0; end;
                case 1: callsub OnBuyItem,7539,20,7076,10,7079,10,7083,10,7086,10,7087,10,2423,1,0,"Zeny",5423,1,0;
                case 2: callsub OnBuyItem,7539,20,7076,10,7079,10,7083,10,7086,10,7087,10,2423,1,0,"Zeny",5137,1,0;
                case 3: callsub OnBuyItem,7539,20,7073,10,7077,10,7088,10,7090,10,7092,10,2603,1,0,"Zeny",5518,1,0;
                case 4: callsub OnBuyItem,7539,100,5518,1,7080,10,7081,10,7082,10,7084,10,7085,10,0,"Zeny",5374,1,0
    }
}








// -- ***************************************** S E C O N D    S H O P **********************************************

-    shop    quest_shop2    -1,501:50
-    script    Shop2    -1,{
OnShop:
    set @i,0;
    mes "[Shop Quest NPC]";
    mes "Which item do you wish to obtain?";
    mes "Select only one.";
    callshop "quest_shop2",1;
    npcshopattach "quest_shop2";
    end;

OnBuyItem:
    if(.BuildQuest) {
        for(set .e,0; !compare(getarg(.e+1),"Zeny"); set .e,.e+2) {}
        npcshopadditem "quest_shop2",getarg(.e+2),0;
        setarray .Shop[.i],getarg(.e+2);
        set .i,.i+1;
        goto Quest_Setup;
    }
    if(.Shop[@i]!=@bought_nameid) for(set @i,1; 1; set @i,@i+1) if(.Shop[@i]==@bought_nameid) { set .i,@i; callsub Quest_Setup; }
    for(set @i,1; !@e; set @i,@i+1) if(.Shop[@i]==@bought_nameid) { set @e,1; set .i,@i; callsub Quest_Setup; }
    mes "[Shop Quest NPC]";
    mes "I require the following:";
    for(set @i,0; !compare(getarg(@i+1),"Zeny"); set @i,@i+2) mes "^FF0000" + ((countitem(getarg(@i))>=getarg(@i+1))? "^00FF00":"") + "" + getarg(@i+1) + " " + getitemname(getarg(@i)) + " [" + countitem(getarg(@i)) + "/" + getarg(@i+1) + "]";
    if(getarg(@i)) mes "^FF0000" + ((Zeny>=getarg(@i))? "^00FF00":"") + "" + getarg(@i) + " Zeny";
    mes "^000000In exchange, I will give you:^0000FF";
    for(set @i,@i+2; getarg(@i); set @i,@i+2) mes getarg(@i+1) + " " + getitemname(getarg(@i));
    switch(select("Exchange:" + (((((getiteminfo(@bought_nameid,5) & 1) || (getiteminfo(@bought_nameid,5) & 256) || (getiteminfo(@bought_nameid,5) & 512)) && @equip==0))? "Preview Item":"") + ":No thanks")) {
        case 1:
            for(set @i,0; !compare(getarg(@i+1),"Zeny"); set @i,@i+2) if(countitem(getarg(@i)) < getarg(@i+1)) {
                next;
                mes "You have " + countitem(getarg(@i)) + " " + getitemname(getarg(@i)) + ", while I require " + getarg(@i+1) + ".";
                mes "Please obtain ^FF0000" + (getarg(@i+1)-countitem(getarg(@i))) + " more " + getitemname(getarg(@i)) + "^000000.";
                close;
            }
            if(Zeny<getarg(@i)) {
                next;
                mes "You do not have enough Zeny.";
                mes "Please obtain ^FF0000" + (getarg(@i)-Zeny) + " more Zeny^000000.";
                close;
            }
            for(set @i,0; !compare(getarg(@i+1),"Zeny"); set @i,@i+2) delitem getarg(@i),getarg(@i+1);
            set Zeny,Zeny-getarg(@i);
            for(set @i,@i+2; getarg(@i); set @i,@i+2) getitem getarg(@i),getarg(@i+1);
            close;
        case 2:
            set @bottomview, getlook(3);
            set @topview, getlook(4);
            set @midview, getlook(5);
            addtimer 1000, strnpcinfo(3)+"::On_Leave";
            set @equip,getiteminfo(@bought_nameid, 5);
            set @view, getiteminfo(@bought_nameid, 11);
            if(@equip != -1 && @view > 0) {
                if(@equip & 1) atcommand "@changelook 3 " + @view;
                if(@equip & 256) atcommand "@changelook 1 " + @view;
                if(@equip & 512) atcommand "@changelook 2 " + @view;
            }
            next;
            goto OnBuyItem;
        case 3:
            close;
    }
On_Leave:
    atcommand "@changelook 1 " + @topview;
    atcommand "@changelook 2 " + @midview;
    atcommand "@changelook 3 " + @bottomview;
    set @equip,0;
    set @view,0;
    set @topview,0;
    set @midview,0;
    set @bottomview,0;
    end;
OnInit:
    npcshopitem "quest_shop2",0,0;
    set .BuildQuest,1;
    set .i,1;
Quest_Setup:
    switch(.i) {
        default: set .BuildQuest,0; set .e,0; set .i,0; end;
                case 1: callsub OnBuyItem,7539,50,2254,1,5043,1,2281,1,10000000,"Zeny",20201,1,0;
                case 2: callsub OnBuyItem,7539,50,20201,1,2276,5,2203,1,10014,10,4021,100,10000000,"Zeny",20242,1,0;
                case 3: callsub OnBuyItem,7539,50,7197,500,4205,50,5000000,"Zeny",20223,1,0;
                case 4: callsub OnBuyItem,7539,50,20223,1,5040,10,661,10,7047,10,10000000,"Zeny",20231,1,0;
                case 5: callsub OnBuyItem,7539,50,2210,1,975,1,976,1,914,300,10000000,"Zeny",20206,1,0;
                case 6: callsub OnBuyItem,7539,50,20206,1,2286,5,4069,30,10000000,"Zeny",20247,1,0;
                case 7: callsub OnBuyItem,7539,50,20247,1,2286,5,4069,30,10000000,"Zeny",20245,1,0;
                case 8: callsub OnBuyItem,7539,50,2286,5,4069,30,10000000,"Zeny",20246,1,0;
                case 9: callsub OnBuyItem,7539,50,20245,1,2286,5,4069,30,10000000,"Zeny",20244,1,0;
    }
}



// -- ***************************************** T H I R D    S H O P **********************************************

-    shop    quest_shop3    -1,501:50
-    script    Shop3    -1,{
OnShop:
    set @i,0;
    mes "[Shop Quest NPC]";
    mes "Which item do you wish to obtain?";
    mes "Select only one.";
    callshop "quest_shop3",1;
    npcshopattach "quest_shop3";
    end;

OnBuyItem:
    if(.BuildQuest) {
        for(set .e,0; !compare(getarg(.e+1),"Zeny"); set .e,.e+2) {}
        npcshopadditem "quest_shop3",getarg(.e+2),0;
        setarray .Shop[.i],getarg(.e+2);
        set .i,.i+1;
        goto Quest_Setup;
    }
    if(.Shop[@i]!=@bought_nameid) for(set @i,1; 1; set @i,@i+1) if(.Shop[@i]==@bought_nameid) { set .i,@i; callsub Quest_Setup; }
    for(set @i,1; !@e; set @i,@i+1) if(.Shop[@i]==@bought_nameid) { set @e,1; set .i,@i; callsub Quest_Setup; }
    mes "[Shop Quest NPC]";
    mes "I require the following:";
    for(set @i,0; !compare(getarg(@i+1),"Zeny"); set @i,@i+2) mes "^FF0000" + ((countitem(getarg(@i))>=getarg(@i+1))? "^00FF00":"") + "" + getarg(@i+1) + " " + getitemname(getarg(@i)) + " [" + countitem(getarg(@i)) + "/" + getarg(@i+1) + "]";
    if(getarg(@i)) mes "^FF0000" + ((Zeny>=getarg(@i))? "^00FF00":"") + "" + getarg(@i) + " Zeny";
    mes "^000000In exchange, I will give you:^0000FF";
    for(set @i,@i+2; getarg(@i); set @i,@i+2) mes getarg(@i+1) + " " + getitemname(getarg(@i));
    switch(select("Exchange:" + (((((getiteminfo(@bought_nameid,5) & 1) || (getiteminfo(@bought_nameid,5) & 256) || (getiteminfo(@bought_nameid,5) & 512)) && @equip==0))? "Preview Item":"") + ":No thanks")) {
        case 1:
            for(set @i,0; !compare(getarg(@i+1),"Zeny"); set @i,@i+2) if(countitem(getarg(@i)) < getarg(@i+1)) {
                next;
                mes "You have " + countitem(getarg(@i)) + " " + getitemname(getarg(@i)) + ", while I require " + getarg(@i+1) + ".";
                mes "Please obtain ^FF0000" + (getarg(@i+1)-countitem(getarg(@i))) + " more " + getitemname(getarg(@i)) + "^000000.";
                close;
            }
            if(Zeny<getarg(@i)) {
                next;
                mes "You do not have enough Zeny.";
                mes "Please obtain ^FF0000" + (getarg(@i)-Zeny) + " more Zeny^000000.";
                close;
            }
            for(set @i,0; !compare(getarg(@i+1),"Zeny"); set @i,@i+2) delitem getarg(@i),getarg(@i+1);
            set Zeny,Zeny-getarg(@i);
            for(set @i,@i+2; getarg(@i); set @i,@i+2) getitem getarg(@i),getarg(@i+1);
            close;
        case 2:
            set @bottomview, getlook(3);
            set @topview, getlook(4);
            set @midview, getlook(5);
            addtimer 1000, strnpcinfo(3)+"::On_Leave";
            set @equip,getiteminfo(@bought_nameid, 5);
            set @view, getiteminfo(@bought_nameid, 11);
            if(@equip != -1 && @view > 0) {
                if(@equip & 1) atcommand "@changelook 3 " + @view;
                if(@equip & 256) atcommand "@changelook 1 " + @view;
                if(@equip & 512) atcommand "@changelook 2 " + @view;
            }
            next;
            goto OnBuyItem;
        case 3:
            close;
    }
On_Leave:
    atcommand "@changelook 1 " + @topview;
    atcommand "@changelook 2 " + @midview;
    atcommand "@changelook 3 " + @bottomview;
    set @equip,0;
    set @view,0;
    set @topview,0;
    set @midview,0;
    set @bottomview,0;
    end;
OnInit:
    npcshopitem "quest_shop3",0,0;
    set .BuildQuest,1;
    set .i,1;
Quest_Setup:
    switch(.i) {
        default: set .BuildQuest,0; set .e,0; set .i,0; end;
                case 1: callsub OnBuyItem,7539,10,7074,10,7075,10,7831,10,7078,10,7089,10,7091,10,984,30,969,50,1522,1,0,"Zeny",5377,1,0;
                case 2: callsub OnBuyItem,7539,10,7076,10,7079,10,7083,10,7086,10,7087,10,2423,1,0,"Zeny",5521,1,0;
                case 3: callsub OnBuyItem,7539,10,7073,10,7077,10,7088,10,7090,10,7092,10,2603,1,0,"Zeny",5597,1,0;
                case 4: callsub OnBuyItem,7539,10,7080,10,7081,10,7082,10,7084,10,7085,10,0,"Zeny",5361,1,0;
                case 5: callsub OnBuyItem,7539,10,7058,1,7086,10,7087,10,7074,10,7075,10,7831,10,7078,10,7089,10,0,"Zeny",5532,1,0;
                case 6: callsub OnBuyItem,7539,10,7058,1,7086,10,7087,10,7074,10,7075,10,7831,10,7078,10,7089,10,0,"Zeny",5461,1,0;
                case 7 callsub OnBuyItem,7539,10,7058,1,7086,10,7087,10,7074,10,7075,10,7831,10,7078,10,7089,10,0,"Zeny",54621,0;
    }
}


// -- ***************************************** F O U R T H    S H O P **********************************************

-    shop    quest_shop4    -1,501:50
-    script    Shop4    -1,{
OnShop:
    set @i,0;
    mes "[Shop Quest NPC]";
    mes "Which item do you wish to obtain?";
    mes "Select only one.";
    callshop "quest_shop4",1;
    npcshopattach "quest_shop4";
    end;

OnBuyItem:
    if(.BuildQuest) {
        for(set .e,0; !compare(getarg(.e+1),"Zeny"); set .e,.e+2) {}
        npcshopadditem "quest_shop4",getarg(.e+2),0;
        setarray .Shop[.i],getarg(.e+2);
        set .i,.i+1;
        goto Quest_Setup;
    }
    if(.Shop[@i]!=@bought_nameid) for(set @i,1; 1; set @i,@i+1) if(.Shop[@i]==@bought_nameid) { set .i,@i; callsub Quest_Setup; }
    for(set @i,1; !@e; set @i,@i+1) if(.Shop[@i]==@bought_nameid) { set @e,1; set .i,@i; callsub Quest_Setup; }
    mes "[Shop Quest NPC]";
    mes "I require the following:";
    for(set @i,0; !compare(getarg(@i+1),"Zeny"); set @i,@i+2) mes "^FF0000" + ((countitem(getarg(@i))>=getarg(@i+1))? "^00FF00":"") + "" + getarg(@i+1) + " " + getitemname(getarg(@i)) + " [" + countitem(getarg(@i)) + "/" + getarg(@i+1) + "]";
    if(getarg(@i)) mes "^FF0000" + ((Zeny>=getarg(@i))? "^00FF00":"") + "" + getarg(@i) + " Zeny";
    mes "^000000In exchange, I will give you:^0000FF";
    for(set @i,@i+2; getarg(@i); set @i,@i+2) mes getarg(@i+1) + " " + getitemname(getarg(@i));
    switch(select("Exchange:" + (((((getiteminfo(@bought_nameid,5) & 1) || (getiteminfo(@bought_nameid,5) & 256) || (getiteminfo(@bought_nameid,5) & 512)) && @equip==0))? "Preview Item":"") + ":No thanks")) {
        case 1:
            for(set @i,0; !compare(getarg(@i+1),"Zeny"); set @i,@i+2) if(countitem(getarg(@i)) < getarg(@i+1)) {
                next;
                mes "You have " + countitem(getarg(@i)) + " " + getitemname(getarg(@i)) + ", while I require " + getarg(@i+1) + ".";
                mes "Please obtain ^FF0000" + (getarg(@i+1)-countitem(getarg(@i))) + " more " + getitemname(getarg(@i)) + "^000000.";
                close;
            }
            if(Zeny<getarg(@i)) {
                next;
                mes "You do not have enough Zeny.";
                mes "Please obtain ^FF0000" + (getarg(@i)-Zeny) + " more Zeny^000000.";
                close;
            }
            for(set @i,0; !compare(getarg(@i+1),"Zeny"); set @i,@i+2) delitem getarg(@i),getarg(@i+1);
            set Zeny,Zeny-getarg(@i);
            for(set @i,@i+2; getarg(@i); set @i,@i+2) getitem getarg(@i),getarg(@i+1);
            close;
        case 2:
            set @bottomview, getlook(3);
            set @topview, getlook(4);
            set @midview, getlook(5);
            addtimer 1000, strnpcinfo(3)+"::On_Leave";
            set @equip,getiteminfo(@bought_nameid, 5);
            set @view, getiteminfo(@bought_nameid, 11);
            if(@equip != -1 && @view > 0) {
                if(@equip & 1) atcommand "@changelook 3 " + @view;
                if(@equip & 256) atcommand "@changelook 1 " + @view;
                if(@equip & 512) atcommand "@changelook 2 " + @view;
            }
            next;
            goto OnBuyItem;
        case 3:
            close;
    }
On_Leave:
    atcommand "@changelook 1 " + @topview;
    atcommand "@changelook 2 " + @midview;
    atcommand "@changelook 3 " + @bottomview;
    set @equip,0;
    set @view,0;
    set @topview,0;
    set @midview,0;
    set @bottomview,0;
    end;
OnInit:
    npcshopitem "quest_shop4",0,0;
    set .BuildQuest,1;
    set .i,1;
Quest_Setup:
    switch(.i) {
        default: set .BuildQuest,0; set .e,0; set .i,0; end;
                case 1: callsub OnBuyItem,7074,10,7075,10,7831,10,7078,10,7089,10,7091,10,984,30,969,50,1522,1,0,"Zeny",1530,1,0;
                case 2: callsub OnBuyItem,7076,10,7079,10,7083,10,7086,10,7087,10,2423,1,0,"Zeny",2410,1,0;
                case 3: callsub OnBuyItem,7073,10,7077,10,7088,10,7090,10,7092,10,2603,1,0,"Zeny",2630,1,0;
                case 4: callsub OnBuyItem,7080,10,7081,10,7082,10,7084,10,7085,10,0,"Zeny",7058,1,0;
                case 5: callsub OnBuyItem,7058,1,7086,10,7087,10,7074,10,7075,10,7831,10,7078,10,7089,10,0,"Zeny",2629,1,0;
                case 6: callsub OnBuyItem,738,1,10000000,"Zeny",5574,1,0;
    }
}

 

 

Edited by Emistry
Changed to [Code].

4 answers to this question

Recommended Posts

Posted
[Error]:  Loading NPC file: npc/custom/tcg.txt

script error on npc/custom/tcg.txt line 26

    parse_line: expect command, missing function name or calling undeclared func

tion

    23 : {

    24 : function Add; function Chk; function Slot; function A_An;

    25 : OnInit:

*   26 :        'f'reeloop(1);

    27 :

    28 : // -----------------------------------------------------------

    29 : //  Basic shop settings.

    30 : // -----------------------------------------------------------

    31 :

[Error]:

script error on npc/custom/tcg.txt line 209

    parse_syntax: need ';'

   207 : {

   208 :        deletearray @i[0],getarraysize(@i);

*  209 :        for(set .@i,0; .@i<getargcount'('); set .@i,.@i+1);

   210 :                set @i[.@i],getarg(.@i);

   211 :        doevent "quest_shop::OnMenu";

   212 :        end;

   213 : }

 

sir emistry i got an error,

 

on a script you gave to me

 

sorry if for being newbie
Posted

my bad..

 

anyway super thanks for sir emistry and sir euphy

 

all are working great now..

i just changed to rathena

 

sorry for being noob

 

more power to you sir/s

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...