Is it possible to filter on a hash/array?
I'm trying to see if instead of building multiple hashes for different types of turnins, if I can build a single large hash and filter results based on data in that hash. I'm not super savvy with these so kinda learning as I go, any help is appreciated.
Code:
%combine_1 = ( Dialogue I have right now: Code:
foreach $id (sort keys %combine_1) { Code:
foreach $id (sort keys %combine_1) { |
I -believe- this is what you're looking for (i.e. how to access/use a key in a hash of a hash):
Code:
%combine_1 = ( |
Is this what you are trying to do?
http://www.eqemulator.org/forums/showthread.php?t=36357 Filters out stuff from a big ol hash |
Quote:
|
Devoid of feedback on what I posted using your own hash, I'm afraid I cannot be of much more assistance.
I'm simply not clear on the "if this then do that" function you're looking for. That said, I'm thinking (based on what I've seen) that you may find a hash composition of the below more aligned with your assumed goals: Code:
%combines = ( |
Quote:
Just to clarify, in the dialogue, similar to what Nate posted, the user can choose what "type" of jewelry they are interested in and I want to pull those out of the hash so the dialogue response isn't a mile long. |
Quote:
With the example I posted using your existing hash, so long as you utilize conditionals, it will "pull" the types requested, then display a link for the reward item. The modified hash I posted is how I would roll myself, perhaps even making the moneyrequired and itemrequired keys hold array values (for flexibility), though it would of course require more code you're currently not comfortable with (though I suspect you will be in time). Code:
%combines = ( I'm heading out of town, so I cannot see my assistance through, but, you've got Nate's ears/eyes, you'll get it all worked out I have no doubt. |
Quote:
|
Quote:
1111 x 1, 2222 x 1, 3333 x 1, 4444 x 1, 2pp,0gp,0sp,0cp Results in: 9999 But... 1111 x 1, 2222 x 1, 5555 x 1 20pp,0gp,0sp,0cp Also results in: 9999 If not, then having arrays as the itemrequired and moneyrequired values wouldn't be necessary (which is where I imagined you going). Also with that, then you could just roll with a formatted array like in Nate's script. Im out, I look forward to revisiting this when I get back, have a good one. |
Nah, each recipe and reward is unique. Some may share components, but no two are the same.
|
Quote:
|
All times are GMT -4. The time now is 03:34 AM. |
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.