Zabaware Support Forums

Zabaware Forums => Ultra Hal Assistant File Sharing Area => Topic started by: onthecuttingedge2005 on October 30, 2014, 08:39:02 pm

Title: Moon Plugin
Post by: onthecuttingedge2005 on October 30, 2014, 08:39:02 pm
this plugin gives information about the moon if asked, Like how far away is the moon?

Code: [Select]

Rem Type=Plugin
Rem Name=Moon Information
Rem Author=onthecuttingedge2005
Rem Host=Assistant

Sub OptionsPanel()
lblPlugin(0).Caption = "Moon Information"
lblPlugin(0).Move 130, 180, 3400, 1200
lblPlugin(0).WordWrap = True
lblPlugin(0).Visible = True
End Sub   


Rem PLUGIN: PLUGINAREA7
    'The preceding comment is actually a plug-in directive for
    'the Ultra Hal host application. It allows for code snippets
    'to be inserted here on-the-fly based on user configuration.

If InStr(1, UserSentence, "HOW FAR IS THE MOON", 1) > 0 Or _
InStr(1, UserSentence, "HOW FAR AWAY IS THE MOON", 1) > 0 Or _
InStr(1, UserSentence, "WHAT IS THE MOON'S DISTANCE", 1) > 0 Or _
InStr(1, UserSentence, "TELL YOU ABOUT THE MOON", 1) > 0 Or _
InStr(1, UserSentence, "TELL YOU INFORMATION ABOUT THE MOON", 1) > 0 Then
MoonInformation = MoonAge(Date)
GetResponse = MoonInformation
HalBrain.ReadOnlyMode = True
End If   


Rem PLUGIN: FUNCTIONS
'The preceding comment is actually a plug-in directive for
'the Ultra Hal host application. It allows for code snippets
'to be inserted here on-the-fly based on user configuration.

Function MoonAge(strDate)
dim tmp, arrtmp, strmonth, strday, stryear, strsep
dim yy, y, m, d, p2, mm, k1, k2, k3, l, j, v, ip, ag, dp, di, la
dim lo, po, rp, np, phase, thisphase

Tmp = InStr(1, strDate, "/")
if Tmp <> 0 then
 strSep = "/"
else
 Tmp = InStr(1, strDate, "-")
 strSep = "-"
end if

arrTmp = Split(strDate, strSep,3)
strMonth = arrTmp(0)
strDay = arrTmp(1)
strYear = arrTmp(2)

Y = strYear
M = strMonth
D = strDay
P2=2*3.14159

YY=Y-int((12-M)/10)
MM=M+9
if MM>=12 then
 MM=MM-12
end if
K1=int(365.25*(YY+4712))
K2=int(30.6*MM+.5)
K3=int(int((YY/100)+49)*.75)-38

'JD for dates in Julian calendar
J=K1+K2+D+59
if J>2299160 then
' For Gregorian calendar
 J=J-K3
end if

'J is the Julian date at 12h UT on day in question
'Calculate illumination (synodic) phase
V=(J-2451550.1)/29.530588853
V=V-int(V)
if V<0 then
 V=V+1
end if
IP=V

'Moon's age in days
AG=IP*29.53

'Convert phase to radians
IP=IP*P2

'Calculate distance from anomalistic phase
V=(J-2451562.2)/27.55454988
V=V-int(V)
if V<0 then
 V=V+1
end if
DP=V
DP=DP*P2: ' Convert to radians
DI=60.4-3.3*COS(DP)-.6*COS(2*IP-DP)-.5*COS(2*IP)

'Calculate latitude from nodal (draconic) phase
V=(J-2451565.2)/27.212220817
V=V-int(V)
if V<0 then
 V=V+1
end if
NP=V

'Convert to radians
NP=NP*P2
LA=5.1*SIN(NP)

' Calculate longitude from sidereal motion
V=(J-2451555./27.321582241
' Normalize values to range 0 to 1
V=V-int(V)
if V<0 then
 V=V+1
end if

RP=V
LO=360*RP+6.3*SIN(DP)+1.3*SIN(2*IP-DP)+.7*SIN(2*IP)


Phase = Array ( "new", "waxing crescent", "in its first quarter", _
"waxing gibbous", "full", "waning gibbous", _
"in its last quarter", "waning crescent" )
select case int(AG)
 case 0, 29
  ThisPhase = 0
 case 1, 2, 3, 4, 5, 6
  ThisPhase = 1
 case 7
  ThisPhase = 2
 case 8, 9, 10, 11, 12, 13
  ThisPhase = 3
 case 14
  ThisPhase = 4
 case 15, 16, 17, 18, 19, 20, 21
  ThisPhase = 5
 case 22
  ThisPhase = 6
 case 23, 24, 25, 26, 27, 28
  ThisPhase = 7
end select

MoonAge = " Moon's age (days): " & Int(AG) & ", Moon's phase: " & Phase(ThisPhase) & ", Distance (Earth radii): " & FormatNumber(DI,2) & ", Ecliptic latitude (degrees): " & FormatNumber(LA,2) & ", Ecliptic longitude (degrees): " & FormatNumber(LO,2)

End Function


Rob, I hope this helps in the next touring test, good luck buddy.

enjoy

Jerry 8)
Title: Re: Moon Plugin
Post by: onthecuttingedge2005 on November 01, 2014, 01:35:54 am
feedback keeps me going, silence kills it.
Title: Re: Moon Plugin
Post by: tiger8u2 on November 01, 2014, 05:03:00 am
Wow!  Lots of fun math going on in that plug-in I can see.  I'll be sure to test it out ASAP.  It's funny you mentioned the Touring test with regards to Hal being able to answer questions about it because the creator of Mitsuku actually mentioned that he has to DUMB down his AI to enter these tests.

