It is currently March 29th, 2024, 11:38 am

Formula: Division by 0

Get help with creating, editing & fixing problems with skins
Judian81
Posts: 180
Joined: May 6th, 2021, 2:57 pm

Formula: Division by 0

Post by Judian81 »

hey hello,

i was working on a skin lately.

Code: Select all

[Variables]
'the height and width from the skin
formWidth=190
formHeight=185
;scale can be set to 3 times biggen the skin will be
formScale=1
;the path where all windows shortcuts are going to be
vPath="#CURRENTPATH#Shortcuts"
;do not change this. the skin itself will control this. this is as per se so you can scroll in the skin
vScrollIndex=0

ScrollbarHeight=(280*#formScale#)

;this here gets the file count in the given directorie, (in real there are 7 shortcuts)
[mFileCountParent]
;making use of the folderinfo plugin
Measure=Plugin
Plugin=FolderInfo
Folder=#vPath#\
InfoType=FileCount
DynamicVariables=1

;this is the crollbar
[MeterScrollBar]
;we use meter for the scrollbar to be seen on the skin
Meter=Image
;we make use of a picture make the scrollbar look good.
ImageName="#CURRENTPATH#Theme\scroll bar.png"
;here we do all the tricks for setting position height and width
X=(((#formWidth#-21)*#formScale#)+#paddingLeft#)
Y=((56*#formScale#+#paddingTop#) + #ScrollbarHeight# / ([mFileCountParent] / 15) / 15 * #vScrollIndex#)
W=(16*#formScale#)
H=((280*#formScale#)/ ([mFileCountParent] / 15))
this from the log
Formula: Division by 0: ((56*1+30) + (280*1) / (0 / 15) / 15 * 1)

[mFileCountParent] is 0 in this case. and that will make an error. i juist got 1 error and then it stops giving more error messages.

i realy do not know how i have to find this one out. can somebody help me.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5384
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Formula: Division by 0

Post by eclectic-tech »

wrote:[Variables]
formWidth=190
formHeight=185
formScale=1
vPath="#CURRENTPATH#Shortcuts"
vScrollIndex=0

[mFileCountParent]
Measure=Plugin
Plugin=FolderInfo
Folder=#vPath#\
InfoType=FileCount
DynamicVariables=1

[MeterScrollBar]
Meter=Image
ImageName="#CURRENTPATH#Theme\scroll bar.png"
X=(((#formWidth#-21)*#formScale#)+#paddingLeft#)
Y=((56*#formScale#+#paddingTop#) + (280*#formScale#) / ([mFileCountParent] / 15) / 15 * #vScrollIndex#)
W=(16*#formScale#)
H=((280*#formScale#)/ ([mFileCountParent] / 15))
DynamicVariables=1
The error is not caused by [mFileCountParent] being zero, but by the vScrollIndex value being set to zero in the variables.(15 * 0 = 0) and you are trying to divide by that.

If you only see the error once, then somewhere in your skin the value of vScrollIndex is being changed from the initial zero value.

You may want to rethink your formula, or change the initial value to a nearly zero value; vScrollIndex=0.0000001
Judian81
Posts: 180
Joined: May 6th, 2021, 2:57 pm

Re: Formula: Division by 0

Post by Judian81 »

eclectic-tech wrote: August 26th, 2021, 10:39 pmvScrollIndex=0.0000001

it is not the vscrollindex. it realy is the filecount. but what you did there was wat i also did.
so i show you below.
H=((280*#formScale#)/ (([&mFileCountParent]+0.00001) / 15))

it works fine. but i thought maby there is another way. and yes it occours ones. so it is not a big of a deal.
thanks anyway.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5384
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Formula: Division by 0

Post by eclectic-tech »

Yes, the mFileCount will be zero initially, until the plugin populates so that could also show an error.

Glad you found an answer.