mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 3 1 2 3
#49535 15/09/03 05:00 AM
Joined: Sep 2003
Posts: 23
N
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Sep 2003
Posts: 23
I joined these forums last week, haven't had as much time as I'd like to learn scripting for IRC but am coming along slowly. I only go to one server dedicated to a site that I mod so I have other things to do...anyway....I use the nnscript from www.nnscript.de and it has mass modes for voicing, devoicing, oping, deoping, but that's where it stops.

Now I have seen how some of you feel about helping with possible "channel takeover code" and I can assure you my stuff is used in good fun, as I'm already an Op there and at most there's maybe 20 people on that server. We all know each other and sometimes like to have fun, mess around, whatever, and I want a mass kick script, but it's out of my realm right now. I can look @ most code and understand it but I can't write it on my own yet. (sorry this post is so long lol)

I'm asking if anyone would like to share their own code for me to use I'd appreciate it, and if you want to visit our server before you 'trust' me to see how it is, I'd be glad to have you visit.

My msn messenger: kipplestein@hotmail.com
My yahoo mess: idi0teque@yahoo.com

Add me to either of those and I'll be happy to share the server with you. And if you don't trust posting it for all to see, again, add me on messenger. Hope I didn't step on too many toes =P /me is back to some scripting while I still have an hour or two of awake time left in me.


#49536 15/09/03 05:15 AM
Joined: Mar 2003
Posts: 1,271
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Mar 2003
Posts: 1,271
Writing you any code to work next to a full script can be done, but since there is no way to know what your script does and what parts of it have been worked on, making sure the new code works might be harder than you think. If you're lucky, the author of your script hasn't done anything weird to prevent adding of additional code, but I know several scripts that will go completely boinkers. So should someone decide to post some stuff here for you, don't be surprised if it doesn't work. Be thankful if it does - you then seem to have gotten your hands on a script by an author that isn't overly protective and abusive in his coding...


DALnet #Helpdesk
I hear and I forget. I see and I remember. I do and I understand. -Confucius
#49537 15/09/03 05:20 AM
Joined: Sep 2003
Posts: 23
N
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Sep 2003
Posts: 23
Like I said, I can recognize what the script means, I will look through any script to make sure someone doesn't have too much free time on his/her hands wink And the nnscript has no compatibility problems as far as adding popups/aliases/remotes, I've had no problems so far and doubt I will have any, if I do, I can always revert back to regular old mirc 6.x

#49538 15/09/03 06:12 AM
Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
alias mk {
var %i 0,%nicks
:next
inc %i
if (%i > $nick($chan,0)) { goto finish }
else {
if ($nick($chan,%i) == $me) { goto next }
elseif ($nick($chan,%i) != $me) { %nicks = %nicks $nick($chan,%i) | goto next }
}
:finish
tokenize 32 %nicks
kick # $replace($1-,$chr(32),$chr(44))
}
/mk for mass kick....
grin


new username: tidy_trax
#49539 15/09/03 09:38 AM
Joined: Mar 2003
Posts: 1,271
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Mar 2003
Posts: 1,271
Code:
alias mk {
  var %i = $nick($chan,0)
  while (%x) {
    if ($nick($chan,%i) != $me) kick $chan $nick($chan,%i) message
    dec %i
  }
}


Not being a hypcrite (sp?) - since you already have the code in question, I can't stand lousy coding, so here's a slightly improved version. All those obsolete if statements and goto's...


DALnet #Helpdesk
I hear and I forget. I see and I remember. I do and I understand. -Confucius
#49540 15/09/03 09:40 AM
Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
goto loops are faster..


new username: tidy_trax
#49541 15/09/03 09:55 AM
Joined: Jan 2003
Posts: 150
J
Vogon poet
Offline
Vogon poet
J
Joined: Jan 2003
Posts: 150
%i instead of %x
Code:
alias mk {
  var %i = $nick($chan,0)
  while (%i) {
    if ($nick($chan,%i) != $me) echo 4 $chan $nick($chan,%i) message
    dec %i
  }
}


Go ahead, jump. 100,000 lemmings can't be wrong.
#49542 15/09/03 01:33 PM
Joined: Mar 2003
Posts: 1,271
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Mar 2003
Posts: 1,271
Care to back that up with some facts ? I will test it tonight, but I'm fairly certain one while is gonna be a lot faster than 2 if statements and matching goto's

