can't figure out how to remove digits after decimal

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
AlienRobotGhost
Posts: 50
Joined: 04 Nov 2016, 07:15

can't figure out how to remove digits after decimal

13 Mar 2018, 02:33

;I get that i'm an idiot, so there's no need to point that out.......The help file is NOT "helping" me, and I am confused as fuck!
; I just want this code to say "TIMER SET FOR 24 HOURS"
; I understand that this is infant level shit, but that's the amount of skills I have right now
; Will someone please powder my ass for me........?




waitperiod = 8640000
waittime := waitperiod/360000
msgbox, TIMER SET FOR %waittime% HOURS
exitapp
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: can't figure out how to remove digits after decimal

13 Mar 2018, 02:53

Hello.
Maybe try round and please see variables and expressions and concept.

Cheers.

Edit: Changed link to round to use url tags instead of docs tags since they seem broken atm
Last edited by Helgef on 13 Mar 2018, 03:12, edited 1 time in total.
AlienRobotGhost
Posts: 50
Joined: 04 Nov 2016, 07:15

Re: can't figure out how to remove digits after decimal

13 Mar 2018, 03:00

Did you not read where I said that the help file is inadequate? There are no examples for me to learn from!

(Damn I miss wolf_II, he would actually help me instead of just pissing on me)

........Thanks anyway friend
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: can't figure out how to remove digits after decimal

13 Mar 2018, 03:10

Maybe the link to round didn't work for you. Please try again. There are examples.

And in celebration of wolf_II, I will give you an explicit example of its usage

Code: Select all

waitperiod = 8640000
waittime := round( waitperiod/360000 )		
msgbox, TIMER SET FOR %waittime% HOURS
exitapp
Cheers.
Edit: @ BoBo, cheers ☕.
Last edited by Helgef on 13 Mar 2018, 03:51, edited 2 times in total.
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: can't figure out how to remove digits after decimal

13 Mar 2018, 03:19

Well, supporters won't get motivated by the way you've used your wording. AHK isn't to blame that you seems not able to grasp its beginner friendly help file. Your self-proclaiming that you're an idiot is up to you, but you won't have to treat your supporters that way. And yes, there are already hundreds of forum threats around showing working examples using the Round()-command.
I've even created one yesterday. Good luck.

@Helgef, I doubt that a working link will change his/her attitude. Here we go for cut and paste instead of trial and error. Thx for your support :thumbup:
AlienRobotGhost
Posts: 50
Joined: 04 Nov 2016, 07:15

Re: can't figure out how to remove digits after decimal

13 Mar 2018, 03:48

Holy shit! It was seriously THAT easy?

The AHK help file on this subject is complete TRASH! The link you gave me just led me back to that trash again, so it was not an effective solution for me.........

I am not used to having to ask people for help, because wolf_II was always there to resolve my issues and sculpt my code to perfection without even having to think about it. He has not responded to me in quite a while.....I hope he is OK.

.......Anyway, thanks for your help friend!
icuurd12b42
Posts: 202
Joined: 14 Aug 2016, 04:08

Re: can't figure out how to remove digits after decimal

13 Mar 2018, 04:02

One would need to realise why round is needed in this case though.

Alien, you will be lost in many help files if you don't have experience under your belt to guide your thoughts... And a help file is not a "search and find solution" system, if you treat it as such you will never find anything to really help you in there. I always suggest people read the entire help file, take the 45 minutes, just so you have an idea what the possibilities are, comprehension of the content is not required, awareness of the content is... in order for your mind to formulate possible solution with less effort it needs to be aware or the possibilities. I'm betting you search for an exhausting amount of time for a solution. you might as well have spent that time cooling off and just skim over the entire thing.
Last edited by icuurd12b42 on 13 Mar 2018, 04:28, edited 1 time in total.
AlienRobotGhost
Posts: 50
Joined: 04 Nov 2016, 07:15

Re: can't figure out how to remove digits after decimal

13 Mar 2018, 04:06

If the help file was "beginner friendly", then it would have been friendly to ME, since I AM a beginner.........I'm not fond of your indirect insults either. That is NOT the way to influence a productive exchange of knowledge and ideas. I insult myself so that nobody else feels inclined to insult me. I NEVER insult people who are in my position or those who are generous enough to take the time to help me improve my position. Your lecture is truly discouraging since it accuses me of doing something that I am firmly against, and it does not focus on my topic, but instead it is directed at me personally.......

........Anyway, peace friend!
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: can't figure out how to remove digits after decimal

13 Mar 2018, 04:22

@icuurd12b42, that's the way it goes :thumbup:
icuurd12b42
Posts: 202
Joined: 14 Aug 2016, 04:08

Re: can't figure out how to remove digits after decimal

13 Mar 2018, 04:23

I can say that the help system is not beginner friendly, I been at this programming business for 30 years. it's a reference manual, and it is as friendly as a reference manual can be, which means it's made for people who know what they are looking for but unsure how to proceed, but there are many examples at the bottom of every feature which are very good to be aware of. If you want to bitch about how unfriendly it is, I'll give you the GUI section.

