User:Jack3: Difference between revisions

From EggWiki
Jump to navigation Jump to search
No edit summary
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Super simple, first time ever, script
Super simple, first time ever, script


August 30, 2022
August 30, 2022


A very simple script.  This is good for a 'first script'.  Keep it simple - easier to get the hang of installing and using scripts.  
A very simple script.  This is good for a 'first script'.  Keep it simple - easier to get the hang of installing and using scripts.  
   
   
However, this script isn't a do-nothing script!  :)    It is actually useful.    I install it on every bot I create, first thing.
However, this script isn't a do-nothing script!  :)    It is actually useful.    I install it on every bot I create, first thing.


This script creates a partyline command :    .date  
This script creates a partyline command :    .date     .
It simply returns the current date and time, same as if you executed the      date      command on the linux command line in a shell.
It simply returns the current date and time, same as if you executed the      date      command on the linux command line in a shell.
   
   
Usage:
<nowiki>
On the partyline, simply type:        .date
Usage:
Bot will return the date and time.
On the partyline, simply type:        .date
Bot will return the date and time.
</nowiki>


I find it very handy at times, when working in the partyline.    Especially when editing/debugging a script that  
I find it very handy at times, when working in the partyline.    Especially when editing/debugging a script that  
contains    bind cron    .  I'll want to know when to expect it to trigger, and can quickly get that info.   
contains    bind cron    .  I'll want to know when to expect it to trigger, and can quickly get that info.   
   
   
Feel free to install and use this script.    If you do, I suggest you install it as-is, first.  No edits.   
Feel free to install and use this script.    If you do, I suggest you install it as-is, first.  No edits.   
Reason:  Get it installed and working correctly, first.  THEN you can hack it up and do what you want with it.  :)   
Reason:  Get it installed and working correctly, first.  THEN you can hack it up and do what you want with it.  :)   
Suggestion:  Add to it.  Make yet another command, so that it responds to a public command in a channel,  and/or to a /msg to the bot.
Suggestion:  Add to it.  Make yet another command, so that it responds to a public command in a channel,  and/or to a /msg to the bot.
It's good practice!  :)
It's good practice!  :)




Line 41: Line 43:




Start small - like this.  :)  Add to it.  That's a great way to learn!    But mostly - Have fun !    :)
Start small - like this.  :)  Add to it.  That's a great way to learn!    But mostly - Have fun !    :)


I hope this helps.
I hope this helps.





Latest revision as of 23:05, 31 August 2022

Super simple, first time ever, script

August 30, 2022

A very simple script. This is good for a 'first script'. Keep it simple - easier to get the hang of installing and using scripts.

However, this script isn't a do-nothing script!  :) It is actually useful. I install it on every bot I create, first thing.

This script creates a partyline command : .date . It simply returns the current date and time, same as if you executed the date command on the linux command line in a shell.

Usage: On the partyline, simply type: .date Bot will return the date and time.

I find it very handy at times, when working in the partyline. Especially when editing/debugging a script that contains bind cron . I'll want to know when to expect it to trigger, and can quickly get that info.

Feel free to install and use this script. If you do, I suggest you install it as-is, first. No edits. Reason: Get it installed and working correctly, first. THEN you can hack it up and do what you want with it.  :) Suggestion: Add to it. Make yet another command, so that it responds to a public command in a channel, and/or to a /msg to the bot. It's good practice!  :)


References:

https://docs.eggheads.org/using/tcl-commands.html

    text search tcl-commands.doc and find: 
            bind dcc
            putdcc
            ctime
            unixtime

Other helpful info:

   http://suninet.the-demon.de/
   http://suninet.the-demon.de/041.htm
   http://suninet.the-demon.de/042.htm
   http://suninet.the-demon.de/043.htm
   http://suninet.the-demon.de/044.htm
   https://wiki.eggheads.org/index.php/Loading_Tcl_Scripts


Start small - like this.  :) Add to it. That's a great way to learn! But mostly - Have fun !  :)

I hope this helps.



Script starts here


bind dcc - "date" partyline_date_time

###
proc partyline_date_time {handle idx text} {

        putdcc $idx "[ctime [unixtime] ]"

 }
###

End script