mIRC Home    About    Download    Register    News    Help

Print Thread
More problems with a dialog #137730 18/12/05 03:05 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
This first picture shows the current display when information is initially entered, and it should be the same display after pressing the Store New Info button, as well as when the information is recalled (presuming nothing new has been added)


This next picture shows what is currently being displayed after the Store New Info button has been pressed


And, finally, this last picture shows what is being displayed when the information is recalled


Here's what I believe are the relevant sections of my code.
Code:
 on *:DIALOG:Observer:sclick:7: {  
  set %acct $iif($did($dname,$did).seltext,$v1,$did($dname,$did)) 
  did -ra $dname 9 $hget($dname,$+(%rte,.,%acct,.Name))  
  did -ra $dname 11 $hget($dname,$+(%rte,.,%acct,.Address))  
  did -ra $dname 13 $hget($dname,$+(%rte,.,%acct,.Apt)) 
  did -ra $dname 15 $hget($dname,$+(%rte,.,%acct,.Phone)) 
  did $iif($hget($dname,$+(%rte,.,%acct,.Active)),-c,-u) $dname 18 
  did -ra $dname 122 $asctime($hget($dname,$+(%rte,.,%acct,.Expiry)),mmm dd yyyy) 
  var %x = 1, %lines = $hfind($dname,$+(%rte,.,%acct,.data.*),0,w) 
  while (%x <= %lines) { 
    var %data = $hget($dname,$+(%rte,.,%acct,.data.,%x)) 
    did -a $+ $iif(%x = 1,r) $dname 118 $iif($gettok(%data,1,44) != -, $asctime($v1,mmm dd yyyy),-) 
    did -a $+ $iif(%x = 1,r) $dname 37 $iif($gettok(%data,2,44) != -, $asctime($v1,mmm dd yyyy),-) 
    did -a $+ $iif(%x = 1,r) $dname 38 $gettok(%data,3,44) 
    did -a $+ $iif(%x = 1,r) $dname 43 $gettok(%data,4,44) 
    did -a $+ $iif(%x = 1,r) $dname 39 $iif($gettok(%data,5,44) != -, $asctime($v1,mmm dd yyyy),-) 
    did -a $+ $iif(%x = 1,r) $dname 45 $gettok(%data,6,44) 
    inc %x 
  } 
  did -ca $dname 17 $hget($dname,$+(%rte,.,%acct,.Delivery)) 
  did -ca $dname 127 $hget($dname,$+(%rte,.,%acct,.Billing)) 
  var %balance = $calc(($ctime($did($dname,122)) - $ctime) / 1209600) 
  var %balance = $calc(%balance * $iif(($left($did($dname,17),1) == D) || ($did($dname,17).sel == 1),6.8,3)) 
  var %decimal = $len($gettok($round(%balance,2),-1,46)) 
  did -ra $dname 34 $iif(!%balance,$0.00,$+($,%balance,$iif(!%decimal,.00,$iif(%decimal = 1,0)))) 
} 
on *:DIALOG:Observer:sclick:3: { 
  var %rte = $iif(!$did($dname,5).seltext,$did($dname,5),$did($dname,5).seltext)  
  var %acct = $iif(!$did($dname,7).seltext,$did($dname,7),$did($dname,7).seltext)  
  .hadd -m $dname $+(%rte,.,%acct,.Name) $did($dname,9) 
  .hadd -m $dname $+(%rte,.,%acct,.Address) $did($dname,11) 
  .hadd -m $dname $+(%rte,.,%acct,.Apt) $did($dname,13) 
  if !$did($dname,15) { 
    find.a.person $gettok($did($dname,9),1,44) $iif($gettok($did($dname,9),2-,44),$v1) 
  } 
  .hadd -m $dname $+(%rte,.,%acct,.Phone) $did($dname,15) 
  .hadd -m $dname $+(%rte,.,%acct,.Active) $did($dname,18).state 
  .hadd -m $dname $+(%rte,.,%acct,.Expiry) $ctime($did($dname,122)) 
  var %balance = $calc(($ctime($did($dname,122)) - $ctime) / 1209600) 
  var %balance = $calc(%balance * $iif(($left($did($dname,17),1) == D) || ($did($dname,17).sel == 1),6.8,3)) 
  var %decimal = $len($gettok($round(%balance,2),-1,46)) 
  did -ra $dname 34 $iif(!%balance,$0.00,$+($,%balance,$iif(!%decimal,.00,$iif(%decimal = 1,0)))) 
  if ($did($dname,122).edited == $true) { 
    did -a $dname 118,37 - 
    did -a $dname 38 $did($dname,38,$did($dname,38).lines) 
    did -a $dname 43 $did($dname,43,$did($dname,43).lines) 
    did -a $dname 39 $asctime($ctime,mmm dd yyyy) 
    did -a $dname 45 $did($dname,34) 
  } 
  else did -a $dname 39,45 - 
  var %lines = $did($dname,118).lines, %line = $calc($hfind($dname,$+(%rte,.,%acct,.data.*),0,w) + 1) 
  set %columns 118 37 38 43 39 45 
  while %line <= %lines { 
    var %col = 1 
    while %col <= $numtok(%columns,32) { 
      var %data = $iif($chr(32) isin $did($dname,$gettok(%columns,%col,32),%line),$ctime($v2),$v2) 
      set %entry $instok(%entry,%data,%col,44) 
      inc %col 
    } 
    .hadd -m $dname $+(%rte,.,%acct,.data.,%line) %entry 
    inc %line 
  } 
} 
 

