I know this topic came up once or twice before to script a method so your robot could know it's age. I first scripted a process in PowerShell to come up with the exact age from a given birthday for your robot, but I wanted to script it in ARC and I didn't want to make a plug in (I know that idea got tossed around before). I just wanted something simple.
This is my script, it lets your robot say it's approximate age. Just wanted to get opinions on it. Does anyone see something they might do differently?Code:
$UseEZBSpeaker = false
#Print($day)
#Print($month)
#Print($year)
#enter your robot's birthday below
$AIBirthDay = 12
$AIBirthMonth = 6
$AIBirthYear = 2015
$szAgeYears = ($year - $AIBirthYear)
$szAgeMonths = ($month - $AIBirthMonth)
$szAgeDays = ($day - $AIBirthDay)
#Print($szAgeYears)
#Print($szAgeMonths)
#Print($szAgeDays)
if ($szAgeYears 1)
Print("I am less than 1 year old. I am about " + $szAgeMonths + " months old.")
$szToSay = "I am less than 1 year old. I am about " + $szAgeMonths + " months old."
endif
if ($szAgeYears 1)
Print("I am less than 1 year old. I am about " + $szAgeDays + " days old.")
$szToSay = "I am less than 1 year old. I am about " + $szAgeDays + " days old."
endif
if ($szAgeYears 1 AND $szAgeMonths > 1)
Print("I am " + $szAgeYears + " years old and " + $szAgeMonths + " months.")
$szToSay = "I am " + $szAgeYears + " years old and " + $szAgeMonths + " months."
endif
if ($szAgeYears > 1 AND $szAgeMonths >= 1)
Print("I am " + $szAgeYears + " years old and " + $szAgeMonths + " months.")
$szToSay = "I am " + $szAgeYears + " years old and " + $szAgeMonths + " months."
endif
if ($szAgeYears > 1 AND $szAgeMonths = 0)
Print("I am " + $szAgeYears + " years old")
$szToSay = "I am " + $szAgeYears + " years old "
endif
if ($szAgeYears = 1 AND $szAgeMonths > 1)
Print("I am " + $szAgeYears + " year old and " + $szAgeMonths + " months.")
$szToSay = "I am " + $szAgeYears + " year old and " + $szAgeMonths + " months."
endif
if ($szAgeYears = 1 AND $szAgeMonths = 0)
Print("I am about 1 year old.")
$szToSay = "I am about 1 year old."
endif
if ($UseEZBSpeaker = true)
SayEZBWait($szToSay)
ELSE
SayWait($szToSay)
endif
$szToSay = ""
Asked
— Edited
Code: