Integer to Real? Real to Integer?

xPass

All aboard the xPass Express!
Reaction score
26
I have browsed through certain threads and tutorials, but I have yet to find an answer to this:

1) Why do people use integer or real instead of vice-versa?

2) Which one is better and more efficient?

3) In what way are they?

4) What's the point of converting integer to real in skills?

5) What is String to Real?
 

DioD

New Member
Reaction score
57
1) why people drink coffe or tea instead of vice-versa?
2) Which one is better and more efficient?

...

open wikipedia and read what is integer and what is real.
 

Jedi

New Member
Reaction score
63
1-With some functions, you need to use reals, some of them you need to use integers.

2-Using integers easier if you don't need reals.

3-Integers are normal numbers:
1,2,3,4,5,6,7,0,-100,25063,-99999.

Reals are numbers with decilmal:
1.50, 3.45, 7.4301, -5.000, 9.500, 0.000

4-For example ,if you are going to use Unit - Damage action.You need to use a real number.Because a damage is real number.Lightning and unit colors real.

Trigger:
  • Player - Set Player 1 (Red) Current gold to 750

You can't add a player 750.35 gold.Gold is an integer number and it can't have decilmals.

5-It converts string to real =)Like a player chats -camera 1000, you convert 1000 to number and set players camera height.
 

skyblader

You're living only because it's illegal killing.
Reaction score
159
Integer is a whole number. Real can have decimals.

Which one is better, depends on what you want to use. If you want to use a number with decimal, you'd use real. Otherwise you'd use integer. If you see reals such as 1.00 or 2.00 used, it means the function itself requires real value. Such as distance, you can't enter an integer.

String to real basically converts a string, to a real number. For example the string is taken from entered chat string, the player types 5.50. If this string is converted to real, it becomes a real value of 5.50. (But personally I use integers for such conversion as real is not necessary, unless I want the player to enter the duration or distance.)

It's really just a preference, using integer or real instead won't really matter unless the function requires either one.

P.S. You REALLY should start searching for what you need, whether it is on this forum or not. JASS is just another scripting syntax, means there are other scripting syntax that are not in the world editor, which means you can find it on the net, such coding(just a little different).

jedi said:
3-Integers are normal numbers:
1,2,3,4,5,6,7,0,-100,25063,-99999.

Reals are numbers with decilmal:
1.50, 3.45, 7.4301, -5.000, 9.500, 0.000
Integers are whole numbers. 5.5 is also a normal number...

jedi said:
6-I can't believe you ask this questions :O

Everybody has to learn it some time, and why did you just double post o.o
 

xPass

All aboard the xPass Express!
Reaction score
26
Well, sorry for being a newb!! :D Thanks for teaching too...
 

staind25

TH.net Regular
Reaction score
7
They're fair questions. I think generally though, here's something else you should know:

For the world editor, you HAVE to use reals for some things, integers for others. This is just how the functions are set up for you.

In "real" programming, you generally have the choice between using real or integer. You could use an integer for doing something as simple as counting the days in a month, or a little more complex as doing arithmetic on an array index. You'd probably be better off using reals with stuff like money.

Hope that helps solidify the concept a bit :)

Edit: Just some additional info...another reason to keep reals and integers separate from each other is that you can't mix them when doing operations on them. For example, if you try to multiply a real and an integer together, certain programming languages will give you a compile error. 2 * 2.0, for example, is incorrect (However, some compilers are smart enough to know what you mean). 2.0 * 2.0 is correct, and so is 2 * 2. Alternatively, you can convert between reals and integers, which you addressed in your post. You might decide to convert one to another so that you could do arithmetic on them.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +1
  • V-SNES V-SNES:
    Happy Friday!
    +1

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top