caspa Posted March 30, 2012 Group: Members Topic Count: 194 Topics Per Day: 0.04 Content Count: 499 Reputation: 3 Joined: 03/11/12 Last Seen: September 18, 2023 Share Posted March 30, 2012 //Author Goddameit //Web http://goo.gl/q9sej //Version 2011/12/03-19:03 - shop dyn_shop1 -1,501:-1 prontera,150,180,5, script Headdress Making#1 894,{ function OnItemList ; function OnAD ; function V2N ; callshop "dyn_shop"+.a$,1; npcshopattach "dyn_shop"+.a$; end; function V2N { if(getarg(0)=="#CASHPOINTS")return "Cash"; else if(getarg(0)=="Zeny")return "Zeny"; //else if(getarg(0)=="#KAFRAPOINTS")return "kafra"; else return getarg(0); } function OnItemList { switch(getarg(0,0)) { // //SAMPLE // case n: return OnAD(getarg(1), // /*item-id*/ // ""/*variable 1(if dont need, type "")*/,/*price 1*/, // ""/*variable 2*/,/*price 2*/, //can add more // ""/*variable n*/,/*price n*/; // ,"%","%", //Improtan Separated // /*needed 1*/,/*amount 1*/, // /*needed 2*/,/*amount 2*/, // /*needed 3*/,/*amount 3*/, // /*needed 4*/,/*amount 4*/, // /*needed 5*/,/*amount 5*/, // /*needed 6*/,/*amount 6*/, //can add more // /*needed n*/,/*amount n*/); // case 1: return OnAD(getarg(1),5013,"Zeny",100,"%","%",607,100,608,100); case 2: return OnAD(getarg(1),5001,"",0,"%","%",512,569); case 3: return OnAD(getarg(1),5002,"#CASHPOINTS",1,"Zeny",100,"%","%",512,569); case 4: return OnAD(getarg(1),2201,"#CASHPOINTS",10,"%","%"); case 5: return OnAD(getarg(1),2270,"#CASHPOINTS",10,"%","%"); case 6: return OnAD(getarg(1),2271,"%","%",512,569); } return 0; } function OnAD { if(getarg(0)<=2) { if(getarg(0)==1) npcshopadditem "dyn_shop"+.a$,getarg(1),0; return getarg(1); } return getarg(getarg(0)-1,0); } OnBuyItem: for(set .@i,1;set(@idz,OnItemList(.@i,2));set .@i,.@i+1) if(@idz==@bought_nameid[0]) { mes "[bUY:"+getitemname(@idz)+"]"; for(set .@j,2;set(.@n$,OnItemList(.@i,.@j+1))!="%";set .@j,.@j+2) if(.@n$!="")mes "[Var]["+V2N(.@n$)+"]x["+OnItemList(.@i,.@j+2)+"]"; for(set .@j,.@j+2;set(.@n,OnItemList(.@i,.@j+1,0));set .@j,.@j+2) if(.@n)mes "[item]["+getitemname(.@n)+"]x["+OnItemList(.@i,.@j+2)+"]"; switch(getiteminfo(@idz,5)) { case 256: set @v,getlook(4);changelook(4,getiteminfo(@idz,11));break; case 512: set @v,getlook(5);changelook(5,getiteminfo(@idz,11));break; case 1: set @v,getlook(3);changelook(3,getiteminfo(@idz,11));break; } next; if(prompt("[bUY]")==255) { switch(getiteminfo(@idz,5)) { case 256: changelook(4,@v);break; case 512: changelook(5,@v);break; case 1: changelook(3,@v);break; } }else{ for(set .@j,2;set(.@n$,OnItemList(.@i,.@j+1))!="%";set .@j,.@j+2) if(.@n$!="") if(getd(.@n$)<set(.@n,OnItemList(.@i,.@j+2))) { set .@no,1; mes "[Var]["+V2N(.@n$)+"]Lack["+(.@n-getd(.@n$))+"]"; } for(set .@j,.@j+2;set(.@n,OnItemList(.@i,.@j+1,0));set .@j,.@j+2) if(.@n) if(countitem(.@n)<set(.@m,OnItemList(.@i,.@j+2))) { set .@no,1; mes "[item]["+getitemname(.@n)+"]Lack["+(.@m-countitem(.@n))+"]"; } if(.@no)break; for(set .@j,2;set(.@n$,OnItemList(.@i,.@j+1))!="%";set .@j,.@j+2) if(.@n$!="") { setd .@n$,getd(.@n$)-set(.@n,OnItemList(.@i,.@j+2)); dispbottom "Consume "+.@n+" "+V2N(.@n$)+" points. Total "+getd(.@n$)+" points."; } for(set .@j,.@j+2;set(.@n,OnItemList(.@i,.@j+1,0));set .@j,.@j+2) if(.@n) delitem .@n,OnItemList(.@i,.@j+2); getitem @idz,1; } break; } switch(getiteminfo(@idz,5)) { case 256: changelook(4,@v);break; case 512: changelook(5,@v);break; case 1: changelook(3,@v);break; } close; OnInit: set .a$,strnpcinfo(2); npcshopitem "dyn_shop"+.a$,OnItemList(.@i,2),1; for(set .@i,1;OnItemList(.@i,1);set .@i,.@i+1); end; } Quote Link to comment Share on other sites More sharing options...
Emistry Posted March 30, 2012 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10018 Reputation: 2370 Joined: 10/28/11 Last Seen: Sunday at 05:32 PM Share Posted March 30, 2012 change all dyn_shop"+.a$, into dyn_shop1 and learn to use Codebox please Quote Link to comment Share on other sites More sharing options...
Question
caspa
//Author Goddameit
//Web http://goo.gl/q9sej
//Version 2011/12/03-19:03
- shop dyn_shop1 -1,501:-1
prontera,150,180,5, script Headdress Making#1 894,{
function OnItemList ;
function OnAD ;
function V2N ;
callshop "dyn_shop"+.a$,1;
npcshopattach "dyn_shop"+.a$;
end;
function V2N {
if(getarg(0)=="#CASHPOINTS")return "Cash";
else if(getarg(0)=="Zeny")return "Zeny";
//else if(getarg(0)=="#KAFRAPOINTS")return "kafra";
else return getarg(0);
}
function OnItemList {
switch(getarg(0,0))
{
//
//SAMPLE
// case n: return OnAD(getarg(1),
// /*item-id*/
// ""/*variable 1(if dont need, type "")*/,/*price 1*/,
// ""/*variable 2*/,/*price 2*/, //can add more
// ""/*variable n*/,/*price n*/;
// ,"%","%", //Improtan Separated
// /*needed 1*/,/*amount 1*/,
// /*needed 2*/,/*amount 2*/,
// /*needed 3*/,/*amount 3*/,
// /*needed 4*/,/*amount 4*/,
// /*needed 5*/,/*amount 5*/,
// /*needed 6*/,/*amount 6*/, //can add more
// /*needed n*/,/*amount n*/);
//
case 1: return OnAD(getarg(1),5013,"Zeny",100,"%","%",607,100,608,100);
case 2: return OnAD(getarg(1),5001,"",0,"%","%",512,569);
case 3: return OnAD(getarg(1),5002,"#CASHPOINTS",1,"Zeny",100,"%","%",512,569);
case 4: return OnAD(getarg(1),2201,"#CASHPOINTS",10,"%","%");
case 5: return OnAD(getarg(1),2270,"#CASHPOINTS",10,"%","%");
case 6: return OnAD(getarg(1),2271,"%","%",512,569);
}
return 0;
}
function OnAD {
if(getarg(0)<=2)
{
if(getarg(0)==1)
npcshopadditem "dyn_shop"+.a$,getarg(1),0;
return getarg(1);
}
return getarg(getarg(0)-1,0);
}
OnBuyItem:
for(set .@i,1;set(@idz,OnItemList(.@i,2));set .@i,.@i+1)
if(@idz==@bought_nameid[0])
{
mes "[bUY:"+getitemname(@idz)+"]";
for(set .@j,2;set(.@n$,OnItemList(.@i,.@j+1))!="%";set .@j,.@j+2)
if(.@n$!="")mes "[Var]["+V2N(.@n$)+"]x["+OnItemList(.@i,.@j+2)+"]";
for(set .@j,.@j+2;set(.@n,OnItemList(.@i,.@j+1,0));set .@j,.@j+2)
if(.@n)mes "[item]["+getitemname(.@n)+"]x["+OnItemList(.@i,.@j+2)+"]";
switch(getiteminfo(@idz,5))
{
case 256: set @v,getlook(4);changelook(4,getiteminfo(@idz,11));break;
case 512: set @v,getlook(5);changelook(5,getiteminfo(@idz,11));break;
case 1: set @v,getlook(3);changelook(3,getiteminfo(@idz,11));break;
}
next;
if(prompt("[bUY]")==255)
{
switch(getiteminfo(@idz,5))
{
case 256: changelook(4,@v);break;
case 512: changelook(5,@v);break;
case 1: changelook(3,@v);break;
}
}else{
for(set .@j,2;set(.@n$,OnItemList(.@i,.@j+1))!="%";set .@j,.@j+2)
if(.@n$!="")
if(getd(.@n$)<set(.@n,OnItemList(.@i,.@j+2)))
{
set .@no,1;
mes "[Var]["+V2N(.@n$)+"]Lack["+(.@n-getd(.@n$))+"]";
}
for(set .@j,.@j+2;set(.@n,OnItemList(.@i,.@j+1,0));set .@j,.@j+2)
if(.@n)
if(countitem(.@n)<set(.@m,OnItemList(.@i,.@j+2)))
{
set .@no,1;
mes "[item]["+getitemname(.@n)+"]Lack["+(.@m-countitem(.@n))+"]";
}
if(.@no)break;
for(set .@j,2;set(.@n$,OnItemList(.@i,.@j+1))!="%";set .@j,.@j+2)
if(.@n$!="")
{
setd .@n$,getd(.@n$)-set(.@n,OnItemList(.@i,.@j+2));
dispbottom "Consume "+.@n+" "+V2N(.@n$)+" points. Total "+getd(.@n$)+" points.";
}
for(set .@j,.@j+2;set(.@n,OnItemList(.@i,.@j+1,0));set .@j,.@j+2)
if(.@n)
delitem .@n,OnItemList(.@i,.@j+2);
getitem @idz,1;
}
break;
}
switch(getiteminfo(@idz,5))
{
case 256: changelook(4,@v);break;
case 512: changelook(5,@v);break;
case 1: changelook(3,@v);break;
}
close;
OnInit:
set .a$,strnpcinfo(2);
npcshopitem "dyn_shop"+.a$,OnItemList(.@i,2),1;
for(set .@i,1;OnItemList(.@i,1);set .@i,.@i+1);
end;
}
Link to comment
Share on other sites
1 answer to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.