mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jan 2003
Posts: 38
T
Ameglian cow
OP Offline
Ameglian cow
T
Joined: Jan 2003
Posts: 38
ok, ive got a problem with the $get() identifier in some of my treeview switchbar.. the problem is descibed after the code i currently use

Code:
ctcp *:dcc send *:?:{
  unset %dcc.get
  var %n = 1 
  while ($get(%n)) {
    set %dcc.get $addtok(%dcc.get,$ifmatch,32)
    inc %n
  }
  [color:red];This sets another var and starts another timer that checks to see if the
  ;send has started (ie. been accepted)[/color]
  set %dcc.acc $true
  [color:red];switchbar reload [/color]
  .timer -m 1 1 load.switchbar
  .timerdcc.acc 0 1 dcc.acc
}
[color:red];The above makes a variable that contains the nick of the send
;(yeah i know it wont work with more then 1 sender)[/color]

alias dcc.acc {
  if (!%dcc.acc) { .timerdcc.acc off | halt }
  elseif ($get(0) >= 1) {
    var %n = 1
    while ($get(%n)) {
      if ($get(%n).rcvd > 1) {
        .timer -m 1 1 load.switchbar
        unset %dcc.acc
      }
      inc %n
    }
  }
  elseif ($send(0) >= 1) {
    var %x = 1
    while ($send(%x)) {
      if ($send(%x).sent > 1) {
        .timer -m 1 1 load.switchbar
        unset %dcc.acc
      }
      inc %x
    }
  }
}
[color:red];The above is the alias that checks if the sends/gets have been accepted and
;have started to send the file[/color]

alias dcc.canc {
  if ($get(0) < $numtok(%dcc.get,32)) { .timer -m 1 1 load.switchbar | .timerdcc.canc off }
  else { .timerdcc.canc off | halt }
}
[color:red];Above checks the %dcc.get variable and trys to match the amount of open dcc
;get windows with the amount that was accepted, if
;less than the var, it updates the switchbar. (the else i added in hope for a miracle so dont
;bother about it unless u figure its important)[/color]

on *:getfail:*:{
  .timer -m 1 1 load.switchbar
  .timerdcc.canc 0 1 dcc.canc
  echo -a Failed to receive $nopath($filename) from $nick ( $+ $_comchan($nick) $+ )
}
[color:red];Starts the timer that starts the alias that checks for any closed windows[/color]

so the problem, nothing gets added to the %dcc.get variable, it seems fairly simple but ive tried to place the set at different lines inside the { } but still no reaction.
i tried to make an alias that was run istead of the /set.. but that didnt work aswell, and i tried replaceing the $ifmatch with $get(0),
and it returned 0 in the variable
The wierd thing is that it works perfectly in the switchbar which updates almost instantly (the timer is on 1ms), all the info appears (sender, file, size, status) but nothing in the variable!
This is the code used in the switchbar:

Code:
var %x = 1
while (%x <= $get(0)) {
  did -a switchbar 1 +e 3 3 0 $iif($len($get(%x).file) > 20,$wrap($left($get(%x).file,20),arial,12,95,0,1) $&
  $+ ...,$get(%x).file)) $+(	,File: $get(%x).file $cr $+ Sender: $get(%x) $&
  $cr $+ Size: $bytes($get(%x).size,m) $+ Mb $cr $+ Com. channels: $_comchan($get(%x)) $&
  $cr $+ Status: $get(%x).status )
  inc %x
}

So i dont know if i need to re-evaluate the $ifmatch or the $get(0) nor do i know why or if i need a completely different code for it all to happen! confused

For me this is a big problem, dunno if it is for anyone else, but i REALLY would like help with a solution for it, or WHY it wouldnt work frown

Joined: Dec 2002
Posts: 143
A
Vogon poet
Offline
Vogon poet
A
Joined: Dec 2002
Posts: 143
if you are not actually sending a file to someone, but waiting for the response, does $get(0) include the nick because you're not sending anything?

why not have an echo -a $get(0) before the while loop to see if it is actually returning a value

- Just a couple of suggestions! (sorry if it sounds like I'm trying to teach you to suck eggs!) - just the obvious answers are often missed!


Aubs.
cool

Joined: Jan 2003
Posts: 38
T
Ameglian cow
OP Offline
Ameglian cow
T
Joined: Jan 2003
Posts: 38
The $get(0) gives the total number of dcc get's (and windows that are open i think) so if u have someone sending you 1 file it should be $get(1) and so on, that returns the senders nick

I gave it a try and the reply was: 0, just as when i tried it in the variable, but it still works for the rest of the switchbar
So im still were i was smirk

heh smile np, you learn/remember stuff better if you have to do it several times smirk

Joined: Dec 2002
Posts: 699
N
Fjord artisan
Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 699
Code:
ctcp *:dcc send *:?:{
  unset %dcc.get
  var %n = 1
  while ($get(%n)) {
    set %dcc.get %dcc.get $ifmatch
    inc %n
  }
 
  [color:green]; $get() won't catch this send, so add it in.
  set %dcc.get %dcc.get $nick[/color]
 
  ;This sets another var and starts another timer that checks to see if the
  ;send has started (ie. been accepted)
  set %dcc.acc $true
  ;switchbar reload
   .timer -m 1 1 load.switchbar
  .timerdcc.acc 0 1 dcc.acc
}

Joined: Jan 2003
Posts: 38
T
Ameglian cow
OP Offline
Ameglian cow
T
Joined: Jan 2003
Posts: 38
Omg nice!! laugh thank you thank you thank you thank you thank you !!!!!!!

So basicly i wouldnt need the while loop?? or no, if i still have some running..
But could you tell me why it didnt work??

Can i do something for you in return btw!?!? Ive been trying to get this to work for 2 weeks without managing it!
You want the switchbar code?? You probably already have one, but still... smile
All the switchbar needs now is some sclicks, highlighting when someone just types text and when someone types your nick, thats really all it needs! oh yeah, some testing aswell, running at 1152x864 so i dunno how it would react with smaller/bigger...

Cant thank you enough!!
Thank you!!!

PS. a screenshot of the switchbar (119k): treeview switchbar
i still have the old one, since the new one needs the sclicks to switch channels smile


Link Copied to Clipboard