To check if the party has a certain number of an item (say coconuts ), use the following syntax in the "script" section of a conditional branch.
$game_party.item_number(item_id) == number
That would check to see if the item you're checking (who's ID you put between the parenthesizes) is equal to a certain number. Repalce the "==" with any other comparison sign (<<, >>, !=, <=, >=). If you want to assign the number of a particular item to a variable, do the following.
$game_party.item_number(item_id) = $game_switches[switch_number]
I don't have my computer, so I can't test these script calls out, but I'm pretty sure that's the correct syntax.