Staredit Network > Forums > SC2 Assistance > Topic: Returning array values
Returning array values
May 13 2012, 5:59 pm
By: Bolshevik09  

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



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..



None.

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

OVERWATCH STATUS GO

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\:
My Overwatch addiction.

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

I do stuff and thingies... Try widening and reducing the number of small nooks and crannies to correct the problem.

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.




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



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



None.

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

I do stuff and thingies... Try widening and reducing the number of small nooks and crannies to correct the problem.



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.




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



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]?



None.

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

I do stuff and thingies... Try widening and reducing the number of small nooks and crannies to correct the problem.

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.




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



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



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[09:38 pm]
NudeRaider -- Ultraviolet
Ultraviolet shouted: NudeRaider sing it brother
trust me, you don't wanna hear that. I defer that to the pros.
[07:56 pm]
Ultraviolet -- NudeRaider
NudeRaider shouted: "War nie wirklich weg" 🎵
sing it brother
[2024-4-27. : 6:24 pm]
NudeRaider -- "War nie wirklich weg" 🎵
[2024-4-27. : 3:33 pm]
O)FaRTy1billion[MM] -- o sen is back
[2024-4-27. : 1:53 am]
Ultraviolet -- :lol:
[2024-4-26. : 6:51 pm]
Vrael -- It is, and I could definitely use a company with a commitment to flexibility, quality, and customer satisfaction to provide effective solutions to dampness and humidity in my urban environment.
[2024-4-26. : 6:50 pm]
NudeRaider -- Vrael
Vrael shouted: Idk, I was looking more for a dehumidifer company which maybe stands out as a beacon of relief amidst damp and unpredictable climates of bustling metropolises. Not sure Amazon qualifies
sounds like moisture control is often a pressing concern in your city
[2024-4-26. : 6:50 pm]
Vrael -- Maybe here on the StarEdit Network I could look through the Forums for some Introductions to people who care about the Topics of Dehumidifiers and Carpet Cleaning?
[2024-4-26. : 6:49 pm]
Vrael -- Perhaps even here I on the StarEdit Network I could look for some Introductions.
[2024-4-26. : 6:48 pm]
Vrael -- On this Topic, I could definitely use some Introductions.
Please log in to shout.


Members Online: Oh_Man