mIRC Home    About    Download    Register    News    Help

Print Thread
#109617 31/01/05 02:46 AM
Joined: Jan 2005
Posts: 10
R
Remo Offline OP
Pikka bird
OP Offline
Pikka bird
R
Joined: Jan 2005
Posts: 10
I have a hash table that has numbers as items and nicknames as data, the hash table is called helpreqs. Its a quite short help query script to make "turns" for people in a channel. theres also another hash tables where I have the helpers, there the items are nicknames and the data is a 1 only to check if it exists.
The problem is that I created a command that should read a query window and if the messager is in the helpers list it should voice the next N data items in 'helpreqs' and sort the hash table.

Should work like this: pnn N , where N is the number of people to voice.

Heres the code:

Code:
on 1:TEXT:*:?:{
  if ( hlogin == $1 ) { 
    if ( $2 == %helperpass) {
      hadd -sm helpers $nick 1
      msg $nick Helper $nick added succesfully
      halt
    }
  }
}


on 1:TEXT:*:?:
if ( pnn isin $1 ) {
  var %hnum = $2
  if ( $hfind(helpers,$nick).data !== $null) {
    var %i = 1
    while (%i <= %hnum) {
      mode #newbiehelp +m $hfind(helpreqs,%i).data
      inc %i
    }
    var %i = 1
    while (%i <= $hget(helpreqs,0).item ) {
      hadd -s helpreqs %i $hfind(helpreqs,(%i + 1)).data
      hdel -s helpreqs (%i + 1)
      inc %i
    }
  }
}



Anyone has an idea why this is not working?
Thanks

[EDIT]
The main problem is that it wont add anything to the helpers table. Im not sure why isnt it reading the query.

Well maybe im missing some information so you can understand how I tried to work this.

Code for when people joins
Code:
on *:join:#newbiehelp:
if ($hfind(helpreqs,$nick).data !== $null) {}
else { 
  /hadd -ms helpreqs ( $hget(helpreqs,0).item + 1) $nick
  /echo -st $nick added to list
}

Last edited by Remo; 31/01/05 02:49 AM.
Joined: Nov 2004
Posts: 332
R
Fjord artisan
Offline
Fjord artisan
R
Joined: Nov 2004
Posts: 332
on *:join:#newbiehelp:{
if ($hfind(helpreqs, $nick)) {}
else {
/hadd -ms helpreqs $calc($hget(helpreqs,0).item + 1) $nick
/echo -st $nick added to list
}
}
you could try this^
i dunno theres a tutorial at mirc.net that might you
and theres the help file 2
good luck
hopes this helps

Last edited by ricky_knuckles; 31/01/05 03:32 AM.

The Kodokan will move you, one way or another.
Joined: Jan 2005
Posts: 10
R
Remo Offline OP
Pikka bird
OP Offline
Pikka bird
R
Joined: Jan 2005
Posts: 10
Thanks for the info. It didnt solve the problem but im now checking mirc.net .
Tried the help file. No answer there heheh.
It doesnt send me an error. It just doesnt read the query nor add a helper to the hash table. I belive all the other stuff works.

Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
The problem is u cant have 2 TEXT events that are on the same matchtext in the same remote file, only the first one well trip.

Oh also the second one has no opening {

Joined: Jan 2005
Posts: 10
R
Remo Offline OP
Pikka bird
OP Offline
Pikka bird
R
Joined: Jan 2005
Posts: 10
It doesnt read the first one.
And thanks for the bracket advice. missed it.

[edit]Typo :S[/edit]
[edit]
Do I need a bracket in the 2nd one if I have an If command eating all that code?
--
Also tried to put all the code in one on text. Had no luck. Its not reading the first one.[/Edit]

Last edited by Remo; 31/01/05 05:01 AM.
Joined: Jan 2005
Posts: 10
R
Remo Offline OP
Pikka bird
OP Offline
Pikka bird
R
Joined: Jan 2005
Posts: 10
ok so the code now looks like:
Code:
on 1:TEXT:*:?:{
  if ( hlogin == $1 ) { 
    if ( $2 == %helperpass) {
      hadd -sm helpers $nick 1
      msg $nick Helper $nick added succesfully
      halt
    }
  }
  if ( pnn isin $1 ) {
    var %hnum = $2
    if ( $hfind(helpers,$nick).data !== $null) {
      var %i = 1
      while (%i <= %hnum) {
        mode #newbiehelp +m $hfind(helpreqs,%i).data
        inc %i
      }
      var %i = 1
      while (%i <= $hget(helpreqs,0).item ) {
        hadd -s helpreqs %i $hfind(helpreqs,(%i + 1)).data
        hdel -s helpreqs (%i + 1)
        inc %i
      }
    }
    halt
  }
}


Why doesnt this work?

[EDIT] Just tested and this code wont work neither frown
Code:
on *:join:#newbiehelp:{
if ($hfind(helpreqs, $nick)) {}
else {
/hadd -ms helpreqs $calc($hget(helpreqs,0).item + 1) $nick
/echo -st $nick added to list
}
}