I have further steps to go before this project is complete, but until these problems have been resolved, there's not much I can do with the next step.

Last edited by RusselB; 18/12/05 03:07 PM.
Re: More problems with a dialog #137731 18/12/05 05:38 PM
Joined: Oct 2005
Posts: 1,741
G
genius_at_work Offline
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
Can you post an image with DID numbers over each relevant item? I don't know what each command does if I can't see what the item dids are.

-genius_at_work

Re: More problems with a dialog #137732 18/12/05 05:51 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
If you can tell me how I would get that information displayed.

Re: More problems with a dialog #137733 18/12/05 06:13 PM
Joined: Nov 2005
Posts: 42
A
Aenei Offline
Ameglian cow
Offline
Ameglian cow
A
Joined: Nov 2005
Posts: 42
Quote:
If you can tell me how I would get that information displayed.

Can you not just get the dialog up (or use your previously posted pictures) then using PaintshopPro/PhotoShop/Corel - even MS Paint! put the did's on?

Re: More problems with a dialog #137734 18/12/05 06:43 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Thanks for the suggestion...here's the result


I didn't bother putting the ID's with the items that aren't having problems.

Re: More problems with a dialog #137735 20/12/05 02:54 AM
Joined: Oct 2005
Posts: 1,741
G
genius_at_work Offline
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
In the first onDIALOG event, there is a variable called %rte . I see it set as a /var in the second onDIALOG, but I don't see it being set anywhere within the first event. If that variable is not set as a global variable from a previous event, that might be your problem. If the variable is set elsewhere, please let me know what value it holds.

You may want to try temporarily making your own hget alias so that you can see what values are actually being passed to hget. Maybe something like this:

alias hget {
echo -s $!hget( $1 , $2 )
return $hget($$1,$$2)
}

-genius_at_work

Last edited by genius_at_work; 20/12/05 02:58 AM.
Re: More problems with a dialog #137736 20/12/05 06:44 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
That was my fault..I started using global variables, then switched to local variables but missed switching some of them over. Anyhow, with some guess work and working on this after a good nights sleep, I've got that working.

In relation to that dialog, I also have found a problem with the socket code, specifically if there's no match using first & last name, then I want to search again using just last name..and I also need a message if there is no match.

