mIRC Home    About    Download    Register    News    Help

Print Thread
#253556 20/06/15 01:45 AM
Joined: Jun 2015
Posts: 6
M
Mike512 Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
M
Joined: Jun 2015
Posts: 6
Hey I hope some one can help I've looked a lot of places for an answer and can't seem to find one that works. I would like to make a script that builds up some responses, then posts them in one msg to the channel every 10 sec. Here is what I have so far:
Code:
on *:text:!vp:#: {
     write -a vplookup.txt  $nick has $readini(gold.ini,$ (#,.,$nick),Points) Victory Points! |
     if (%vplook = 1) { return }
     .timer 0 10 vpcheck
     set %vplook 1
}

alias -l vpcheck {
msg #channel $read(vplookup.txt)
set %vplook 0
write -c vplookup.txt
return
}


This works for collecting the points outputs but post them to separate lines so I just get a random one out in the end. I would like it to post all to one line so its all in one msg. Thanks for taking the time to help guys!

Joined: Jun 2015
Posts: 6
M
Mike512 Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
M
Joined: Jun 2015
Posts: 6
I have been playing around with it and I have got it to work. Still wondering if there is a better way to do it but here is what i got.
Code:
on *:text:!vp:#:{
       if (%x = 4) {
      set %e $nick has $readini(gold.ini,$+(#,.,$nick),Points) Victory Points! |
      inc %x
      set %vplook 0
      vpcheck $chan
        }
       if (%x = 3) {
      set %d $nick has $readini(gold.ini,$+(#,.,$nick),Points) Victory Points! |
      inc %x
        }
       if (%x = 2) {
      set %c $nick has $readini(gold.ini,$+(#,.,$nick),Points) Victory Points! |
      inc %x
        }
       if (%x = 1) {
      set %b $nick has $readini(gold.ini,$+(#,.,$nick),Points) Victory Points! |
      inc %x
        }
       if (%x = 0) {
      set %a $nick has $readini(gold.ini,$+(#,.,$nick),Points) Victory Points! |
      inc %x
        }
     write vplookup.txt %a $+ %b $+ %c $+ %d $+ %e
    if (%vplook = 1) { return }
    timer1 1 10 vpcheck $chan
     set %vplook 1
}

alias -l vpcheck {
msg $1 $read(vplookup.txt)
set %vplook 0
set %a
set %b
set %c
set %d
set %e
set %x 0
write -c vplookup.txt
return
}

Joined: May 2015
Posts: 249
Fjord artisan
Offline
Fjord artisan
Joined: May 2015
Posts: 249
1. You can use ONE var to store whole reply, like " set %x %x %user with %user_points"
2. You can use "set -u10 %checker" for:
2.1 if %x is empty - you set %x with new reply and set -u %checker
2.2 if %x is not empty and %checker exists - add new reply to %x (see 1.)
2.3 if %x is not empty and %checker do not exist (expired after -u secs) - post %x to channel and set %x $null.


Dont give a fish - teach to fish!
Joined: Jun 2015
Posts: 6
M
Mike512 Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
M
Joined: Jun 2015
Posts: 6
Thanks. Just a few questions. Im not sure how to add more info into an existing var.

And if I use set -u10 %checker then it wont post till another command comes in and it checks for %x is not empty and %checker does not exist. I think timer is still my best bet on that.

I want it to once the first command comes in wait 10s to see if anyone else is going to use the same command and then post all of the to a single msg. if only one person posts the command then I still want it to trigger.

Joined: May 2015
Posts: 249
Fjord artisan
Offline
Fjord artisan
Joined: May 2015
Posts: 249
Add /timer to 2.1, and about adding something to existing %var - see 1.


Dont give a fish - teach to fish!
Joined: Jun 2015
Posts: 6
M
Mike512 Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
M
Joined: Jun 2015
Posts: 6
thanks thats works great so simple. here is the code i have now just to make sure but it seems to work fine.

Code:
on *:text:!vp:#:{
if ($($+(%,floodvp.,$nick),2)) { return }
 set %user_points $nick has $readini(gold.ini,$+(#,.,$nick),Points) Victory Points! |
 set %x %x %user_points
 set -u30 %floodvp. $+ $nick On
    if (%vplook = 1) { return }
    timer1 1 10 vpcheck $chan
     set %vplook 1
}

alias -l vpcheck {
msg $1 %x
set %x
set %vplook
return
}

Last edited by Mike512; 21/06/15 12:09 AM.
Joined: May 2015
Posts: 249
Fjord artisan
Offline
Fjord artisan
Joined: May 2015
Posts: 249
Code:
if (%vplook = 1) { return }

should be
Code:
if (%vplook == 1) { return }

Looks not perfect, but should work as you wanted.


Dont give a fish - teach to fish!
Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
A single = is a valid comparison

Joined: May 2015
Posts: 249
Fjord artisan
Offline
Fjord artisan
Joined: May 2015
Posts: 249
Hm, is it a "new" (less then 10 years) change or was it always (10+ years ago) working?:)

Last edited by splinny; 21/06/15 05:06 AM.

Dont give a fish - teach to fish!

Link Copied to Clipboard