How do I removed the decimal point and the decimals

Get help using Construct 2

Post » Sun Feb 08, 2015 11:21 pm

jojoe wrote:In C# programming we call this little trick "casting". Casting happens when you change the type of variable. If it has a decimal point, the variable is a "float", if it is a whole number then it is an "integer".

You want to cast the Float into an integer. So there is an expression under system called int() , Anything in the "()" will be cast into an integer.

Other ways to cast are :str() for String, and float() for float.

int(random 1.2342,100.234234) will always return a whole number.



thanks @jojoe i understand now all that because i kinda learned it without even needing to, so... i solved the issue of the decimal my next problem is when i try to make the text write only 2 of the first numbers of the new hole rounded (or inted or floated number

as an example : i rounded or floated or inted doesnt matter what i use cause all they do is remove decimals all of them tested it like 1000 times so the resulting number will be something like 1200 lets say now in my text i want to show 1.2K that will be a number value / at 1000 because its a a number with a 3 , zeros so i want to get rid of the last 2 zeros and write up 1.2K as in 1.2k money,honey , oil gallons etc.


i solved it works now just, i used set variable= find(str(money), ".") then i call the set variable2=find(str(ValueLength), ".") then again setvariable3=find(str(ValueLength2), ".") then i set a last variable to float(left(str(money), (ValueLength3 + (3 +1)))) and then i setthetextto-" Account: $ "&ValueWithDecimal&"Bil." returns everything right if the vallue is =>then1bil but <=then999bil cause if i dont add this the c2 engine doesnt reconizes the range and i keep getting the wrong Bilion million, K, kbz, counts my diferent currencys in game.... so is there a plugin or a simple i mean simple code to do this without having to make it with those less then high then conditions? cause because of those i get like 10 lines per item cause i have like 10 different ranges and each event is composed out of 3 events and 2 subevents so i have 50 items that will require 5 events * 10 different ranges that will be 50 * 50 250 event codes only to code 1 part of those items and that isnt even usefull that much, only displays the money needed to upgrade , purchase and the income value of the items thats it and yea for each text type (price,income,stock so scratch that 250 event code lines its actually 3*50 * 50 thats 750 event lines to be coded for info display outside will kill my fps when i have all the items in idle activated, cause now they are triggered when i press a button but when idle mode is enabled then they will count add update every 0.02 and that will be over 700 events called in lerss then a second imagine that resource hog, the game will automatically crash... so its not a permanent solution what i did, i need a better one any ideeas?
B
78
S
23
G
69
Posts: 1,353
Reputation: 44,005

Post » Sun Feb 08, 2015 11:25 pm

i think il just make it look good till 1 point and then say hey u playd so far u can play more even if u dont see the numbers later right?!!!
Last edited by gamecorpstudio on Mon Feb 09, 2015 10:15 am, edited 1 time in total.
B
78
S
23
G
69
Posts: 1,353
Reputation: 44,005

Post » Sun Feb 08, 2015 11:55 pm

I was just trying to help.

Misquoting me with the Hannah Montana thing is really uncalled for, and will probably hinder other people from attempting to help you.
B
29
S
8
G
4
Posts: 767
Reputation: 5,985

Post » Mon Feb 09, 2015 10:17 am

jojoe wrote:I was just trying to help.

Misquoting me with the Hannah Montana thing is really uncalled for, and will probably hinder other people from attempting to help you.

sorry was a bad joke... i know .. it was just frustrating the lines i had to do.. cant seem to find any other work around this problem, unless i do the long and tedious work, sorry again you are a good person im just an idiot most of the times
B
78
S
23
G
69
Posts: 1,353
Reputation: 44,005

Previous

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 8 guests