My socket code follows
Code:
alias find.a.person { 
  if (!$isid) { 
    set %lastname $1 
    set %firstname $2 
    set %street.num $gettok($did(Observer,11),1,32)
    set %street.name $gettok($did(Observer,11),2-,32)
    set %apt $did(Observer,13)
    sockopen findap findaperson.canada411.ca 80 
  } 
} 
on *:sockopen:findap:{ 
  did -b Observer 1,2,3,50
  unset %match
  unset %page*
  sockwrite -n $sockname GET $+(/10649/search/Find_Person?firstname_begins_with=1&firstname=,%firstname,&name_begins_with=1&name=,%lastname,&city_zip=Sarnia&state_id=ON) HTTP/1.1 
  sockwrite -n $sockname Host: findaperson.canada411.ca $+ $crlf $+ $crlf 
} 
on *:sockread:findap:{ 
  if ($sockerr) { 
    echo -a some error occurred oh no. 
    return 
  } 
  else { 
    var %nc 
    sockread %nc
    echo -a %nc
    if ($+(*,We're sorry.  Your search returned no results.,*) iswm %nc) {
      sockclose findap
      did -e Observer 1,2,3,50
      unset %firstname
      sockopen findap findaperson.canada411.ca 80
    }
    elseif ($+(*,%street.num,*,%apt,*,%street.name,*) iswm %nc) {
      var %nc = $right(%nc,20)
      var %nc = $left(%nc,14)
      echo -s %nc
      did -ra Observer 15 %nc
      set %match found
    }
    elseif (*search_id* iswm %nc) && !%search_id {
      set %search_id $gettok(%nc,2,34)
      set %search_id $gettok(%search_id,-1,61)
    }
    elseif ($+(*,%lastname,*,%firstname,*,Total*) iswm %nc) {
      var %nc = $gettok(%nc,-2,32)
      var %nc = $gettok(%nc,-1,62)
      set %pages $calc($int($calc(%nc / 10)) + 1)
      set %pages $calc(%pages - 1)
    }
    elseif ((</html* iswm %nc) || (%match)) {
      sockclose findap
      did -e Observer 1,2,3,50
      if ((!%match) && (%pages)) {
        inc %page
        sockopen findap $+ %page findaperson.canada411.ca 80
      }
    }
  } 
}

on *:sockopen:$(findap $+ %page):{
  did -b Observer 1,2,3,50
  set %limit $calc(%page * 10 + 1)
  sockwrite -n $sockname GET $+(/10649/search/Alpha_Limit?search_id=,%search_id,&old_search_type=Find_Person&sort=&alpha_limit=&lower=,%limit,) HTTP/1.1
  sockwrite -n $sockname Host: findaperson.canada411.ca $+ $crlf $+ $crlf 
}

on *:sockread:$(findap $+ %page):{
  if ($sockerr) { 
    echo -a some error occurred oh no. 
    return 
  } 
  else { 
    var %nc 
    sockread %nc
    if ($+(*,%street.num,*,%apt,*,%street.name,*) iswm %nc) {
      var %nc = $right(%nc,20)
      var %nc = $left(%nc,14)
      echo -s %nc
      did -ra Observer 15 %nc
      set %match found
      sockclose findap*
    }
  }
  elseif ((</html* iswm %nc) || (%match)) {
    sockclose findap*
    did -e Observer 1,2,3,50
    if ((!%match) && (%pages)) {
      inc %page
      sockopen findap $+ %page findaperson.canada411.ca 80
    }
  }
} 
  

Re: More problems with a dialog #137737 26/12/05 07:03 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Any ideas? I'd really like to get this project completed before the New Year. Fortunately I'm thinking it's about 90% complete at the moment, but this problem with the sockets (while not technically important), would really save a lot of hassle, since I could set the main dialog to ignore the names that don't return a valid entry, rather than have the script try to look up the information every time (which, when complete, will be close to, if not, a daily basis)