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.
[07:46 am]
RIVE -- :wob:
[2024-4-22. : 6:48 pm]
Ultraviolet -- :wob:
[2024-4-21. : 1:32 pm]
Oh_Man -- I will
[2024-4-20. : 11:29 pm]
Zoan -- Oh_Man
Oh_Man shouted: yeah i'm tryin to go through all the greatest hits and get the runs up on youtube so my senile ass can appreciate them more readily
You should do my Delirus map too; it's a little cocky to say but I still think it's actually just a good game lol
[2024-4-20. : 8:20 pm]
Ultraviolet -- Goons were functioning like stalkers, I think a valk was made into a banshee, all sorts of cool shit
[2024-4-20. : 8:20 pm]
Ultraviolet -- Oh wait, no I saw something else. It was more melee style, and guys were doing warpgate shit and morphing lings into banelings (Infested terran graphics)
[2024-4-20. : 8:18 pm]
Ultraviolet -- Oh_Man
Oh_Man shouted: lol SC2 in SC1: https://youtu.be/pChWu_eRQZI
oh ya I saw that when Armo posted it on Discord, pretty crazy
[2024-4-20. : 8:09 pm]
Vrael -- thats less than half of what I thought I'd need, better figure out how to open SCMDraft on windows 11
[2024-4-20. : 8:09 pm]
Vrael -- woo baby talk about a time crunch
[2024-4-20. : 8:08 pm]
Vrael -- Oh_Man
Oh_Man shouted: yeah i'm tryin to go through all the greatest hits and get the runs up on youtube so my senile ass can appreciate them more readily
so that gives me approximately 27 more years to finish tenebrous before you get to it?
Please log in to shout.


Members Online: Roy