I have a broken pet egg exchanging old egg to new egg script which need help in fixing.
- script F_PetTrader FAKE_NPC,{
disable_items;
getinventorylist;
for ( .@i = 0; .@i < @inventorylist_count; ++.@i ) {
.@item_type = getiteminfo( @inventorylist_id[.@i], ITEMINFO_TYPE );
if ( .@item_type == IT_PETEGG ) {
if ( .petid[ @inventorylist_id[.@i] ] && !.@compare[ @inventorylist_id[.@i] ] ) {
.@found[.@c++] = @inventorylist_id[.@i];
.@compare[ @inventorylist_id[.@i] ] = false;
}
}
}
.@menu$ = "+&Sort&Count&Item&Name+&^FF0000Quit^000000:";
for ( .@i = 0; .@i < getarraysize(.@found); ++.@i ) {
mes getitemname( .@found[.@i] );
.@menu$ += .@i + " " + countitem(.@found[.@i] ) + " " + getitemname(.@found[.@i]) + " :";
dispbottom ( " .@i :: " + .@i + " Count item :: " + countitem(.@found[.@i] ) + " ItemName :: " + getitemname(.@found[.@i]) ) ;
}
.@i = select(.@menu$)-1;
if ( .@i > getarraysize(.@found) ) {
dispbottom ( " Dont mess with bug or I bug you! " ) ;
close2;
end;
} else {
mes (" .@i " + .@i );
.@EggItemId = .@found[.@i];
.@EggCount = countitem(.@found[.@i] );
if ( .@EggItemId ) {
delitem ( .@EggItemId, .@EggCount ) ;
makepet ( .@EggItemId );
mes ( " Exchanged :: " + .@EggCount + " of " + .@EggItemId ) ;
} else {
dispbottom ( " .@EggItemId :: " + .@EggItemId + " .@EggCount :: " + .@EggCount ) ;
}
}
close;
OnInit:
.@nb = query_sql( "select id from item_db where type & "+( 7 ), .@id );
freeloop true;
for ( .@i = 0; .@i < .@nb; ++.@i )
.petid[ .@id[.@i] ] = true;
end;
}
It is suppose to list what egg in player inventory but always returning poring egg..
sometimes nothing is listed..or 0
somewhere is broken and I failed to find out where
and the .@menu$ part is confusing for me since it's not something I always messing with.
- script F_PetTrader FAKE_NPC,{
disable_items;
getinventorylist;
for ( .@i = 0; .@i < @inventorylist_count; ++.@i ) {
.@item_type = getiteminfo( @inventorylist_id[.@i], ITEMINFO_TYPE );
if ( .@item_type == IT_PETEGG ) {
if ( .petid[ @inventorylist_id[.@i] ] && !.@compare[ @inventorylist_id[.@i] ] ) {
.@found[.@c++] = @inventorylist_id[.@i];
.@compare[ @inventorylist_id[.@i] ] = false;
}
}
}
.@menu$ = "+&Sort&Count&Item&Name+&^FF0000Quit^000000:";
for ( .@i = 0; .@i < getarraysize(.@found); ++.@i ) {
mes getitemname( .@found[.@i] );
.@menu$ += .@i + " " + countitem(.@found[.@i] ) + " " + getitemname(.@found[.@i]) + " :";
dispbottom ( " .@i :: " + .@i + " Count item :: " + countitem(.@found[.@i] ) + " ItemName :: " + getitemname(.@found[.@i]) ) ;
}
.@i = select(.@menu$)-1;
if ( .@i > getarraysize(.@found) ) {
dispbottom ( " Dont mess with bug or I bug you! " ) ;
close2;
end;
} else {
mes (" .@i " + .@i );
.@EggItemId = .@found[.@i];
.@EggCount = countitem(.@found[.@i] );
if ( .@EggItemId ) {
delitem ( .@EggItemId, .@EggCount ) ;
makepet ( .@EggItemId );
mes ( " Exchanged :: " + .@EggCount + " of " + .@EggItemId ) ;
} else {
dispbottom ( " .@EggItemId :: " + .@EggItemId + " .@EggCount :: " + .@EggCount ) ;
}
}
close;
OnInit:
.@nb = query_sql( "select id from item_db where type & "+( 7 ), .@id );
freeloop true;
for ( .@i = 0; .@i < .@nb; ++.@i )
.petid[ .@id[.@i] ] = true;
end;
}
It is suppose to list what egg in player inventory but always returning poring egg..
sometimes nothing is listed..or 0
somewhere is broken and I failed to find out where
and the .@menu$ part is confusing for me since it's not something I always messing with.