It makes sense that structrefs and arrayrefs are not allowed to be returned, considering that there is no dynamic allocation support and considering that local variables go out of scope when the function has been ran through.
There's still possibilities to return arrayrefs. The passed parameter can be modified, and as such, the called constructs the array and passes it to the function to have it filled (but I assume you know of this already, oh well).
@Mille
I recall it for now isn't possible to do so. But I can imagine that it will be implemented either now in the beta or when the patch is released on the retail game version.
By multiplying two integers, you will always be certain that the product you get is an integer. This division thing is not limited to just starcraft 2, it's the way division works on computers if they aren't floating point numbers.
The real issue for you seemed to be that you took currentLife / (unitMaxLife * 200) resulted in a larger divisor, since the maxlife was multiplied by 200 before the division occured. What I assumed you would have wanted instead is currentLife / unitMaxLife * 200, or as you did it, 200 * currentLife / unitMaxLife. While it being integers, the latter choice is probably also the most reliable way to do it since multiplication first before the division will eliminate issues one can have with the integer division. But it all depends of what you want in the first place.
Eg, compare 11 / 10 * 20 and 20 * 11 / 10.
The first will result in 1 * 20 = 20
and the second 220 / 10 = 22
The first example happen to have given integer division rounding "errors" while the latter did not.
In calculations * and / are having the same priority when they're not encapsulated in parentheses. Without them the calculation will simply be calculated going from left to right in the expression. If the numbers would have been chosen to be numbers where a division between them would not round the result, or if it would have been floating-point numbers, then the order of * and / would not matter.
hmm, from what I am reading 1 / 10 should equal .1 but it wants it to be a real number so it rounds it to 0.
Well, if 1 is an integer and 10 is an integer, then the result in an integer, always, unless converted along the way. But it looks like your issue was another thing all along, nevertheless. Good you got it solved!
It looks to me like it is due to all your values are integers. When programming, an integer divided by another integer is not going to yield a floating point number. Example: 1 / 10 will yield 0 instead of 0.1.
So essentially, use floating point aritmetics if you want a division to give a non-int result. Change default life to a real instead of integer, for instance.
Heh, and this is also one thing that bugs me with using the trigger editor, since it gets a bit messy with all those dialog boxes where you need to change from integer to real and back again, and similar.
What you could do is also:
Int( currentLife / (defaultLife * 200.0))
changing the 200 to 200.0 should allow the division to work later. But since the retrieved health is of floating type (real) anyway, I don't see why the variables would not be reals.
Oh well, that was a bit much of yapping of me, I guess. But hope it helps!
A full list of galaxy changes since the previous arcade beta can be found here (side-by-side view on the individual source files might give a better overview).
To sum it up, there are a few new natives:
nativeintDialogControlHookupUnitStatus(inttype,stringinTemplate,unitinUnit);nativeboolGameDataIsFullyDownloaded(intplayer);nativevoidTransmissionSourceSetStreamingAllowed(transmissionsourcesource,boolallowed);// Generic trigger event that can be sent via scriptnativevoidTriggerSendEvent(stringname);nativevoidTriggerAddEventGeneric(triggert,stringname);nativestringEventGenericName();nativevoidTriggerDebugEnableType(inttype,boolenable);// - When a unitref within an event refers to a variable with a null value, by default this is also// treated as "any unit". However, if UnitEventSetNullVariableInvalid is set to true, then null// variable refs within events are treated as "no unit" instead, meaning that the event will never// fire.//nativevoidUnitEventSetNullVariableInvalid(boolinVal);constintc_syncFrameTypeStatusUI=35;constintc_syncFrameTypeLast=35;
If anyone is loking for the complete list of new natives (only in natives.galaxy for now) between the previous retail version and the initial arcade version, they can be found here (text file) collected by JademusSreg or here (repository).
No; I advertise on the forums to sell gear and gold. I send a paypal invoice that explains terms of the sale; then they send me money, then I send the item. I screen record the whole thing to ensure they cannont claim they were never given their item/gold; and I suggest to them to screen record if they believe I will not give them the item/gold. There really hasnt been much of a hassle though; most people know what they are doing when they are buying gold; and have trust in the system.
Not to be "that guy", and offtopic, but isn't what you are doing illegal? You're making profit of a game you didn't make or own the rights to, without conscent of Blizzard. The whole idea with the RMAH is not only to make transactions between players more secure but also to let Blizzard gets an additional share of every deal being made.
Not to mention you are selling diablo 3 accounts as of you were a third party seller.
Subsistence has since a while back put their project on hold. But yeah perhaps it will be more intriguing now for them to continue. They did say however, that their development of Subsistence has not been in vain, since they now further expanded their rts-idea to become a game (outside of starcraft) for multi-touch-devices.
Since you're arguing is only going back and forward, why not spend the time to send them an email about what you like and don't like with the new arcade? Do mock-ups, or whatever, as long as you have a valid point with what you are trying to say. It's clear that they do want feedback in the beta phase now, considering they revealed an email address for it. When they decide to roll it the beta out later on the normal servers, it might be too late, or take too long time for them to change it again.
Mother's day isn't until the fourth Sunday in May here. So I guess I live without calling my mom for a couple of weeks more (quite frankly I spoke with my mom today anyway, but not about that ;) ).
0
@Renee2islga: Go
It makes sense that structrefs and arrayrefs are not allowed to be returned, considering that there is no dynamic allocation support and considering that local variables go out of scope when the function has been ran through. There's still possibilities to return arrayrefs. The passed parameter can be modified, and as such, the called constructs the array and passes it to the function to have it filled (but I assume you know of this already, oh well).
@Mille
I recall it for now isn't possible to do so. But I can imagine that it will be implemented either now in the beta or when the patch is released on the retail game version.
0
By multiplying two integers, you will always be certain that the product you get is an integer. This division thing is not limited to just starcraft 2, it's the way division works on computers if they aren't floating point numbers.
The real issue for you seemed to be that you took currentLife / (unitMaxLife * 200) resulted in a larger divisor, since the maxlife was multiplied by 200 before the division occured. What I assumed you would have wanted instead is currentLife / unitMaxLife * 200, or as you did it, 200 * currentLife / unitMaxLife. While it being integers, the latter choice is probably also the most reliable way to do it since multiplication first before the division will eliminate issues one can have with the integer division. But it all depends of what you want in the first place.
Eg, compare 11 / 10 * 20 and 20 * 11 / 10. The first will result in 1 * 20 = 20 and the second 220 / 10 = 22 The first example happen to have given integer division rounding "errors" while the latter did not.
In calculations * and / are having the same priority when they're not encapsulated in parentheses. Without them the calculation will simply be calculated going from left to right in the expression. If the numbers would have been chosen to be numbers where a division between them would not round the result, or if it would have been floating-point numbers, then the order of * and / would not matter.
0
Well, if 1 is an integer and 10 is an integer, then the result in an integer, always, unless converted along the way. But it looks like your issue was another thing all along, nevertheless. Good you got it solved!
0
It looks to me like it is due to all your values are integers. When programming, an integer divided by another integer is not going to yield a floating point number. Example: 1 / 10 will yield 0 instead of 0.1. So essentially, use floating point aritmetics if you want a division to give a non-int result. Change default life to a real instead of integer, for instance.
Heh, and this is also one thing that bugs me with using the trigger editor, since it gets a bit messy with all those dialog boxes where you need to change from integer to real and back again, and similar.
What you could do is also: Int( currentLife / (defaultLife * 200.0)) changing the 200 to 200.0 should allow the division to work later. But since the retrieved health is of floating type (real) anyway, I don't see why the variables would not be reals.
Oh well, that was a bit much of yapping of me, I guess. But hope it helps!
0
A full list of galaxy changes since the previous arcade beta can be found here (side-by-side view on the individual source files might give a better overview).
To sum it up, there are a few new natives:
If anyone is loking for the complete list of new natives (only in natives.galaxy for now) between the previous retail version and the initial arcade version, they can be found here (text file) collected by JademusSreg or here (repository).
0
It seems the patch archives aren't saved in the same way as they were before. Do anyone have any idea where they can be located?
Edit: Nvm, found it right there in the Update folder.
0
Not to be "that guy", and offtopic, but isn't what you are doing illegal? You're making profit of a game you didn't make or own the rights to, without conscent of Blizzard. The whole idea with the RMAH is not only to make transactions between players more secure but also to let Blizzard gets an additional share of every deal being made.
Not to mention you are selling diablo 3 accounts as of you were a third party seller.
0
If so, then you should have begun already:P
0
@Karawasa: Go
Subsistence has since a while back put their project on hold. But yeah perhaps it will be more intriguing now for them to continue. They did say however, that their development of Subsistence has not been in vain, since they now further expanded their rts-idea to become a game (outside of starcraft) for multi-touch-devices.
Since you're arguing is only going back and forward, why not spend the time to send them an email about what you like and don't like with the new arcade? Do mock-ups, or whatever, as long as you have a valid point with what you are trying to say. It's clear that they do want feedback in the beta phase now, considering they revealed an email address for it. When they decide to roll it the beta out later on the normal servers, it might be too late, or take too long time for them to change it again.
0
For those who haven't seen it, the new debugger is pretty neat. It's useful, even for galaxy coders now.
0
Mother's day isn't until the fourth Sunday in May here. So I guess I live without calling my mom for a couple of weeks more (quite frankly I spoke with my mom today anyway, but not about that ;) ).
0
@Renee2islga: Go
Ah yeah:p They still have some other keywords not highlighted, such as color. Did you find a way to get array references to work?
0
@Renee2islga: Go That's great! How did you even find out that syntax?
0
"photocopy - a photographic copy of written or printed or graphic work". Whether that means it's physical or digital, I don't know.
0
And aside from that, the agreement beta people accepted mentions that photocopies of the game/editor is not allowed.
Edit: Well, that's how I interpreted it, anyway.