I /think/ this should work. See if it works, if so, rip it apart and modify it for your own use.
Code:
# Cycle Reward
sub EVENT_SAY {
my $item = quest::saylink("item",1);
@rewardlist = (68875, 68876, 68877, 68878, 68879, 68970, 68971, 68875);
if ($text =~/Hail/i) {
plugin::Whisper("I can give you an [$item], which you can give back to me, and I will cycle through a list of items I will give back to you. Isn't cyclic redundancy fun?");
}
if ($text =~/item/i) {
plugin::Whisper("Here you go.");
quest::summonitem("68879");
}
}
sub EVENT_ITEM {
my $given = 0;
my $togive = 0;
my $count = 0;
foreach $positem (@rewardlist) {
if ($given == 0) {
if (plugin::check_handin(\%itemcount, $positem => 1)) {
$togive = $count+1;
$given = 1;
}
}
else {
quest::summonitem($rewardlist[$togive]);
plugin::Whisper("If you want something else, please return that to me. I will go through my list of items and give you the next one on the list.");
return;
}
$count++;
}
if ($given == 0) {
plugin::return_items(\%itemcount);
}
}