mIRC Home    About    Download    Register    News    Help

Print Thread
#109151 26/01/05 06:03 AM
Joined: Jan 2005
Posts: 12
C
Pikka bird
OP Offline
Pikka bird
C
Joined: Jan 2005
Posts: 12
I have been writing my own multiserver script in my remotes and I have been having trouble getting this script to function properly.
Hopefully I haven't overlooked anything but I do believe this is a bug. Please correct me if I am incorrect.

I started out with the following which works as it should:
scon -a echo Idle Time: $!idle

Then I changed that line to this which also works but the same information for connection #1 is displayed on all of the servers instead of the correct information for each server:
scon -a if (($idle > 120) && ($away == $false )) { command }

Then I changed it to this which caused the line to stop working:
scon -a if (($!idle > 120) && ($!away == $false )) { command }
Notice the space after $false which had to be put in there because when it was left as $false) instead of $false ), I would get an /if error.

I found this in the MIRC help file:
Note: If you use a command that contains $identifiers, and you want the identifiers to be evaluated in the target connection, you must pass them as $!identifier to prevent them from being evaluated first in the current connection.

As far as I understand this, it should work properly the way that I have scripted it.
I have also tried this in my remotes section as an alias and had my on ping event trigger it.

I am using the on ping event to trigger this.

OS = Windows XP Professional
MIRC Version = 6.16

Thanks

#109152 26/01/05 10:12 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Quote:
scon -a if (($idle > 120) && ($away == $false )) { command }


that well actually work.

Quote:
scon -a if (($!idle > 120) && ($!away == $false )) { command }


while this wont.

