item script ItemSelector{
// int a: Item ID that button 'A' should be set to
// int b: Item ID that button 'B' should be set to
void run(int a, int b){
if (a == GetEquipmentB()){
// 'B' currently has the item needed on 'A', so move it out of the way.
Link->SelectBWeapon(DIR_RIGHT);
if(a == GetEquipmentB()){
// Link only has two items to choose from. Don't know how to handle this case.
Quit();
}
}
int a_equip = GetEquipmentA();
if(Link->Item[a]){ // Make sure Link has the item in question
while (a != GetEquipmentA()){
// Cycle through the items until the correct item for 'A' is found
Link->SelectAWeapon(DIR_RIGHT);
if(a_equip == GetEquipmentA()){
// Item not found. Subscreen not setup correctly!
break;
}
}
}
if (a == b){
// You can't set both slots to the same item.
Quit();
}
int b_equip = GetEquipmentB();
if(Link->Item[b]){ // Make sure Link has the item in question
while (b != GetEquipmentB()){
// Cycle through the items until the correct item for 'B' is found
Link->SelectBWeapon(DIR_RIGHT);
if(b_equip == GetEquipmentB()){
// Item not found. Subscreen not setup correctly!
break;
}
}
}
}
}