Posted by
| Rakon
USA (123 posts) Bio
|
Message
| Hello again.
The issue is, while I have converted the plugin to python, using the syntax's I believe to be correct in what I desire for it to do. (Behave the same way as ked's plugin, in VB).
It(his) performs the basic math, and allocates a number in assigning how many 'g's to place like a bar. It is able to have half the 'g's of ten, one colour, and the rest another, depending on the math's count.
When I do this SAME thing in python, it doesn't change part of the total of 'g's to another colour, it either has them all one colour, all the other defined colour, or not showing at all (black).
Ked's(VBscript)
sub DoGauge (sPrompt, iCurrent, iMax, sGoodColour, sBadColour)
dim pc, count
'
' Do prompt in black Arial
'
InfoColour "black"
InfoFont "Arial", 10, 0
Info sPrompt
'
' Use Webdings for gauge (black square)
'
InfoFont "Webdings", 10, 0
pc = CInt ((CInt (iCurrent) / CInt (iMax)) * 10)
'
' Below 20% warn by using different colour
'
if pc < 3 then
InfoColour sBadColour
else
InfoColour sGoodColour
end if
'
' Draw active part of gauge
'
if pc < 1 then
InfoColour "black"
end if
for count = 0 to pc
Info "g"
next
'
' Draw rest of gauge in grey (ie. unfilled bit)
'
InfoColour "dimgray"
while count <= 10
count = count + 1
Info "g"
wend
end sub
Mine(Python):
def DoGauge(Prompt, Current, Max, HColour, LColour):
world.InfoColour("Orange")
world.InfoFont("Arial", 10, 0)
world.Info(Prompt)
world.InfoFont("Webdings", 10, 0)
count = int(Current) / int(Max) * 12
if count < 4:
world.InfoColour(LColour)
else:
world.InfoColour(HColour)
for i in range(0,count):
world.Info("g")
while count <= 11:
world.InfoColour("dimgrey")
count += 1
world.Info("g")
As you can see, it essentially the same, just different syntax's. What I am confused to is WHY my version only colours them all, or not at all. While HIS will change a few based off the math. Any ideas?? |
Yes, I am a criminal.
My crime is that of curiosity.
My crime is that of judging people by what they say and think, not what they look like.
My crime is that of outsmarting you, something that you will never forgive me for. | Top |
|