Basic Python Math

Posted on
Sat Oct 10, 2020 8:31 am
jltnol offline
Posts: 989
Joined: Oct 15, 2013

Basic Python Math

So I'm trying to do some basic Python Math, and I think I've got that working, but am also trying to move values from one variable to a 2nd. This is part of a longer script, but I can't get this part to work. I'm sure this is a string/integer/float issue, but I've tried several things and still can't the value of one variable moved to the 2nd(or in this case, move the value of theVar4 to the variable theVar5. The value of the theVar4 may be "0", may be ".067", may be "3", or may be "1.2". The Date variable is a simple 2 digit date of the month, so I think I have the "if" argument setup currently. I did look at the Python Scripting tutorial, but couldn't find how to do this.

Any suggestions?

Code: Select all
# Managing rain

day = indigo.variables[1383721539] #Text Day
date = indigo.variables[1999172030] #Number Date

theVar1 = indigo.variables[1852577407] #Today rain
theVar2 = indigo.variables[35080668] #Tomorrow Rain
theVar3 = indigo.variables[986779847] #This Week Rain
theVar4 = indigo.variables[1169660509] #This Month Rain
theVar5 = indigo.variables[1385001124] #last Month Rain

if date.value == "10":
   indigo.variable.updateValue(theVar5, theVar4) #moves this month to last month

Posted on
Sat Oct 10, 2020 11:10 am
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Basic Python Math

Code: Select all
# Managing rain

day = indigo.variables[1383721539] #Text Day
date = indigo.variables[1999172030] #Number Date

theVar1 = indigo.variables[1852577407] #Today rain
theVar2 = indigo.variables[35080668] #Tomorrow Rain
theVar3 = indigo.variables[986779847] #This Week Rain
theVar4 = indigo.variables[1169660509] #This Month Rain
theVar5 = indigo.variables[1385001124] #last Month Rain

if date.value == "10":
   indigo.variable.updateValue(theVar5, theVar4.value) #Sets last month's value to the current month's value

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Sat Oct 10, 2020 11:20 am
jltnol offline
Posts: 989
Joined: Oct 15, 2013

Re: Basic Python Math

You know... I KNEW it would be something simple. I have a bunch of python snippets, but couldn't find one exactly like I needed. THANKS!!!

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 12 guests

cron