This is just a personnal project to learn the Galaxie Editor. I want to creat a basic calculator with button 0-9 and + - / * operations. I'm really confuse about how to do... I'm trying, but I'm stuck somewhere about a variable.
Everybody know that if you clic on a number on a calculator, it will show up the number, ex: 9. If you clic it again it will show: 99 and etc. But, by using variables, let's say my first value is 9 and I want it to become 99, I don't want it to show 18, 0, 1 or 81. I want it to combine the actual value with the new 9. But, when you try to Set variable, there is no combine possibilities. Like to combine multiple numbers to create another without doing math operations . So, I tryed to combine it with text. The text work almost perfectly, but you can't come back into a real value from text. Also, if you want it to show some decimals, it will combine the text into something like 0.000.00 what is actually 0.00 and 0.00.
I've been working around to make it work but i don't have any clue how to continute. Anybody know if there is a kind of function to combine numbers to set a variable? Or juste any tutorial on making a calculator? xD
Here is a kind of example about how works my triggers... Um, if you don't understand, it's fine, I just want some tip or better way to do =)
Total value: Final number
Value 1: first number
Value 2: second number
Text: text that show into the calculator screen
Button 1 pressed ->set Value 1 = 1 -> set dialog item text (combine: Total value and Value 1) [10] -> trying to set Total value = Text
Then, (if value 1 finally get the value of text). If the button is pressed again it will redo the operation, so Total value will have 3 numbers.
If an operator button is pressed like + - / * , then it will set Value 1 to Total Value and the previous operations will be with Value 2.
Once you press the equal button, I want it to set Total Value with the operation Value 1 + - * or / Value 2. This done, it will just set the Text item to Total Value.
Problems at the moment: no combine through set variable. And you can't remember the operation asked in the middle of the operation (ex: 10 + 10) Edit: you can use anything basic like an integer and make it be 1 instead of 0 if you choosed the + and another for the -, another for / and then *.
Before trying to go farter, I had a working version where the Value could only be 1 number. You clic ex: 7 and then it pass to Value 2, you choose the number and then the operator. if you wanted to multiply 3 by 2, you press 3 (value 1) then 2 (value 2) then the multiplier.
Anyway, if you get lost through my triggers and/or my explications / problems / whatever, it is normal. Caus I'm alot confuse also. I though it would be easier... This ain't easy. Help?
you would need a variable to know whether your numbers are in the 10's, 100's, 1000's, so you would need to count button presses in between +-*/ syntax.
then apply the above formula that bone quoted as needed
Thanx for help =D I finally got a fully working calculator. There is just something not fun... A real value can't be very high... something like 1 000 000 is not possible. It starts going into negative randomly everytimes you add new number. Also, I'm sure there is a better way to do a calculator than what I did. So, I'm going to ask generally, does anyone know how I could optimise my trigger ; have less but work better?
I used few integer variable as loop with 0 or 1. I don't know wich kind of variable can be turn as a true or fals, but, by doing it with integer like I did, you can have as much as you want intervals, 0, 1, 2, 3.... That's how I was doing variables in sc1, by using minerals as integer for a repeatable loop.
I wanted also to add a "Equal plus" "Equal minus"... This happend when you do an operation ex: 6/2=3 and instead of doing = you press another operation. What normally happend on a real calculator is it keeps the result as the first value and wait for the second. I tryed but, I wanted to go sleep so, I stopped and just desabled it.
@nevjmac: Go
Well, I do not have any variables for the position. The way that work the triggers, if you do: "Set Value 1 = ((Value 1*10) + NumberOfTheButtonPressed)" you will always be fine.
I started to write a response, but I am just too damn tired. Send me a PM as a reminder, and if you haven't gotten a response I will look into answering your question tomorrow.
everything in starcraft is saved in 19 bit variables. 524288 is the maximum value. You have to split it into multiple integers if you want to calculate with higher numbers
everything in starcraft is saved in 19 bit variables. 524288 is the maximum value. You have to split it into multiple integers if you want to calculate with higher numbers
Is this the same thing with units hp, damage, etc? If it is, how could you make a unit have 1 milion hp? I don't have any clue how we could modify the units hp with many integers... And even only for a basic calculator... I don't have more idea about how to show 1 milion with multiple integers xD
And also, you should specify, starcraft "2" because starcraft "1" biggest value is 65 535 and 255 for some other things.
It looks logic and easy... But I'm actually not there in my Galaxy understanding xD I would need a demonstration map to understand xD
Also, is there a maximum decimals number? There is a maximum of 524k, but could it be 523k.23095498120948029458023850245023758024758023740982340981052478 ? xD
This just ruined my hopes of a disgaea clone on sc2. By disgaea clone I mean the over the top levels and damage and everything. Over NINE THOUSAND is level five status in disgaea. OVER NINE BILLION is like level 50 with up to 999 levels per character and then super combos together for even higher. Such a great game.
@Keyesz you can only work with behaviors reducing the dmg. if a unit only takes 10% dmg, it has basically 1000000 hp as 100000 is the hardcoded cap for whatever reason
@Scbroodsc2 take a look at decimal values in machines ;) they are stored like this:
1 bit +-
some bits digits 5240
some bits exponent 3
- 5240x10^3
don't know the exact values sc2 uses
edit: added a simple addition math example. you can do almost every math this way, you just need the logic to split it properly
This is just a personnal project to learn the Galaxie Editor. I want to creat a basic calculator with button 0-9 and + - / * operations. I'm really confuse about how to do... I'm trying, but I'm stuck somewhere about a variable.
Everybody know that if you clic on a number on a calculator, it will show up the number, ex: 9. If you clic it again it will show: 99 and etc. But, by using variables, let's say my first value is 9 and I want it to become 99, I don't want it to show 18, 0, 1 or 81. I want it to combine the actual value with the new 9. But, when you try to Set variable, there is no combine possibilities. Like to combine multiple numbers to create another without doing math operations . So, I tryed to combine it with text. The text work almost perfectly, but you can't come back into a real value from text. Also, if you want it to show some decimals, it will combine the text into something like 0.000.00 what is actually 0.00 and 0.00.
I've been working around to make it work but i don't have any clue how to continute. Anybody know if there is a kind of function to combine numbers to set a variable? Or juste any tutorial on making a calculator? xD
Here is a kind of example about how works my triggers... Um, if you don't understand, it's fine, I just want some tip or better way to do =)
Total value: Final number
Value 1: first number
Value 2: second number
Text: text that show into the calculator screen
Button 1 pressed ->set Value 1 = 1 -> set dialog item text (combine: Total value and Value 1) [10] -> trying to set Total value = Text
Then, (if value 1 finally get the value of text). If the button is pressed again it will redo the operation, so Total value will have 3 numbers. If an operator button is pressed like + - / * , then it will set Value 1 to Total Value and the previous operations will be with Value 2.
Once you press the equal button, I want it to set Total Value with the operation Value 1 + - * or / Value 2. This done, it will just set the Text item to Total Value.
Problems at the moment: no combine through set variable. And you can't remember the operation asked in the middle of the operation (ex: 10 + 10) Edit: you can use anything basic like an integer and make it be 1 instead of 0 if you choosed the + and another for the -, another for / and then *.
Before trying to go farter, I had a working version where the Value could only be 1 number. You clic ex: 7 and then it pass to Value 2, you choose the number and then the operator. if you wanted to multiply 3 by 2, you press 3 (value 1) then 2 (value 2) then the multiplier.
Anyway, if you get lost through my triggers and/or my explications / problems / whatever, it is normal. Caus I'm alot confuse also. I though it would be easier... This ain't easy. Help?
Working on projects:
it so ridiculous easy to do the calculator combine ;)
[9]
=9
[9]
=9*10+9 = 99
yep a few variables. would be needed
you would need a variable to know whether your numbers are in the 10's, 100's, 1000's, so you would need to count button presses in between +-*/ syntax.
then apply the above formula that bone quoted as needed
Or you can just use a string for the input and convert to numbers when you actually calculate something.
Can't you store both in a variable, convert them to strings, add, then convert back into an integer?
Thanx for help =D I finally got a fully working calculator. There is just something not fun... A real value can't be very high... something like 1 000 000 is not possible. It starts going into negative randomly everytimes you add new number. Also, I'm sure there is a better way to do a calculator than what I did. So, I'm going to ask generally, does anyone know how I could optimise my trigger ; have less but work better?
I used few integer variable as loop with 0 or 1. I don't know wich kind of variable can be turn as a true or fals, but, by doing it with integer like I did, you can have as much as you want intervals, 0, 1, 2, 3.... That's how I was doing variables in sc1, by using minerals as integer for a repeatable loop.
I wanted also to add a "Equal plus" "Equal minus"... This happend when you do an operation ex: 6/2=3 and instead of doing = you press another operation. What normally happend on a real calculator is it keeps the result as the first value and wait for the second. I tryed but, I wanted to go sleep so, I stopped and just desabled it.
@nevjmac: Go Well, I do not have any variables for the position. The way that work the triggers, if you do: "Set Value 1 = ((Value 1*10) + NumberOfTheButtonPressed)" you will always be fine.
Working on projects:
@Scbroodsc2: Go
I started to write a response, but I am just too damn tired. Send me a PM as a reminder, and if you haven't gotten a response I will look into answering your question tomorrow.
Great to be back and part of the community again!
@TacoManStan: Go
I'll wait until tomorrow caus I am also tired and going to bed just like..... um, now. xD
Working on projects:
everything in starcraft is saved in 19 bit variables. 524288 is the maximum value. You have to split it into multiple integers if you want to calculate with higher numbers
@b0ne123: Go
.....19 bit?..... "Everything?"
@grenegg: Go
Yes, every single value is stored in a 19 bit integer. Literally everything, imagine if it was not XO. (The file sizes)
Great to be back and part of the community again!
Is this the same thing with units hp, damage, etc? If it is, how could you make a unit have 1 milion hp? I don't have any clue how we could modify the units hp with many integers... And even only for a basic calculator... I don't have more idea about how to show 1 milion with multiple integers xD
And also, you should specify, starcraft "2" because starcraft "1" biggest value is 65 535 and 255 for some other things.
Working on projects:
of course i meant sc2. and yeah hp, damage, almost everything caps at 524k
splitting numbers into multiple integers is easy. just use 1 for every digit or on every 99999.
int a = 1
int b = 0
results in 100000
I'm doing this method to store kills in the bank.
@b0ne123: Go
It looks logic and easy... But I'm actually not there in my Galaxy understanding xD I would need a demonstration map to understand xD
Also, is there a maximum decimals number? There is a maximum of 524k, but could it be 523k.23095498120948029458023850245023758024758023740982340981052478 ? xD
Working on projects:
This just ruined my hopes of a disgaea clone on sc2. By disgaea clone I mean the over the top levels and damage and everything. Over NINE THOUSAND is level five status in disgaea. OVER NINE BILLION is like level 50 with up to 999 levels per character and then super combos together for even higher. Such a great game.
@Keyesz you can only work with behaviors reducing the dmg. if a unit only takes 10% dmg, it has basically 1000000 hp as 100000 is the hardcoded cap for whatever reason
@Scbroodsc2 take a look at decimal values in machines ;) they are stored like this:
1 bit +-
some bits digits 5240
some bits exponent 3
- 5240x10^3
don't know the exact values sc2 uses
edit: added a simple addition math example. you can do almost every math this way, you just need the logic to split it properly