[/EDIT]

Last edited by Remo; 31/01/05 05:46 AM.
Joined: Nov 2004
Posts: 332
R
Fjord artisan
Offline
Fjord artisan
R
Joined: Nov 2004
Posts: 332
you know you have to put something in the {}
i used halt for testing

and hmm granted i dont know much
but
Code:
  
on 1:TEXT:*:?:{
  if ( hlogin == $1 ) { 
    if ( $2 == %helperpass) {
      hadd -sm helpers $nick 1
      msg $nick Helper $nick added succesfully
      halt
    }
  }
  if ( pnn isin $1 ) {
    var %hnum = $2
    if ( $hfind(helpers,$nick).data !== $null) {
      var %i = 1
      while (%i <= %hnum) {
        mode #newbiehelp +m $hfind(helpreqs,%i).data
        inc %i
      }
      var %i = 1
      while (%i <= $hget(helpreqs,0).item ) {
        hadd -s helpreqs %i $hfind(helpreqs,(%i + 1)).data
        hdel -s helpreqs (%i + 1)
        inc %i
      }
    }


The Kodokan will move you, one way or another.
Joined: Jan 2005
Posts: 10
R
Remo Offline OP
Pikka bird
OP Offline
Pikka bird
R
Joined: Jan 2005
Posts: 10
Its like that now and its still not working frown.
the on join event is not working neither frown.
I have no idea whats wrong and Im about to shoot myself frown.

Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
Well one thing is mIRC won't do on-the-fly calcing like this
  • hadd -s helpreqs %i $hfind(helpreqs,(%i + 1)).data
    hdel -s helpreqs (%i + 1)


Try $calc()
  • hadd -s helpreqs %i $hfind(helpreqs,$calc(%i + 1)).data
    hdel -s helpreqs $calc(%i + 1)

Joined: Jan 2005
Posts: 10
R
Remo Offline OP
Pikka bird
OP Offline
Pikka bird
R
Joined: Jan 2005
Posts: 10
gotcha. Changed that.
I bet that works now but havent been able to make the login work:
Code:
on 1:TEXT:*:?:{
  if ( hlogin == $1 ) { 
    if ( $2 == %helperpass) {
      hadd -sm helpers $nick 1
      msg $nick Helper $nick added succesfully
      halt
    }
  }
.....
}

nor the on join code works:
Code:
on 1:join:#newbiehelp:
if ($hfind(helpreqs,$nick).data !== $null) { halt }
else { 
  /hadd -ms helpreqs $calc($hget(helpreqs,0).item + 1) $nick
  /echo -st $nick added to list
}

Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
The join is still missing braces...
Code:
on 1:join:#newbiehelp:[color:red]{[/color]
  if (!$hfind(helpreqs,$nick).data) {
    hadd -ms helpreqs $calc($hget(helpreqs,0).item + 1) $nick
    echo -st $nick added to list
  }
[color:red]}[/color]

Joined: Jan 2005
Posts: 10
R
Remo Offline OP
Pikka bird
OP Offline
Pikka bird
R
Joined: Jan 2005
Posts: 10
okay.... dumb me.... frown
Well on join works now *trumpet sounds and people yelling Hail to the brackets*
Then a voice on the back "Hey the login method still wont work!" and its all sad again"
What I mean was. Thanks! on join works now laugh.

Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
Okay what data is in the %helperpass variable?

Joined: Jan 2005
Posts: 10
R
Remo Offline OP
Pikka bird
OP Offline
Pikka bird
R
Joined: Jan 2005
Posts: 10
the helpers password, wich is hpass

Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
Then it should work fine
Try this, if this worls you probably have another text event which is conflicting.
Code:
on *:text:hlogin &:?:{
  if ($2 == %helperpass) {
    hadd -sm helpers $nick 1
    msg $nick Helper $nick added succesfully
  }
}

Joined: Jan 2005
Posts: 10
R
Remo Offline OP
Pikka bird
OP Offline
Pikka bird
R
Joined: Jan 2005
Posts: 10
Ok now it works. Thanks a lot. Really mean it.
I had one extra command for helpers at the end of that file..... just sent the login to another file and all the commands in another file and works fine.


Thank you all.


Link Copied to Clipboard