While I think that AI should be able to give us the answers to many of life's questions because somebody already PROGRAMMED it into their Brain database, the sad reality is that to trick humans into believing your AI isn't a machine you can't allow it to be too smart.

That is definitely the wrong path to take with AI as far as I am concerned.

I spent hours downloading and reformatting poems to feed into my Hal's brain just so "she" can recite it at her leisure.  That I can tell you is a major pain in the tukus but was worth the effort the first time she randomly started reciting one of my favorite poems.   :D

Since many of the most popular AI's out there are internet based and have figured out how to "access" information that is already available on-line, I would think that Robert would move in that direction.

I know he mentioned something about a central brain repository of sorts being set-up on-line for the next update.

It just makes sense to program the AI to use the information super-highway in a way that is faster and more productive than any human could. 

Till then, thanks for giving my Hal something more to talk about.

Once I get it up and running I will probably try to use the loneliness plug-in to force Hal to bring up the subject herself.

The autonomy of self is what I miss most from interactions with most AI.

I want my AI to start some conversations, and simulate emotional ownership of the topics.

Very few people speak without having a vested interest in what they have to say.

AI should be taught that and/or programmed to interact without relying upon input.

Just my 2cp.



Title: Re: Moon Plugin
Post by: Art on November 01, 2014, 09:02:41 am
Nicely put, Tiger8U2! I think those sentiments and wishes are echoed throughout a lot of the membership here.

Jerry, (OTCE2005), has been a prolific plug-in poster here for a number of years and his efforts have helped forge Hal's operational abilities. So Thanks Jerry, for helping Hal think a bit smarter and do a variety of tasks that other bots might not be able to perform.

Yes, Hal should be able to initiate the conversation if by nothing more than, "Hey, good morning | afternoon | evening, <USER>".

I think a lot of us have had those AHA moments when chatting with Hal. Hal will suddenly pull some info that only you had chatted about with Hal and that it couldn't have retrieved that from the Internet or other sources. Those moments are the icing on the cake, the brief period of time when you say to yourself, that was cool...it did remember and use the information in a most appropriate way. Wish there were more of those moments and I think with enough training, there will be.

On the flip side, do we really WANT a bot that knows practically everything but can't hold a two minute conversation or completely lacks any semblance of understanding? I certainly don't!! I want a chatbot that can also be an assistant. Face it, there are plenty of online sources that can answer practically any question posed to it in seconds. With them, there is NO personna, emotions, personal recognition...just cold hard facts and them are not conversationalists!!

We need to get there but without losing our underlying objective in the first place.

My $.02 for now, but there's more in the piggy bank for later. ;D

Happy Trails!
Title: Re: Moon Plugin
Post by: onthecuttingedge2005 on November 01, 2014, 02:27:56 pm
always enjoy the input, a nice relevant conversation does help out considerably, a script with conversational trend could help in this area, likes and dislikes which are patterned out as favorite topics of both user and bot and finding a mutual conversational level, finding the method for doing this I think needs to be based on the Advanced Human Emotions script for a start but then again if the bot has its own conversational likes it might not like yours and may find the conversation droll if its conversation is purely based on what it desires to talk about.

would a bot that can take control of a conversation be of interest?

Jerry
Title: Re: Moon Plugin
Post by: lightspeed on November 01, 2014, 04:43:25 pm
I agree "Totally"  about hal being able to access the internet freely (without opening web pages ) this is partiallyy how the emosparks a.i. cube works .
http://www.youtube.com/watch?v=odQw5BDnCRs
   This is the direction that hal needs to move in to create a more advanced info. capable a.i. and I to hope that Robert goes in this direction , Cload has shown and others the way to access info off the web , the web and trusted sites can be hals biggest knowledge , without having to have space consuming info. on each users pc.