it has to do with how things are preevaluated, becuase there is a symbol directly infront of the $ namely the ( these commands are not evaluated, they remain as $idle and $away, so if you have ($!idle it remains as ($!idle and when the scon command runs it it sees it as the litteral text "$idle", these are hard to make right as you might have a line like this

scon -a if ($time == $!time) { echo The Time is the Time } << that works it becomes if ($time == $time) { echo The Time is the Time }
scon -a if ($!time == $!time) { echo The Time is the Time } << that doesnt it becomes if ($!time == $time) { echo The Time is the Time } which in turn becomes IS "$time" == "13:01:23"

to fix the problem you can do this

scon -a if (( $!idle > 120 ) && ( $!away == $false )) { command }

now with a space inserted the identifier is seen as it is.
scon -a if (( $!idle > 120 ) && ( $!away == $false )) { command } <<works and becomes if (( $idle > 120 ) && ( $away == $false )) { command }

one odd way I have found to test if tyour getting what you want is this
Code:
//timerXX 1 1000 ;scon -a if (( $!idle &gt; 120 ) &amp;&amp; ( $!away == $false )) { command }
* Timer xx activated
//timerxx
* Active timers:
* Timer xx 1 time(s) 1000s delay ;scon -a if (( $idle &gt; 120 ) &amp;&amp; ( $away == $false )) command
                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                          If that bit looks right for when its ment to run then you have the scon command correct.
//timerxx off
* Timer xx halted

#109153 27/01/05 01:14 AM
Joined: Jan 2005
Posts: 12
C
Pikka bird
OP Offline
Pikka bird
C
Joined: Jan 2005
Posts: 12
DaveC. I thank you very much for pointing out the solution to my problem. Your solution worked exactly the way that I was wanting it to.

Question. Is this a bug or just the way that it is suppose to function?

Thanks


Knowledge = Power
#109154 27/01/05 03:15 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Its not a bug, but it can be off putting when some identifiers need to be !'d and some dont, with in the same command.

#109155 27/01/05 05:55 AM
Joined: Jan 2005
Posts: 12
C
Pikka bird
OP Offline
Pikka bird
C
Joined: Jan 2005
Posts: 12
Hmm. I am now noticing a problem with the $!away checking unless I made a typo.

For some reason, my away status is always false and it keeps putting me in away mode. Very weird.

I tested this extensively with several variations and I am still having difficulty finding the error.

Here is what I am currently trying:
scon -a if (( $!idle > 120 ) && ($!away == $false )) { /nick $me $+ {Auto-Away} }

And if that wasn't enough, I am also finding that the above script does not like /nick $!me $+ {Auto-Away} for some weird reason along with the problems below.

My nick on the first server goes from Cosmos32 to Cosmos32{Auto-Away} just like it is suppose to but the next time around it adds on another auto-away on my nick so my nick turns out to be Cosmos32{Auto-Away}{Auto-Away}. lol

On the 2nd connection, it goes from:
Cosmos32 to Cosmos32{
or Cosmos32 {A
and even Cosmos32 {Au

I know that I opened up problems for me when trying to do this weird away add-on to my nick.

Hopefully I haven't been too vague on my problems. I have only tested this script while connected to 2 servers at a time so far. Trying to get this working before I try it on more then 2 servers.

When I am finally get this script fully working, I will be posting it to help others that are trying the same thing that I am and are finding the same problems that I am.

Thanks


Knowledge = Power
#109156 27/01/05 06:59 AM
Joined: Dec 2002
Posts: 208
H
Fjord artisan
Offline
Fjord artisan
H
Joined: Dec 2002
Posts: 208
Quote:

Here is what I am currently trying:
scon -a if (( $!idle > 120 ) && ($!away == $false )) { /nick $me $+ {Auto-Away} }


The problem with that is again the ( next to a $!identifier. you can use

( $!away == $false )
or
($away == $false )

Quote:

And if that wasn't enough, I am also finding that the above script does not like /nick $!me $+ {Auto-Away} for some weird reason along with the problems below.


With that line, you will want to put a ! in $+, like

/nick $!me $!+ {Auto-Away}

so that mirc knows that you aren't trying to tell it you want $me{Auto-Away} which would certainly come out $null.

As far as the nick coming out like Cosmos32{, are you sure that the network you are trying that on will allow such a long nick? The original IRC specification only allowed for 9 character nicks. Many servers allow more, but how many more is not exactly standardized. If you are trying to use a nick that is too long, the server will truncate it, leaving only the number of characters that are allowed.


If I knew now what I will know then... maybe things will have been different...
#109157 27/01/05 07:22 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
try

scon -a if (( $!idle > 120 ) && ( $!away == $false )) { nick $!remove( $!me , {Auto-Away} ) $!+ {Auto-Away} }

#109158 27/01/05 08:45 AM
Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
Make life easier on yourself... wink
Code:
alias awaychk if !$away &amp;&amp; $server &amp;&amp; $idle &gt; 120 { away {Auto-Away} | tnick $me $+ {Auto-Away} }


now you just use this
  • scon -a awaychk

#109159 27/01/05 10:53 PM
Joined: Jan 2005
Posts: 12
C
Pikka bird
OP Offline
Pikka bird
C
Joined: Jan 2005
Posts: 12
Thank you very much Hrung, DaveC and Iori for your great replies and comments. They have been very helpful. It is great to find a forum where people help others so freely.

I realized when I got to work (without a computer of course) exactly how stupid my question was because of the following reasons.

1. I was doing /away then a nick change and my script couldn't deal with that because the new nick was not /away.
What I should of done was change my nick and then go /away which my script would have done perfectly. lol

2. Yes the servers that I am on do support longer nicks. I can manually change them by typing /nick Cosmos32{Auto-Away} but for some reason my script doesn't like doing it properly on the second server. lol

3. The reason I didn't want to do this script in an alias (which probably would have made sense to everyone else) is because I wanted to do it differently and not like the majority of people. They would have used Aliases and Timers. lol

I will correct my stupid errors by putting the nick change and then the /away which will fix the away error that I was seeing. lol

I will post more when I am done and when I come up with more questions (hopefully not stupid ones this time. lol).

The coming back from being away portion of my script works fine. I was just having issues with going away. lol

Thanks


Knowledge = Power
#109160 28/01/05 03:02 AM
Joined: Jan 2005
Posts: 12
C
Pikka bird
OP Offline
Pikka bird
C
Joined: Jan 2005
Posts: 12
Hello again everyone. I am still having an issue with my away nick on the 2nd server.

Here is the full script that I am currently using in my REMOTES section along with the responses:
======================================
on 1:ping: {

scon -a echo CID: $!cid
scon -a echo Network: $!network
scon -a echo Nick: $!me
scon -a echo Usermodes: $!usermode
scon -a echo Idle Time: $!idle
scon -a echo Away: $!away
scon -a echo -

scon -a if (( $!idle < 120 ) && ( $!away == $true )) { /nick $!remove( $!me , {Auto-Away} ) }
scon -a if (( $!idle > 120) && ( $!away == $false )) { /nick $!me $!+ {Auto-Away} | /away Testing }

/halt

}
======================================
CID: 1
Network: DALnet
Nick: Cosmos32
Usermodes: +ir
Idle Time: 122
Away: $false
-
* Cosmos32 sets mode: -r
-
* Your nick is now Cosmos32{Auto-Away}
-
You have been marked as being away
-
CID: 1
Network: DALnet
Nick: Cosmos32{Auto-Away}
Usermodes: +i
Idle Time: 142
Away: $true
-
======================================
CID: 2
Network: EFnet
Nick: Cosmos32
Usermodes: +i
Idle Time: 133
Away: $false
-
* Your nick is now Cosmos32{
-
You have been marked as being away
-
CID: 2
Network: EFnet
Nick: Cosmos32{
Usermodes: +i
Idle Time: 153
Away: $true
-
======================================
I hope that in providing my entire script, it might be easier to see everything that I am doing.
I also hope that this thread will prove to be helpful to others that wish to experiment and try
to write scripts differently just to be unique. smile

My away nick on the second server seems to be the only issue at this time. Everything else seems to be working fine so far.

I set the idle time to 120 on purpose. When the script is done and working properly, I will change the idle time to 600 and the coming back from away at 60 (so I don't go away and then come right back since when I change nicks, my idle time will change).

Feel free to just leave a comment if you wish.

I really do appreciate everyones assistance in this on-going project of mine.

Thanks

#109161 28/01/05 04:36 AM
Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
  • -
    CID: 2
    Network: EFnet
    Nick: Cosmos32{
    Usermodes: +i
    Idle Time: 153
    Away: $true
    -


Efnet has a max nicklength of 9 chars
Cosmos32{ is 9 chars long.
wink

Quote:
since when I change nicks, my idle time will change

No $idle is how long since you manually entered anything into a mirc editbox (unless you change it with /resetidle)

#109162 29/01/05 08:22 AM
Joined: Jan 2005
Posts: 12
C
Pikka bird
OP Offline
Pikka bird
C
Joined: Jan 2005
Posts: 12
Iori. Thanks for your input again.

Yes, you are correct. I do not know how I overlooked that. I must have been working on the script too much and overlooked that detail. I have been connecting to several servers to test my script with. I will test this script on other servers to check it out properly.

Any comments on the script? Anything that I could do differently to improve it? Comments and suggestions are welcomed.

Thanks


Knowledge = Power
#109163 29/01/05 12:40 PM
Joined: Jan 2005
Posts: 12
C
Pikka bird
OP Offline
Pikka bird
C
Joined: Jan 2005
Posts: 12
Here is my fully working Auto Away script without timers and aliases. I hope that others find it useful.

on 1:PING: {

scon -a echo CID: $!cid
scon -a echo Network: $!network
scon -a echo Nick: $!me
scon -a echo Usermodes: $!usermode
scon -a echo Idle Time: $!idle
scon -a echo Away: $!away

scon -a if (( $!away == $false ) && ( $!idle > 600 )) { nick $!me $!+ {Auto-Away} }
scon -a if (( $!away == $false ) && ( $!idle > 600 )) { away 2,2-8,2Auto-Away After $!idle Seconds2,2- }

scon -a if (( $!away == $true ) && ( $!idle < 600 )) { away }
scon -a if (( $!away == $true ) && ( $!idle < 600 )) { nick $!remove( $!me , {Auto-Away} ) }

scon -a echo -

/halt

}
The reason I have 2 if's for away and 2 if's for back from away is because I found that on a dialup connection, lag is a factor and that putting it all on one line (using 1 if line for each) that my nick would change but I wouldn't go /away. The above script seems to have fixed that error.

I have been trying to find a way to keep the /away and the back from away to 1 line each but I haven't figured out a way to make sure that each section of the line is performed properly before continuing without more code. It just seemed simpler the way that I have posted it.

You don't need the first 6 scon -a lines. I just used them to see if my script was processing everything correctly and for future additions to the script later.

Thanks to all that have helped.

Thanks


Knowledge = Power
#109164 29/01/05 02:20 PM
Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
I would be using "tnick <awaynick>" for the away nick, When you set back all you need is "/nick $mnick" (add your own !!!'s grin)
If you are disconnected/reconnected after using /tnick your nick reverts so the script will just set you away again and again use the /tnick <awaynick> without compounding it into something like "Cosmos32{Autoaway}{Autoaway}{A" - cleaner I think smile

#109165 29/01/05 07:05 PM
Joined: Jan 2005
Posts: 12
C
Pikka bird
OP Offline
Pikka bird
C
Joined: Jan 2005
Posts: 12
Iori. Thank you very much for your input.

That is a very good idea unfortunately sometimes I use different nicks on different servers (as do others that might use my script) and if I used $mnick, it would return my nick to my main nick that is in Options box. So I will need to keep the $remove section in there to make my nick return to the original nick for that server.

I also noticed that if I use tnick and remove my back from away line, then I am still listed as away under my not away nick so I will have to include my back from away line so that I will not show up as away in my /whois

Keep those ideas and comments coming.

Thanks

#109166 29/01/05 09:13 PM
Joined: Jan 2005
Posts: 12
C
Pikka bird
OP Offline
Pikka bird
C
Joined: Jan 2005
Posts: 12
Here is the latest version of my script that is fully working and does support muliple servers with the same or different nicks and does not alter your nick in the OPTIONS menu.

I have also posted the responses for each server that I have tested this script on at the same time (3 servers simultaneously).

Please remember to show proper respect to those that have helped me with this script by listing their nicks (and mine) in the script if you use it in a public script.

Please post your changes in this thread so that others may know different ways to do the same thing and so they may include your nicks in the script also.

I am not saying that this is the best way to write this type of script, just the way that I decided to do it (without TIMERS or ALIASES)..
================================================================================
on 1:PING: {

scon -a echo CID: $!cid
scon -a echo Network: $!network
scon -a echo Nick: $!me
scon -a echo Usermodes: $!usermode
scon -a echo Idle Time: $!idle
scon -a echo Away: $!away

scon -a if (( $!away == $false ) && ( $!idle > 600 )) { tnick $!me $!+ {Auto-Away} }
scon -a if (( $!away == $false ) && ( $!idle > 600 )) { away 2,2-8,2Auto-Away After $!idle Seconds2,2- }

scon -a if (( $!away == $true ) && ( $!idle < 600 )) { away }
scon -a if (( $!away == $true ) && ( $!idle < 600 )) { nick $!remove( $!me , {Auto-Away} ) }

scon -a echo -

/halt

}
================================================================================
CID: 1
Network: DALnet
Nick: TwelveDays
Usermodes: +i
Idle Time: 617
Away: $false
-
* Your nick is now TwelveDays{Auto-Away}
-
You have been marked as being away
-
TwelveDays{Auto-Away} is ~TwelveDay@64.63.213.18 * Cosmos32
TwelveDays{Auto-Away} on @#DSS-Scripting-Class @#Cosmos32
TwelveDays{Auto-Away} using broadway.ny.us.dal.net 42nd Street
TwelveDays{Auto-Away} is away: -Auto-Away After 617 Seconds-
TwelveDays{Auto-Away} has been idle 11mins 37secs, signed on Sat Jan 29 14:35:34
TwelveDays{Auto-Away} End of /WHOIS list.
-
CID: 1
Network: DALnet
Nick: TwelveDays{Auto-Away}
Usermodes: +i
Idle Time: 101
Away: $true
-
You are no longer marked as being away
-
* Your nick is now TwelveDays
-
TwelveDays is ~TwelveDay@64.63.213.18 * Cosmos32
TwelveDays on @#DSS-Scripting-Class @#Cosmos32
TwelveDays using broadway.ny.us.dal.net 42nd Street
TwelveDays has been idle 22secs, signed on Sat Jan 29 14:35:34
TwelveDays End of /WHOIS list.
================================================================================
CID: 2
Network: UICN
Nick: Cosmos32
Usermodes: +ixr
Idle Time: 655
Away: $false
-
* Cosmos32 sets mode: -r
-
* Your nick is now Cosmos32{Auto-Away}
-
You have been marked as being away
-
Cosmos32{Auto-Away} is [email]TwelveDays@2e60f4af.1e624c7d.36cd2766.28a85a1bX[/email] * Cosmos32
Cosmos32{Auto-Away} is using modes +ix +
Cosmos32{Auto-Away} real hostname 64.63.213.18 64.63.213.18
Cosmos32{Auto-Away} on #dssfordummies @#TwelveDays @#Twikki
Cosmos32{Auto-Away} using swap.uicn.net uicn beer server
Cosmos32{Auto-Away} is away: -Auto-Away After 655 Seconds-
Cosmos32{Auto-Away} has been idle 11mins 56secs, signed on Sat Jan 29 14:47:28
Cosmos32{Auto-Away} End of /WHOIS list.
-
CID: 2
Network: UICN
Nick: Cosmos32{Auto-Away}
Usermodes: +ix
Idle Time: 95
Away: $true
-
You are no longer marked as being away
-
* Your nick is now Cosmos32
-
-NickServ- This nickname is registered and protected. If it is your
-
-NickServ- nick, type /msg NickServ IDENTIFY password. Otherwise,
-
-NickServ- please choose a different nick.
-
* Cosmos32 sets mode: +r
-
-NickServ- Password accepted - you are now recognized.
-
Cosmos32 is [email]TwelveDays@2e60f4af.1e624c7d.36cd2766.28a85a1bX[/email] * Cosmos32
Cosmos32 has identified for this nick
Cosmos32 is using modes +irx +
Cosmos32 real hostname 64.63.213.18 64.63.213.18
Cosmos32 on #dssfordummies @#TwelveDays @#Twikki
Cosmos32 using swap.uicn.net uicn beer server
Cosmos32 has been idle 42secs, signed on Sat Jan 29 14:47:28
Cosmos32 End of /WHOIS list.
================================================================================
CID: 3
Network: Elite-Irc
Nick: Twikki
Usermodes: +xi
Idle Time: 629
Away: $false
-
* Your nick is now Twikki{Auto-Away}
-
You have been marked as being away
-
Twikki{Auto-Away} is ~TwelveDay@Elite-2780EEAA.fatl1.hawkcommunications.com * Cosmos32
Twikki{Auto-Away} is connecting from *@client18.fatl1.hawkcommunications.com 64.63.213.18
Twikki{Auto-Away} on @#Buck-Rogers @#Testing-My-Mirc-Scripts
Twikki{Auto-Away} using HellBoy.Elite-Irc.Net investigator of the paranormal
Twikki{Auto-Away} is away: -Auto-Away After 629 Seconds-
Twikki{Auto-Away} has been idle 12mins 3secs, signed on Sat Jan 29 14:36:12
Twikki{Auto-Away} End of /WHOIS list.
-
CID: 3
Network: Elite-Irc
Nick: Twikki{Auto-Away}
Usermodes: +xi
Idle Time: 83
Away: $true
-
You are no longer marked as being away
-
* Your nick is now Twikki
-
Twikki is ~TwelveDay@Elite-2780EEAA.fatl1.hawkcommunications.com * Cosmos32
Twikki is connecting from *@client18.fatl1.hawkcommunications.com 64.63.213.18
Twikki on @#Buck-Rogers @#Testing-My-Mirc-Scripts
Twikki using HellBoy.Elite-Irc.Net investigator of the paranormal
Twikki has been idle 39secs, signed on Sat Jan 29 14:36:12
Twikki End of /WHOIS list.
================================================================================

Thanks


Link Copied to Clipboard