update: tested with the code below

my while loop (test1) returns 24280 ticks
your goto loop (test2) returns 31664 ticks

Note that the code is virtually similar to what we posted above, including if statements and goto's.

I dare conclude that my while loop is faster

Code:
alias test1 {
  set %ticks $ticks
  var %x = 50000
  while (%x) {
    if (%x >= 0) echo -a test %x
    dec %x
  }
  echo -a time taken: $calc($ticks - %ticks)
}

alias test2 {
  set %t alfa beta
  set %ticks $ticks
  var %x = 0
  :next
  inc %x
  if (%x > 50000) { goto finish }
  else {
    if (%x < 0) { goto next }
    elseif (%x > 0) { echo -a test %x | goto next }
  }
  :finish
  tokenize 32 %t
  echo -a time taken: $calc($ticks - %ticks)
}

Last edited by LocutusofBorg; 15/09/03 01:52 PM.

DALnet #Helpdesk
I hear and I forget. I see and I remember. I do and I understand. -Confucius
#49543 15/09/03 01:36 PM
Joined: Jun 2003
Posts: 242
R
Fjord artisan
Offline
Fjord artisan
R
Joined: Jun 2003
Posts: 242
In my experience, /while loops are better the majority of the time .. but I've had situations where /goto worked out better.

Edit: Sorry, replied to wrong post .. reply was meant for pheonix.

Last edited by r0ck0; 15/09/03 01:37 PM.
#49544 15/09/03 01:41 PM
Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
i dont care to prove it, i cant actually prove it, my friends while loop works faster on his pc, but my goto works faster on mine...


new username: tidy_trax
#49545 15/09/03 01:53 PM
Joined: Mar 2003
Posts: 1,271
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Mar 2003
Posts: 1,271
The do NOT claim "goto loops are faster" - if you cannot back up your claim with experimental data or facts, then don't make it. Both theoretically and practically while loops are faster (see my data above to back up my claim).


DALnet #Helpdesk
I hear and I forget. I see and I remember. I do and I understand. -Confucius
#49546 15/09/03 01:55 PM
Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
while loops are faster for you, gotos are faster for me, you cannot prove me wrong if it still works faster on my pc, you can prove WHILE LOOPS ARE FASTER ON MOST, but you still cant prove WHILE LOOPS ARE FASTER kthx.


new username: tidy_trax
#49547 15/09/03 02:39 PM
Joined: Jun 2003
Posts: 242
R
Fjord artisan
Offline
Fjord artisan
R
Joined: Jun 2003
Posts: 242
Code:
alias looptest echo -a while: $wtest ~ goto: $gtest
alias wtest {
  var %ticks = $ticks,%i = 0
  while (%i != 5000) inc %i
  return $calc(($ticks - %ticks) / 1000)
}
alias gtest {
  var %ticks = $ticks,%i = 0
  :start
  if (%i != 5000) {
    inc %i
    goto start
  }
  return $calc(($ticks - %ticks) / 1000)
}


type /looptest

Edit

//timer 10 2 looptest

(6.03)
while: 0.093 ~ goto: 0.141
while: 0.093 ~ goto: 0.141
while: 0.093 ~ goto: 0.141
while: 0.093 ~ goto: 0.141
while: 0.093 ~ goto: 0.141
while: 0.093 ~ goto: 0.141
while: 0.093 ~ goto: 0.141
while: 0.093 ~ goto: 0.141
while: 0.093 ~ goto: 0.157
while: 0.109 ~ goto: 0.141

(6.1)
while: 0.125 ~ goto: 0.187
while: 0.125 ~ goto: 0.156
while: 0.125 ~ goto: 0.171
while: 0.14 ~ goto: 0.188
while: 0.156 ~ goto: 0.219
while: 0.125 ~ goto: 0.171
while: 0.125 ~ goto: 0.171
while: 0.14 ~ goto: 0.156
while: 0.125 ~ goto: 0.171
while: 0.125 ~ goto: 0.171

hmmm .. 6.1 consistently slower .. and it's not connected at
all while 6.03 is connected to 3 networks, 10 channels total.

