This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

warn script

Help for those learning Tcl or writing their own scripts.
Post Reply
User avatar
Madalin
Master
Posts: 310
Joined: Fri Jun 24, 2005 11:36 am
Location: Constanta, Romania
Contact:

warn script

Post by Madalin »

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.
w
willyw
Revered One
Posts: 1197
Joined: Thu Jan 15, 2009 12:55 am

Re: warn script

Post by willyw »

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.
User avatar
Madalin
Master
Posts: 310
Joined: Fri Jun 24, 2005 11:36 am
Location: Constanta, Romania
Contact:

Post by Madalin »

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
w
willyw
Revered One
Posts: 1197
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

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.
User avatar
Madalin
Master
Posts: 310
Joined: Fri Jun 24, 2005 11:36 am
Location: Constanta, Romania
Contact:

Post by Madalin »

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
w
willyw
Revered One
Posts: 1197
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

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.
User avatar
Madalin
Master
Posts: 310
Joined: Fri Jun 24, 2005 11:36 am
Location: Constanta, Romania
Contact:

Post by Madalin »

Yeah... greater than should be enough.. :D 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 :D

Thanks for that simple idea :)
w
willyw
Revered One
Posts: 1197
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

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.
User avatar
Madalin
Master
Posts: 310
Joined: Fri Jun 24, 2005 11:36 am
Location: Constanta, Romania
Contact:

Post by Madalin »

As i said the script is done .. i had that problem of "matching" the date exactly ...but now everything is clear :)) script is done
w
willyw
Revered One
Posts: 1197
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

Madalin wrote: ...
script is done
That was quick!

Good to hear it.

:)
Post Reply