I want to display a value of an integer into a dialog. I cant find any options to add Integers into a dialog. Is there maybe a custom code to add into the
dialog text itself? For example <int XYZ> ? That would be the easiest way i guess.
Now i tried a work around where i Upgrade some not used Units Stats for example the "starting energy", then i use the "data ref" function in the dialog box itself to read the value of the starting energy of that unit. For some weird reason now the upgrade doesnt work unless i go down for something about max 100 upgrade lvls. Another point is that the Dialog does not seems to read the updated value by the upgrade. It just shows 0 all the time, When i add a text chat message, reading the same value it shows me 100. so its working here but not in the dialog box?
I spend the last 10 hours to figure out whats going on here but i cannot find a solution.
In the End i just want to add integers into my dialog. So the dialog shows variable unit stats.
A dialog is basically just a master window. You need a dialog item, label for text, to display objects like what your looking for within the dialog itself.
Mh of cause i have already a dialog item :) I can display dialogs (text, pictures) already and its working fine. But how do i add integer values into a dialog? ^^
I mean it like this......
UNIT HP: "integer"
so that i can combine text and global/local integers....
or for another example: when u want to give a Wave message very new wave with only one Dialog Item
Next Wave : 1
Next Wave : 2
so the dialog item uses an integer which tell the Wave number. U dont want to make 100 dialogs for each wave...
Hey Rut, thanks for your idea. This is a workaround which is not working in my case i guess.
I have 1 Dialog label which includes something like this:
SPECIAL ROUND
HP + 20
Speed + 2%
DMG + 2
Your work around is very limited in its usage. I only can write 1 text and add 1 integer right behind it as i think, please correct me if i am wrong.
If i would use your idea, i would be forced to use multiple Dialog labels which all needs to get a correct position.
the % behind the Speed is not possible too without creating an extra dialog label then too i guess.
I got a working thing now.
I did it like i mentioned in the first post:
1 Dialog, 1 Dialog item "label"
Upgrade changes a not used Units Stats, which i can refer right into the dialog item itself by using the INSERT option. Looks like this:
Only one problem is there, this will only work for something around 100 upgrades.
I thought there might be an easier way to just include an integer in a dialog. maybe there isnt, which is pretty sad. Cant believe there is no function to make bring a string/integer/real into a dialog item label, so it changes everytime the string/integer/real changes...
Well, anyway, i do have what i searched for in some way, thanks guys ^^
Your work around is very limited in its usage. I only can write 1 text and add 1 integer right behind it as i think, please correct me if i am wrong.
I think you are wrong. What stops you from concatenating multiple texts together separated by a new line character?
Quote:
I thought there might be an easier way to just include an integer in a dialog. maybe there isnt, which is pretty sad. Cant believe there is no function to make bring a string/integer/real into a dialog item label, so it changes everytime the string/integer/real changes...
You do not understand how computers work? Integers and fixed are passed by value based on the expression given as the argument of calls. Strings are immutable so cannot change once created. Once something is given to a dialog item it will use the value provided at time of call, as expected by the interface declaration.
Even if variable references were supported by the API for dialogs, it still does not mean it would update when the variable changes. What would instruct the dialog to redraw?
Ya your right i can just add a new line,
but as i said, i can only go like "TEXT" + "INT" and not "TEXT" + "INT" + "TEXT" right?
Mmmmh yes, if you define my knowledge about computer out of this one then i dont know how computers do work :D
Anyway, as i said it seems to work that the dialog read the value on that field everytime he creates the Dialog item. So what is your point anyway?
I dont want to discuss about the logic of a computer now. It does work so why not read direct from an integer, instead of the
database value?
So you want to tell me, that it is possible to change a values number by an update, which is readable by the dialog, but the dialog couldnt read a value which is in the trigger editor instead of the data editor? Doesnt sound logic to me...
Ya your right i can just add a new line, but as i said, i can only go like "TEXT" + "INT" and not "TEXT" + "INT" + "TEXT" right?
No? There is no limit to text concatenation outside of some really massive hard-coded limit (order of magnitude likely in the ten thousand characters).
Blizzard made this clear in the native file...
Quote:
string, text + operator will concatenate the strings or text
You can add to your text as many text expressions as you want. You could even use a loop to add a variable number of such expressions. If you want simply "TEXT" + "INT" + "TEXT" then go ahead and do it. In GUI you might need some form of "multiple concatenation" element to do this however you can always use a simple custom script piece or custom expression to also do it if one is not available.
Quote:
It does work so why not read direct from an integer, instead of the database value?
I have no idea what you are talking about. Integers and fixed are 32 bit singed quantities so have no human representation to them. They have to be pushed through some form of localization routine to convert them into a human readable format. In SC2 anything human readable is represented as a text. The only difference between string and text is that string is fully deterministic where as text is not (so different localizations and machines might have different text produced).
The SC2 text engine supports a number of mark-up features. One of these features is the catalog reference tags which will automatically substitute in certain values every time the text is parsed. The major restriction with them is that the text has to be re-parsed for changes to be seen which is why upgrades and catalog native calls making changes to a catalog value will not reflect those changes immediately in a active tooltip. Instead the user will have to close the tooltip and re-activate it for the catalog changes to be reflected. Depending on how dialog items parse text this could mean the value shown for a catalog reference might not be updated for a considerable time.
Quote:
So you want to tell me, that it is possible to change a values number by an update, which is readable by the dialog, but the dialog couldnt read a value which is in the trigger editor instead of the data editor? Doesnt sound logic to me...
This is making very little sense...
Obviously you can change any value you want when you update the map. You could even change the entire map if you wished. What does this have to do with your problem?
I am not sure why a variable reference tag was not added to the text parse system. It might be due to text being finished before the Galaxy virtual machine was finalized or maybe there were security concerns for references into galaxy memory space. It could even be that after compile time the game no longer tracks variable names outside of debug mode.
In any case with dialogs you might want to push out changes as they occur, something that is not possible with simple references for the reason I explained above.
You actually can combine as many texts and integers and whatnot together as you want in the dialog label, there's no limit. If you use the function Combine Text Multiple, you can just keep adding more and more. You can set it up like:
Combine Text Multiple:
"HP + "
[Function] Convert Integer to Text (hpvariable)
<n/><n/> (these put in the spaces, I think I'm remembering those right)
"Speed + "
[Function] Convert Integer to Text (speedvariable)
" %"
</n></n>
etc.
It is true that working with dialogs is clunky and doesn't feel flexible, but once you get used to them it's not so bad. Good luck!
rut
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Hey Guys,
I want to display a value of an integer into a dialog. I cant find any options to add Integers into a dialog. Is there maybe a custom code to add into the dialog text itself? For example <int XYZ> ? That would be the easiest way i guess.
Now i tried a work around where i Upgrade some not used Units Stats for example the "starting energy", then i use the "data ref" function in the dialog box itself to read the value of the starting energy of that unit. For some weird reason now the upgrade doesnt work unless i go down for something about max 100 upgrade lvls. Another point is that the Dialog does not seems to read the updated value by the upgrade. It just shows 0 all the time, When i add a text chat message, reading the same value it shows me 100. so its working here but not in the dialog box?
I spend the last 10 hours to figure out whats going on here but i cannot find a solution.
In the End i just want to add integers into my dialog. So the dialog shows variable unit stats.
Example : Unit HP: 50 Unit DMG : 10 ....
TY for your TIME
A dialog is basically just a master window. You need a dialog item, label for text, to display objects like what your looking for within the dialog itself.
@hobbidude: Go
Mh of cause i have already a dialog item :) I can display dialogs (text, pictures) already and its working fine. But how do i add integer values into a dialog? ^^
I mean it like this...... UNIT HP: "integer"
so that i can combine text and global/local integers....
or for another example: when u want to give a Wave message very new wave with only one Dialog Item
Next Wave : 1 Next Wave : 2
so the dialog item uses an integer which tell the Wave number. U dont want to make 100 dialogs for each wave...
Hello Iamaddicted,
What you'll want to do is to create a dialog item of type "Label" where you want this text to appear and save it as a variable (let's say "dlabel").
(Assuming you have the Integer you want displayed (unit health, for example) stored as a variable titled "uhealth.")
Then have a trigger update it with the action "Set Dialog Item Text." You'll to set it up like this:
Set dlabel text to (combine multiple) "Unit Hp: " + [function] Convert Integer to Text (uhealth)
Hopefully that helps. I've been making up my notation as I go so it's very sloppy, but that's the concept for how I'd do it.
Happy mapping,
rut
@rutegar: Go
Hey Rut, thanks for your idea. This is a workaround which is not working in my case i guess.
I have 1 Dialog label which includes something like this:
SPECIAL ROUND
HP + 20
Speed + 2%
DMG + 2
Your work around is very limited in its usage. I only can write 1 text and add 1 integer right behind it as i think, please correct me if i am wrong.
If i would use your idea, i would be forced to use multiple Dialog labels which all needs to get a correct position. the % behind the Speed is not possible too without creating an extra dialog label then too i guess.
I got a working thing now.
I did it like i mentioned in the first post:
1 Dialog, 1 Dialog item "label" Upgrade changes a not used Units Stats, which i can refer right into the dialog item itself by using the INSERT option. Looks like this:
<c val="FFFF80">Speed +</c><d ref="Unit,CommentatorBot1,EnergyMax"/>%
Only one problem is there, this will only work for something around 100 upgrades.
I thought there might be an easier way to just include an integer in a dialog. maybe there isnt, which is pretty sad. Cant believe there is no function to make bring a string/integer/real into a dialog item label, so it changes everytime the string/integer/real changes...
Well, anyway, i do have what i searched for in some way, thanks guys ^^
I think you are wrong. What stops you from concatenating multiple texts together separated by a new line character?
You do not understand how computers work? Integers and fixed are passed by value based on the expression given as the argument of calls. Strings are immutable so cannot change once created. Once something is given to a dialog item it will use the value provided at time of call, as expected by the interface declaration.
Even if variable references were supported by the API for dialogs, it still does not mean it would update when the variable changes. What would instruct the dialog to redraw?
@ImperialGood: Go
Ya your right i can just add a new line, but as i said, i can only go like "TEXT" + "INT" and not "TEXT" + "INT" + "TEXT" right?
Mmmmh yes, if you define my knowledge about computer out of this one then i dont know how computers do work :D
Anyway, as i said it seems to work that the dialog read the value on that field everytime he creates the Dialog item. So what is your point anyway? I dont want to discuss about the logic of a computer now. It does work so why not read direct from an integer, instead of the database value?
So you want to tell me, that it is possible to change a values number by an update, which is readable by the dialog, but the dialog couldnt read a value which is in the trigger editor instead of the data editor? Doesnt sound logic to me...
No? There is no limit to text concatenation outside of some really massive hard-coded limit (order of magnitude likely in the ten thousand characters).
Blizzard made this clear in the native file...
You can add to your text as many text expressions as you want. You could even use a loop to add a variable number of such expressions. If you want simply "TEXT" + "INT" + "TEXT" then go ahead and do it. In GUI you might need some form of "multiple concatenation" element to do this however you can always use a simple custom script piece or custom expression to also do it if one is not available.
I have no idea what you are talking about. Integers and fixed are 32 bit singed quantities so have no human representation to them. They have to be pushed through some form of localization routine to convert them into a human readable format. In SC2 anything human readable is represented as a text. The only difference between string and text is that string is fully deterministic where as text is not (so different localizations and machines might have different text produced).
The SC2 text engine supports a number of mark-up features. One of these features is the catalog reference tags which will automatically substitute in certain values every time the text is parsed. The major restriction with them is that the text has to be re-parsed for changes to be seen which is why upgrades and catalog native calls making changes to a catalog value will not reflect those changes immediately in a active tooltip. Instead the user will have to close the tooltip and re-activate it for the catalog changes to be reflected. Depending on how dialog items parse text this could mean the value shown for a catalog reference might not be updated for a considerable time.
This is making very little sense...
Obviously you can change any value you want when you update the map. You could even change the entire map if you wished. What does this have to do with your problem?
I am not sure why a variable reference tag was not added to the text parse system. It might be due to text being finished before the Galaxy virtual machine was finalized or maybe there were security concerns for references into galaxy memory space. It could even be that after compile time the game no longer tracks variable names outside of debug mode.
In any case with dialogs you might want to push out changes as they occur, something that is not possible with simple references for the reason I explained above.
Hey IAmAddicted,
You actually can combine as many texts and integers and whatnot together as you want in the dialog label, there's no limit. If you use the function Combine Text Multiple, you can just keep adding more and more. You can set it up like:
Combine Text Multiple:
"HP + "
[Function] Convert Integer to Text (hpvariable)
<n/><n/> (these put in the spaces, I think I'm remembering those right)
"Speed + "
[Function] Convert Integer to Text (speedvariable)
" %"
</n></n>
etc.
It is true that working with dialogs is clunky and doesn't feel flexible, but once you get used to them it's not so bad. Good luck!
rut