mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
I'm working on a script that changes my nick after a period of time.
I'd like to be able to set it so that I can use a time (eg: 02:00, 3 am, 4 pm, 17:20) so that my nick changes at that time.

I'd also like to be able to set it to change after a period of time (eg: 2:00 for 2 hours)

Each of these, in and of itself is a relatively simple timer command.

What I'm unsure of, is how to get the script to recognize that 2:00 is 2 hours, yet 02:00 is 2 am?

Times/timings given here are examples only.

Joined: Nov 2009
Posts: 117
Vogon poet
Offline
Vogon poet
Joined: Nov 2009
Posts: 117
You could use the colon only for the one that sets it to a time
and for duration use decimal point format as in 2.5 for two and
a half hours. Another way if you insist on having a colon for
both formats is to add maybe a d after the one for duration as
in 2:30d to indicate two hours thirty minutes. Of course you
will write conditional statements to use these the way you wish.

Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
By allowing the user to type in whatever they want, you are setting yourself up for having to write tons of code for differentiation and error checking. Instead, I suggest using dialog elements to choose their time of day or duration.

Example:
- A radio button to switch between time of day and duration.

- Several drop-down boxes to choose hours/minutes/seconds (time of day and duration).

- A real-time text representation of when their selection will occur. ie "Time remaining: 3h 9m 43s"


Basically, don't give the users the chance to give you invalid or ambiguous data. Let them choose from pre-defined sets of data instead.

-genius_at_work


Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Thanks for the replies. One option that I thought of after submitting my request is to prompt the user for clarification if necessary.
Eg: 2:00 am would not be prompted for
but 2:00 would send a prompt to clarify if they wanted 2 hours, 2:00 am or 2:00 pm

As the script will be on each users mIRC, rather than on a bot, then the prompting is, imo, a valid option.

Joined: Jan 2007
Posts: 1,156
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
To make it easy Id suggest using a specific method to tell which is which.

I think you should use colon for a specific time and a floating point integer for duration.

02:00 = 2m
2 = 2 hours

This will make it easy to differentiate. If you like you can still double check with the user.

Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
Personally, I'd be annoyed if the program had to ask me what I meant. If it is going to accept any time that I give it, the program should be able to figure it out.

As I mentioned above, I would use dialog items to let the user choose. If you don't want that clutter on your main dialog, you could use a secondary dialog with a "Change" button on the main dialog.

-genius_at_work

Joined: Jan 2007
Posts: 1,156
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
I only guessed when he said it was a script and not a bot that he was doing a remote control script. In that instance they wouldnt see the dialog.

Or maybe I misunderstood. I agree with the dialog suggestion unless it is controlled by a text event.

Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
The script, when complete, will be available, initially, for DJ's, and will allow the DJ to use a single command to change their nick when they start their shift and automatically change it back at the end of their shift.

Eg: <RusselB> /dj 2:00 am
Would turn the nick to DJ^RusselB
Then at 2:00 am, turn it back to RusselB automatically.

However, some DJ's might prefer to use /dj 2:00
Which would turn their nick (as shown earlier), then change it again 2 hours later

Joined: Nov 2009
Posts: 20
X
Ameglian cow
Offline
Ameglian cow
X
Joined: Nov 2009
Posts: 20
Well, mIRC uses 24-hour clock for $time. So basically,
Code:
/timer 1 14:00 nick XperTeeZ|away

would change my nick at 2 pm.

Joined: Jan 2007
Posts: 1,156
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
In my opinion you should give them a specific protocol and not be ambiguous about it.

Me personally, I would have them set the time in military time.

/dj 02:00 means be done at 2 am.

If they wanted it for 2 hours use: dj 2

2.5 hours: /dj 2.5

This way if there is a : in it, you know its a specific time. Otherwise it's an amount of time.

Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Actually to my understanding, and experience with timers,
Quote:
/timer 1 14:00 nick XperTeeZ|away
should be formatted as
Code:
/timer 14:00 1 0 nick XperTeeZ|away


Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Thanks for your reply and opinion.
Obviously doing it the way I was wanting will be difficult at best, thus I'm considering other options.

Joined: Nov 2009
Posts: 20
X
Ameglian cow
Offline
Ameglian cow
X
Joined: Nov 2009
Posts: 20
True, your timer format is correct, missed that spot smile


Link Copied to Clipboard