Just read it and respect it for what it is
Last edited by icuurd12b42 on 13 Mar 2018, 04:25, edited 1 time in total.
Johana
Posts: 189
Joined: 02 May 2017, 02:34

Re: can't figure out how to remove digits after decimal

13 Mar 2018, 04:25

icuurd12b42 wrote:I can say that the help system is not beginner friendly, I been at this programming business for 30 years. it's a reference manual, and it is a friendly as a reference manual can be, which means it's made for people who know what they are looking for but unsure how to proceed, but there are many examples at the bottom of every feature which are very good to be aware of. If you want to bitch about how unfriendly it is, I'll give you the GUI section.

Just read it and respect it for what it is
Agreed, I who know nothing about programming finds it extremly hard to understand what some things does.
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: can't figure out how to remove digits after decimal

13 Mar 2018, 06:15

Well, I've started with AHK around 2004. Chris Mallett had exactly those kind of users in mind (and has lost interest in AHK once AHK started to cope with COM(obj) etc). At that time he has provided a ton of exambles with every topic in AHKs help. That has watered down once the more complex stuff showed up. The problem nowadays is that a beginner expects to be able to deal with AHK's rocket-science features bc otherwise he/she isn't able to trigger the meanwhile more complex environment.
User avatar
Nwb
Posts: 444
Joined: 29 Nov 2016, 08:56

Re: can't figure out how to remove digits after decimal

13 Mar 2018, 07:45

The problem with round is that if you want 1.6 to be interpreted as 1, it interprets it as 2. If you want the decimal to just be neglected then use Floor () instead. It's in math functions as well, floor is for rounding down numbers like round is to round up.

We don't judge people when we're helping them. Everybody here is learning and learning is endless! Maybe not use profanity that much because even though this might seem complex.. we have younger users all the time.


Hey I haven't read the help file either but what I do is google search. There's a lot of threads in this forums and you should use that to your advantage! If you don't understand something then just ask! But honestly in my experience writing and testing is more effective than reading in terms of learning.

Won't hurt to sometimes go through the file though.
I am your average ahk newbie. Just.. a tat more cute. ;)
Johana
Posts: 189
Joined: 02 May 2017, 02:34

Re: can't figure out how to remove digits after decimal

13 Mar 2018, 07:53

BoBo wrote:Well, I've started with AHK around 2004. Chris Mallett had exactly those kind of users in mind (and has lost interest in AHK once AHK started to cope with COM(obj) etc). At that time he has provided a ton of exambles with every topic in AHKs help. That has watered down once the more complex stuff showed up. The problem nowadays is that a beginner expects to be able to deal with AHK's rocket-science features bc otherwise he/she isn't able to trigger the meanwhile more complex environment.
I actually don't think that beginner expects to be able to deal with "rocket-science features". Take me as an example. I got seriously no idea how to code except the extreme basics. I get an idea, and since I do not know the complexity (or lack of) of the code, I have no idea what I am asking for.

I asked a few months back about help to create a script that counts files and adds it into a gui and whatnot. Odlanir helped me with it and when I look at the code, yeah it's rocket-science alright. But for me, I have NO IDEA if it's easy tasks or complex tasks, just cause I don't know how to code.

That's why I do not agree that beginners like me really know what we're asking about. We have an idea, and you experts point us either in the right direction or if it's too complex for us, help us with the code if we can't manage.
User avatar
FanaticGuru
Posts: 1906
Joined: 30 Sep 2013, 22:25

Re: can't figure out how to remove digits after decimal

13 Mar 2018, 14:15

AlienRobotGhost wrote:Did you not read where I said that the help file is inadequate? There are no examples for me to learn from!
Not trying to slam on you AlienRobotGhost this is more about how people can help those who really need help.

But I am not sure how this can be much simpler and still be accurate:

Code: Select all

Value := Round(Number [, N])
Returns Number rounded to N decimal places.

If N is omitted or 0, Number is rounded to the nearest integer:

MsgBox, % Round(3.14)    ; Returns 3
It is far far from rocket-science to go from:
MsgBox, % Round(3.14) ; Returns 3
to this
waittime := round( waitperiod/360000 )

Maybe the help needs a help file to explain what this means: Value := Round(Number [, N]) but honestly anyone that has not read enough to understand that is not going to read a help on how to use the help.

At some point the user has to put forward at least a bare minimum of effort. Otherwise it is not a help forum but a code request forum. Which I admit I often just write the code for people if it is somewhat interesting for me to code as it is easier to just give someone the code than teach them how to code it themselves. I hope though that they will learn something from looking at my code and maybe improve on it in some way and in the process I might learn something also.

FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts
AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon
Hotstring Manager - Create and Manage Hotstrings
[Class] WinHook - Create Window Shell Hooks and Window Event Hooks

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: ArkuS, Descolada and 123 guests