Last edited by r0ck0; 15/09/03 03:28 PM.
#49548 15/09/03 02:52 PM
Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
while: 0.141 ~ goto: 0.187

EDIT:

In addition to being faster, IMO while statements show more understanding abotu what your code is going. It shows you took the time to comlete your thought process about what you want the script to do. Goto's, to me, look like you said" Well, i got it looping.. but i forget to do (this). I can just stick a label in there, and it'l work. Sure, doing it the first time, or even second time may not be bad. But when you start repeating that, then you get the all-too-well-known "Spaghetti code"


-KingTomato
#49549 15/09/03 02:55 PM
Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
while: 0.17 ~ goto: 0.131


new username: tidy_trax
#49550 15/09/03 02:58 PM
Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
that's funny that the only one who argued the fact that gotos are better, gets the faster goto time.. Might i presume some code tweaking? maybe

<font size="Really big">Gotos Are Faster!!!</font>
<font size="-999">Test studies done under while loop condition fo 100 interations, versus goto loop of 1 iteration</font>


-KingTomato
#49551 15/09/03 03:00 PM
Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
i used the code he gave me and thats what it returned....


new username: tidy_trax
#49552 15/09/03 03:01 PM
Joined: Jan 2003
Posts: 150
J
Vogon poet
Offline
Vogon poet
J
Joined: Jan 2003
Posts: 150
tested three times

while: 0.21 ~ goto: 0.261
while: 0.2 ~ goto: 0.281
while: 0.2 ~ goto: 0.271

mIRC v6.1
WinXP PRO

C1.2/512 ram


Go ahead, jump. 100,000 lemmings can't be wrong.
#49553 15/09/03 03:16 PM
Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
Series of 10...

(v6.1):
while: 0.141 ~ goto: 0.172
while: 0.141 ~ goto: 0.172
while: 0.14 ~ goto: 0.188
while: 0.141 ~ goto: 0.187
while: 0.141 ~ goto: 0.172
while: 0.125 ~ goto: 0.187
while: 0.141 ~ goto: 0.172
while: 0.125 ~ goto: 0.188
while: 0.125 ~ goto: 0.172
while: 0.14 ~ goto: 0.172

(v6.03):
while: 0.141 ~ goto: 0.156
while: 0.125 ~ goto: 0.156
while: 0.125 ~ goto: 0.156
while: 0.125 ~ goto: 0.156
while: 0.109 ~ goto: 0.157
while: 0.125 ~ goto: 0.156
while: 0.125 ~ goto: 0.156
while: 0.125 ~ goto: 0.156
while: 0.125 ~ goto: 0.141
while: 0.125 ~ goto: 0.14


-KingTomato
#49554 15/09/03 04:15 PM
Joined: Dec 2002
Posts: 1,527
_
Hoopy frood
Offline
Hoopy frood
_
Joined: Dec 2002
Posts: 1,527
(v6.03)
* Timer 1 activated
while: 0.11 ~ goto: 0.16
while: 0.11 ~ goto: 0.15
while: 0.11 ~ goto: 0.15
while: 0.11 ~ goto: 0.16
while: 0.111 ~ goto: 0.16
while: 0.12 ~ goto: 0.151
while: 0.11 ~ goto: 0.151
while: 0.12 ~ goto: 0.15
while: 0.11 ~ goto: 0.15
while: 0.11 ~ goto: 0.15
* Timer 1 halted

(6.1)
* Timer 1 activated
while: 0.14 ~ goto: 0.17
while: 0.131 ~ goto: 0.18
while: 0.15 ~ goto: 0.191
while: 0.13 ~ goto: 0.161
while: 0.13 ~ goto: 0.17
while: 0.23 ~ goto: 0.221
while: 0.13 ~ goto: 0.16
while: 0.13 ~ goto: 0.16
while: 0.13 ~ goto: 0.15
while: 0.121 ~ goto: 0.16
* Timer 1 halted

i dont know how its humanly possible out of several PC's only pheonix has the faster goto. im thinking there has to be a change hes done somewhere to falsify his results.

OS WinXp Pro
Ram 1024mb
mIRC (6.03 & 6.1)


D3m0nnet.com
Page 1 of 3 1 2 3

Link Copied to Clipboard