Awesome, it looks to me like it will work fine.
I have a small comment about this bit from the perspective of a software developer:
This generates a random element from the list until it finds one that actually exists in PBItems. You could argue that this is appropriate for a script intended for other people to install, but my view is that it's a great way to hide typo-related errors (and trap your script in an infinite loop if you somehow make 100% typos/delete all the items from the game).
Personally I'd prefer to write that particular part as simply:
Code:
random2=rand(items.length)
And get an error if an invalid item happens to be picked. Or possibly even something like this:
Code:
throw "error" unless items.all? { |i| hasConst?(PBItems,i) }
random2=rand(items.length)
Not exactly sure how throw works in Ruby, but the intention here is to double-check the whole list of items and ensure that they all exist so that you don't have the possibility of you never encountering an error for a non-existent item but a player does (because by chance the particular buggy numbers never came up).