Hi, I'm new to scripting, but I'm trying to learn more.
I'm currently trying to make an NPC that counts how many cards are in the inventory of the player, then counts the quantity of each card, and finally adds up all the numbers to make the result, the entire amount of cards in the player's inventory.
I worked really hard to learn this, and it seemed to work for a bit... But when a friend got on my server and tested it with me, it stopped working. I don't know what went wrong.
prontera,163,189,3 script Test NPC 90,{
getinventorylist;
while(.@i < @inventorylist_count && getiteminfo(@inventorylist_id[.@i],2) != 6)
.@i++;
copyarray .@a[0],@inventorylist_amount[.@i],@inventorylist_count;
while(.@a < @inventorylist_count)
.@a++;
set .@b,.@a[1]+.@a[2]+.@a[3]+.@a[4]+.@a[5]+.@a[6]+.@a[7]+.@a[8]+.@a[9]+.@a[10]+.@a[11]+.@a[12]+.@a[13]+.@a[14]+.@a[15]+.@a[16]+.@a[17]+.@a[18]+.@a[19]+.@a[20]+.@a[21]+.@a[22]+.@a[23]+.@a[24]+.@a[25]+.@a[26]+.@a[27]+.@a[28]+.@a[29]+.@a[30];
if(.@i < @inventorylist_count) {
mes "You have cards.";
mes ""+.@b+"";
close;
}
mes "You don't have cards.";
close;
}
Sorry about the lack of tabs in the script, I'm not sure how to add those in a post. ^^;