PDA

View Full Version : Away script help


Smee
14-01-2002, 19:04
Hello, got an away script, but it's not working right, when I set away it comes up with Timer 668 activated and when I set back it comes up with Timer 668 halted and "Back after 0secs" for some reason the time isn't working, can anyone help?

here's the script;
/away1 /var %away.message = $? | var %away.time = 0 | away %away.message | ame has spaced out - %away.message | timer668 0 3600 ame is still spaced out | $duration($calc(%away.time * 60))| nick away`jynxeh
/back1 /ame has returned - gone for $duration($calc(%away.time * 60)),Far out | away | timer667 off | timer668 off | %away.time = 0 | nick Jynxeh

All I'm mainly after is the away timer getting fixed, so when i set back it will say Gone "1hr 33mins 7secs" or whatever and try getting rid of the timmber 667 actived etc and timber 668 off blah blah, any help would be great, cheers.

Psychotic
14-01-2002, 22:47
I think Kalleth (getting quite l33t at mirc scripting) can help with this one - Give him a shout in #wpbots sometime (or spam his query :)

wuaffiliate
14-01-2002, 23:34
whatever you do dont type !Kalleth like 8 times ;)

/me runs

mYth
19-01-2002, 00:33
Originally posted by Jynxeh

/away1 /var %away.message = $? | var %away.time = 0 | away %away.message | ame has spaced out - %away.message | timer668 0 3600 ame is still spaced out | $duration($calc(%away.time * 60))| nick away`jynxeh
/back1 /ame has returned - gone for $duration($calc(%away.time * 60)),Far out | away | timer667 off | timer668 off | %away.time = 0 | nick Jynxeh


Ok.. Let's go through this bit by bit :)

First of all you set your away message to a variable. Then you set the away time to 0 which is all well and good but you forget to set a timer going to count the time gone by hence the %away.time remains at 0 and we all know any number x 0 will = 0 hence the 0secs :)

Secondly, in the /away1 alias I dont see any need for this line:

| $duration($calc(%away.time * 60))|

As far as I see it's not doing anything and is just scruffy coding..

To get rid of the timer messages we need to silence the command in mIRC. Therefore "timer668 0 3600" should become ".timer668 0 3600" and so forth. Notice the fullstop is used as a silencer. This needs to be added to all timer commands in the script.

The /back1 alias can be cleaned up everr so slightly by changing

"/back1 /ame has returned - gone for $duration($calc(%away.time * 60)),Far out |"

to

"/back1 /ame has returned - gone for $duration($calc(%away.time * 60)) $+ , Far out |"

Take note of the simple $+ I've added. This just allows mIRC to breath so to speak and not get that comma tangled up with the $duration command it's just been told to execute.

Good Luck!

enekron
23-01-2002, 19:31
Hmm I wrote this in a spare 10 mins, and you'll notice in the /back1 it says timer667 off, but in /away1 there is no timer667 like I originally coded. There is meant to be timer667 0 60 inc %away.time there. It's far from perfect, but works.

Kalleth
25-01-2002, 12:10
Okay - sorry for never posting here before.. i'm bored so i'll help.

For starters, i would always recommend not using the 'Aliases' window for anything more complicated than a single line script - it is far easier to understand, and much more easily debugged, if you script aliases in the remotes section.
For example, take my away script: (or, at least, a simplified version. this is executed by typing /away Reason.)

alias away {
set %awayreason $1-
set %away 1
.quote away %awayreason
.timeraway 0 1200 /ame is away ( $+ %awayreason $+ )
set %awaytime $ctime
ame is away ( $+ %awayreason $+ )
set %oldnick $me
nick %awaynick
}
alias back {
unset %away
.timeraway off
.quote away
set %gonefor $duration($calc($ctime - %awaytime))
ame is back ( $+ %awayreason $+ ) - Gone For %gonefor
nick %oldnick
}
firstly, i set %awayreason to a global variable. What you are doing is setting %awayreason to a LOCAL variable, that can only be used within the script (ie only in /away1 for you) and unsets itself when that script finishes.then, i set my %away to 1 (its used by me in other things like triggers, its useful for other scripts to be able to realise that you are away). Then, i do quote away <reason>. this goes to the server, and sets your status to away so that ppl see the away message when they whois you. Then, i start a timer so that my away message repeats every 1200 seconds, and do the leaving message. Then, i set the current time to a variable. this is important, because it allows me to calculate how long i was away for. i then set my current nick to a variable called %oldnick, and set my nick using /nick to whatever is in the %awaynick variable (atm Kalleth|g0ne). On the /back, i do the normal things like ame is back, but i also do something different. I Use the time it was when i set away, and i take it away from the current time, getting only the time i was away for.

So, looking at your script:

Firstly, you dont want to use the 'Aliases' window - do it in the remotes.
Secondly, dont use /var if you will be using it in a different alias too. use /set.
Thirdly, you dont need the $duration($calc(%away.time * 60)) in the first bit.
Fourthly - i see no setting the current time to a variable.
Fifthly (god this goes on a bit :/) - you want gonefor the current time minus the time it was when you went away.

i think that should be about it - any questions PM me on IRC, my nick is either Kalleth or Kalleth|g0ne - i dont claim to be the best scripter, but i can have a damn good go at helping. You can also find me in #wpbots.

[edit: ****e just realised i helped you fix this a while ago :o ]

GameGuru
27-01-2002, 23:20
You sir, have skillz :)

Tiger
28-01-2002, 23:54
rofl :E

Pld Kalleth, i dunno where you learned to do that, but we're all mighty impressed :}

Kalleth
30-01-2002, 21:18
i'm guessing the sarcasm in that sentence was neck-deep :///

GameGuru
30-01-2002, 22:49
No Sarcasm intended whatsoever. It's refreshing to see someone else with good IRC scripting knowledge help out on the forum :)

Kalleth
30-01-2002, 22:51
:D