[skip all navigation]

Returning array values, is there a function or alternative?

Creator: Bolshevik09
Time: May 13 2012, 5:59 pm

Post #1     Bolshevik09 May 13 2012, 5:59 pm

[Avatar]
offlinecontact
Rank: Member
I would like to create a dialog "Shop" with 30 items to buy and 1 trigger to run it! Something like this..

Events
- Dialog item is used
Conditions
- 1<= (used dialog item"SHOP"[30]) =<30
- "Players Money" >= "Shop Item Value"[returned array of "SHOP"]
Actions
- Modify variable "Players Money" - "Shop Item Value"[returned array of "SHOP"]
- etc etc


And i would set "Shop Item Value"[30] pre-hand to each Item's value.
---I need a way to return the array value used in a variable with arrays! If you understand---

I could also use a looped action to determine if it was the used dialog item like this..

For Each Integer "Counter" 1-30
-If: Used Dialog Item = Counter
-Then: Set Local Variable = Counter


but then my Event would have to be "Dialog item is used" with no conditions and i have multiple dialogs and i think that would lag.
I'm not sure but "Catalog Field Value Count" might be my answer but i'm not sure how it works..

Top

Post #2     DevliN May 13 2012, 6:31 pm

[Avatar]
SOMETHING STATUS GO
offlinecontact
Rank: Administrator
I'm not at my computer to really go into detail, but you should use the "If, then, if" action under General so that you can use Conditions in the Actions area to determine which item is being purchased.

:devlin: CURRENTLY WORKING ON :devlin:
Invasion: Ares | OMG TEH ZOMBIES!!!
Summoner | Infection
Top

Post #3     Ahli May 13 2012, 7:25 pm

[Avatar]
Nothing yet! Almost done. Very powerful, very strong.
offlinecontact
Rank: Elite
I'm using 1 trigger with a generic event.

Then I check all dialog items (which are buttons) with loops to find out which has been used.

When I found it, I'm starting a custom action definition which takes the player and the button's ID in the array as a parameter.

What really happens when the button is clicked, is controlled by that custom action definition.

(user posted image)
Top

Post #4     Bolshevik09 May 13 2012, 8:18 pm

[Avatar]
offlinecontact
Rank: Member
Quote from Ahli
I'm using 1 trigger with a generic event.
Then I check all dialog items (which are buttons) with loops to find out which has been used.
When I found it, I'm starting a custom action definition which takes the player and the button's ID in the array as a parameter.
What really happens when the button is clicked, is controlled by that custom action definition.
Can i see an example? ^

i tried setting the items current dialog item value to 1 - 30 and using these 2 conditions:
1<= (used dialog item current value) <=30
Dialog containing dialog item

and that worked but when i clicked other dialog's items, my trigger came back "error cannot get value" even though the dialog containing was different.
The condition "Dialog containing dialog item" doesnt seem to be able to tell my dialogs apart.

If i can somehow save each dialog item as a string 1-30 and then use a "within bounds" condition to recall then that would be great. something like:
1<= (sting integer from string) <=30

Top

Post #5     Ahli May 13 2012, 8:26 pm

[Avatar]
Nothing yet! Almost done. Very powerful, very strong.
offlinecontact
Rank: Elite
(user posted image)

1. Completely generic event
2. check which dialog is visible for the player (-> visible == dialog's buttons are clickable)
3. compare buttons with the used one
4. pass information somewhere else to do the magic because your trigger can become very long with many dialogs and it should only find out which button in which dialog was used.

(user posted image)
Top

Post #6     Bolshevik09 May 14 2012, 12:03 am

[Avatar]
offlinecontact
Rank: Member
Quote from Ahli
1. Completely generic event
2. check which dialog is visible for the player (-> visible == dialog's buttons are clickable)
3. compare buttons with the used one
What if i have multiple dialogs open which i do?
Quote from Ahli
4. pass information somewhere else to do the magic because your trigger can become very long with many dialogs and it should only find out which button in which dialog was used.

This seems too complex or i just don't understand it. I can do this if i can just figure out out to have the system take a # from a string with letters as well
I can store 30 strings such as Shop01 Shop02 Shop03 etc and a "within bounds" condition to check it.
So is there a way to return which array of the variable was used or to return numbers out of strings?
What about a preset that allows all arrays in a variable to be true such as: used dialog item"SHOP"[any]?

Top

Post #7     Ahli May 14 2012, 12:18 am

[Avatar]
Nothing yet! Almost done. Very powerful, very strong.
offlinecontact
Rank: Elite
Quote from Bolshevik09
Quote from Ahli
1. Completely generic event
2. check which dialog is visible for the player (-> visible == dialog's buttons are clickable)
3. compare buttons with the used one
What if i have multiple dialogs open which i do?
You check all buttons and someday you find the right one and execute all necessary actions from there. Action definitions are just a more modular way of writing down the code that should be executed.

The approach that I use is to search till you find the used button by button comparison. AfaIk that's the way other mappers do it, too.

Quote from Bolshevik09
Quote from Ahli
4. pass information somewhere else to do the magic because your trigger can become very long with many dialogs and it should only find out which button in which dialog was used.

This seems too complex or i just don't understand it. I can do this if i can just figure out out to have the system take a # from a string with letters as well
I can store 30 strings such as Shop01 Shop02 Shop03 etc and a "within bounds" condition to check it.
So is there a way to return which array of the variable was used or to return numbers out of strings?
What about a preset that allows all arrays in a variable to be true such as: used dialog item"SHOP"[any]?
The conversion String to Integer should exist.
But I don't quite understand how you imagine it to work. I guess you want to analyze the string you get somehow to determine the window. Then you want to get the number you somehow store in the button to get the array's list?
If you try to form the string and the number directly into a reference for an array, that won't work.

(user posted image)
Top

Post #8     Bolshevik09 May 14 2012, 2:48 am

[Avatar]
offlinecontact
Rank: Member
Well the reason that i am getting error messages is because if i click on a dialog item that has never had a "Current value" set via triggers, then it returns errors..
So i have to leave it as following:
Events
-dialog item is used
Conditions
-Dialog of Dialog Item = SHOP
Actions
-Set local variable "DValue" = current value of Dialog item used
-If Then Else bla bla bla

I think blizzard might want to set the default value of Dialog Items = 0 so that they will atleast not return errors

Top
0 members in this topic (italic members are currently writing a reply): None
+ guest(s)


[05:29 pm]
jjf28 -- steve jobs was literally hitler
[05:25 pm]
Dem0n -- sux iphone sux fuck apple etc
[05:11 pm]
NudeRaider -- rive, maasdamer is where it's at.
[05:10 pm]
NudeRaider -- fuck, that autocorrect was unbelievably funny. I too haven't laughed that hard in a long time. but it leaves me wondering how an autocorrect software can be this stupid. some of those are really bizarre.
[04:52 pm]
Zycorax -- :wob:
[05:14 am]
RIVE -- I pray to Mozzarella because I fear the Rapture.
[04:42 am]
jjf28 -- it's evil, pure, demonic, evil
Please log in to shout.