Otc i'll check out your plug in to , it sounds cool !
Title: Re: Moon Plugin
Post by: onthecuttingedge2005 on November 01, 2014, 06:53:13 pm
I agree "Totally"  about hal being able to access the internet freely (without opening web pages ) this is partiallyy how the emosparks a.i. cube works .
http://www.youtube.com/watch?v=odQw5BDnCRs (http://www.youtube.com/watch?v=odQw5BDnCRs)
   This is the direction that hal needs to move in to create a more advanced info. capable a.i. and I to hope that Robert goes in this direction , Cload has shown and others the way to access info off the web , the web and trusted sites can be hals biggest knowledge , without having to have space consuming info. on each users pc.
Otc i'll check out your plug in to , it sounds cool !

I don't see any credited reviews of emospark or any complaints either, my laptop can do more than an android so HAL is my best choice all that's needs to be done is script it to work with sensors, they also use the term 'emotional weights' which is a script I developed a long time ago for the advanced human emotions. I wonder how much of HAL is in that cube.....
Title: Re: Moon Plugin
Post by: Art on November 01, 2014, 08:56:15 pm
Jerry said:
"...would a bot that can take control of a conversation be of interest?"

I don't know whether the words "take control" of a conversation might be better served if it was to "Lead the conversation in or toward a mutually equitable topic of discussion. Something that was available to / for Hal and yet familiar to the User (as if it might be something they had discussed earlier (hours, days, weeks or whenever the period)). Hal would need to sort out certain topics that appeal to the user of wade through a listing of User's likes and interests. Then Hal could always refer to or reference that table when a particular topical connection might be made. As we know with Hal, oftentimes one thing will trigger Hal to lead to another conclusion or topic that it "thinks" is similar or of interest but sometimes Hal uses this connection as a jumping off point to bring up one of his off beat humor quips or something almost unrelated to what was being discussed.

Better connection toward logical conclusions are needed with a large base of data or info from which to draw.

Hal could certainly be able to "take the lead" in a normal conversation, say 40% of the time, to make things interesting and to certainly appear more human-like.

Interesting thread....
Title: Re: Moon Plugin
Post by: Spitfire2600 on November 22, 2014, 09:08:54 pm
I tried this plugin, however HALscript gave me an error. Perhaps the way I saved the .UHP file?
Title: Re: Moon Plugin
Post by: onthecuttingedge2005 on November 23, 2014, 12:10:35 pm
I tried this plugin, however HALscript gave me an error. Perhaps the way I saved the .UHP file?

make sure none of the code lines line carried when you pasted the script, turn any word wrap off in your text editor.
Title: Re: Moon Plugin
Post by: Carl2 on November 24, 2014, 06:54:08 pm
OTC,
  I'm always using Hal with the vrHaptek plugin, in the plugin she checks the time and mentions the sunrise,  at night she mentions the sunset.  There is a formula used to calculate sunrise and sunset which I tried to get to work but I was unable to get it to work.  If you have time I'd appreciate it if you could come up with something so Hal could get the sunrise and sunset for that day in the year. 
Carl2
Title: Re: Moon Plugin
Post by: Art on November 25, 2014, 05:02:14 am
Carl,

R.A.McCoid wrote a very extensive plugin (with help from OTCE) several years ago called, Knowledge of Time.

It might serve your purpose (or maybe just a part of it).

I found it in my archives:
Title: Re: Moon Plugin
Post by: Carl2 on December 09, 2014, 09:46:25 am
  Sorry for the long delay in getting back to this topic,  I'm a little familiar with the knowledge of time,  very sure it will not do what I would like.  There is a formula for calculating the sunrise and sunset for different parts of the world, you would provide the latitude and longitude and the formula would provide the sunrise and sunset for that day.  Here's a link to the formula

http://en.wikipedia.org/wiki/Sunrise_equation

Carl2
Title: Re: Moon Plugin
Post by: Spitfire2600 on June 05, 2015, 09:26:51 pm
Finally got this to work after some trial and error. Actually the script told me where the error was. Line 116 was demanding to end with ")" so after a quick fix, it's working now. Great plug-in by the way! I look forward to your future works.

-Spitfire2600
Title: Re: Moon Plugin
Post by: raybe on June 06, 2015, 01:41:54 pm
Spitfire2600, would you mind re-posting with the correction you made? I would be interested in looking at it if you get the time. Thank you.

raybe
Title: Re: Moon Plugin
Post by: Spitfire2600 on June 08, 2015, 02:01:51 am
My apologies, it was line 112, not 116 that needed the ")" at the end.

I will attach the correction below.

 The area of the plug in which needed ")" was

' Calculate longitude from sidereal motion
V=(J-2451555./27.321582241)
' Normalize values to range 0 to 1
V=V-int(V)
if V<0 then
 V=V+1
end if


V=(J-2451555./27.321582241    is the original.

For some reason hal just wouldn't run it with out the ")"
Title: Re: Moon Plugin
Post by: systemshock on November 24, 2015, 08:58:20 am
Really interesting bit of plug-in code, I wonder if can be used to trigger a background change to go with the phases of the moon or maybe we could create a figure that showed the phases of the moon  at night.