| View previous topic :: View next topic |
| Author |
Message |
Madalin Master

Joined: 24 Jun 2005 Posts: 310 Location: Constanta, Romania
|
Posted: Sun Aug 31, 2014 4:52 pm Post subject: warn script |
|
|
I want to create a warn script
!warn nickname time
time = can be hours/days/weeks/months etc
The script is almost finished i just dont know a way to script the part when that warning expires. I cant use timer because i want the bot to know where it remained after restart (and i dont think i can do that with timer) and i cant use bind time because it wont match the expiration date because i would probably use !warn command a specific second and bind time only acts at 00. So my question is how can i make that expiration date/unixtime match. How to save it and how to check it so i can remove it when it matches. _________________ https://github.com/MadaliNTCL - To chat with me: https://tawk.to/MadaliNTCL |
|
| Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
Posted: Sun Aug 31, 2014 5:54 pm Post subject: Re: warn script |
|
|
| Madalin wrote: |
...
i want the bot to know where it remained after restart
...
|
Some here might advise you to use a database. MySQL. I have never tackled that.
If you wish to have something intact after a restart, then you are going to have to write it disk.
The other way, is to write it a plain text file.
http://forum.egghelp.org/viewtopic.php?t=6885
Quite a bit of manipulation of records can be done. How cumbersome it becomes is a matter of how much info per record, and how many records.
I don't fully understand exactly what you want to do yet. |
|
| Back to top |
|
 |
Madalin Master

Joined: 24 Jun 2005 Posts: 310 Location: Constanta, Romania
|
Posted: Sun Aug 31, 2014 7:01 pm Post subject: |
|
|
I have no problem in handleing file... i want to know whats the best way to save that record and match it later to see if it expired or not _________________ https://github.com/MadaliNTCL - To chat with me: https://tawk.to/MadaliNTCL |
|
| Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
Posted: Sun Aug 31, 2014 7:28 pm Post subject: |
|
|
| Madalin wrote: |
...
i want to know whats the best way to save that record and match it later to see if it expired or not |
What comes to mind is : unixtime
If you can get the user to carefully input the date/time info, then you can use:
clock scan
on it to convert it to unixtime
Once you have it in that format, it is a matter of simple math to compare it to the current time.
I hope this helps. |
|
| Back to top |
|
 |
Madalin Master

Joined: 24 Jun 2005 Posts: 310 Location: Constanta, Romania
|
Posted: Sun Aug 31, 2014 7:33 pm Post subject: |
|
|
I have been using [clock scan [unixtime] +2 days] for example ... but if i use bind time after to check if that $var is the same it wont be because bind time is every minute at 00 second.. so it wont match thats my problem _________________ https://github.com/MadaliNTCL - To chat with me: https://tawk.to/MadaliNTCL |
|
| Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
Posted: Sun Aug 31, 2014 7:37 pm Post subject: |
|
|
| Madalin wrote: |
...
so it wont match thats my problem
|
To discern if it is expired, won't it only be necessary to see if the time is passed?
In other words, why does it have to match? Can't you just test for
greater than
or
less than
depending on how you go about it. |
|
| Back to top |
|
 |
Madalin Master

Joined: 24 Jun 2005 Posts: 310 Location: Constanta, Romania
|
Posted: Sun Aug 31, 2014 8:14 pm Post subject: |
|
|
Yeah... greater than should be enough.. my bad then. Was fixed to match that exactly..
I often try to make something in the most complex way possible so that later (weeks/months/years) find different ways to do the same but easier maybe just because TCLScripting is just a hobby
Thanks for that simple idea  _________________ https://github.com/MadaliNTCL - To chat with me: https://tawk.to/MadaliNTCL |
|
| Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
Posted: Sun Aug 31, 2014 8:19 pm Post subject: |
|
|
You almost had me convinced that I just was not understanding what you needed.
Good luck with it.
Let us know how it turns out. |
|
| Back to top |
|
 |
Madalin Master

Joined: 24 Jun 2005 Posts: 310 Location: Constanta, Romania
|
Posted: Sun Aug 31, 2014 8:20 pm Post subject: |
|
|
As i said the script is done .. i had that problem of "matching" the date exactly ...but now everything is clear ) script is done _________________ https://github.com/MadaliNTCL - To chat with me: https://tawk.to/MadaliNTCL |
|
| Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
Posted: Sun Aug 31, 2014 8:25 pm Post subject: |
|
|
| Madalin wrote: |
...
script is done |
That was quick!
Good to hear it.
 |
|
| Back to top |
|
 |
|