mIRC Home    About    Download    Register    News    Help

Print Thread
#131696 03/10/05 04:12 AM
Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
OP Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
ok, I was trying to make a dialog to work with user levels in mIRC, however the dialog will reload with out the data updating even though if i open the users (alt r u) it is updated there.
after viewing the users section in the ini it Does update correctly so I tried using flushini, which didn't seem to work.
So, did I do something wrong or is that just the way user levels behave in mIRC?
Code:
alias level.load { dialog -m level.load level.load }
dialog level.load {
  title "User Level Manager"
  size -1 -1 200 95
  option dbu
  list 1, 1 1 99 78, sort
  edit "", 2, 121 1 79 10
  edit "", 3, 121 15 79 10
  edit "", 4, 121 25 79 10
  edit "", 5, 121 35 79 10
  edit "", 6, 121 45 79 10
  edit "", 7, 121 55 79 10
  edit "", 8, 121 65 79 10
  edit "New User", 100, 1 79 99 10
  text "Levels", 201, 101 1 20 10
  text "D.O.B.", 202, 101 15 20 10
  text "Sex",    203, 101 25 20 10
  text "EMail",  204, 101 35 20 10
  text "Name",   205, 101 45 20 10
  text "Address", 206, 101 55 20 10
  text "Phone",  207, 101 65 20 10
  button "Add/Update", 301, 121 80 39 10
  button "Remove User", 302, 161 80 39 10
}
on *:dialog:level.load:init:0:{ loadup.levels }
alias loadup.levels {
  var %t.users = $ini(remote.ini,users,0)
  var %i = 1
  while (%i <= %t.users) {
    var %n.user = $ini(remote.ini,users,%i)
    did -a level.load 1 $gettok($gettok($readini(remote.ini,users,%n.user),1,32),2,58)
    inc %i
  }
}
on *:dialog:level.load:sclick:1:{
  did -r level.load 2,3,4,5,6,7,8,100
  did -a level.load 100 $did(level.load,1).seltext
  did -a level.load 2 $remove($level($did(level.load,1).seltext),=)
  var %user.info = $ulist($did(level.load,1).seltext).info
  var %user.info.t = $gettok(%user.info,0,124)
  var %i = 1
  var %x = 3
  while (%i <= %user.info.t) {
    did -a level.load %x $gettok(%user.info,%i,124)
    inc %i
    inc %x
  }
}
on *:dialog:level.load:sclick:301:{
  auser $did(level.load,2) $did(level.load,100)
  iuser $did(level.load,100) $+($did(level.load,3),$chr(124),$did(level.load,4),$chr(124),$did(level.load,5),$chr(124),$did(level.load,6),$chr(124),$did(level.load,7),$chr(124),$did(level.load,8))
  flushini remote.ini
  did -r level.load 1,2,3,4,5,6,7,8,100
  loadup.levels
}
on *:dialog:level.load:sclick:302:{ 
  ruser $did(level.load,1).seltext
  flushini remote.ini
  did -r level.load 1,2,3,4,5,6,7,8,100
  loadup.levels
}

#131697 03/10/05 08:34 AM
Joined: Jul 2003
Posts: 655
Fjord artisan
Offline
Fjord artisan
Joined: Jul 2003
Posts: 655
Try using something like ".timer -m 20 1 loadup.levels" instead of just plain "loadup.levels". (not neccersary in the init)
This will ensure that the entire script has finished processing and exited the events/aliases before it attempts to reload/refresh the dialog.


"Allen is having a small problem and needs help adjusting his attitude" - Flutterby
#131698 03/10/05 04:10 PM
Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
OP Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
it is with adding a new user and removing a user, the delay is in minutes so your idea wont work
The help files do mention that ruser will be delayed while mIRC does a lookup.
Quote:

Note: The /guser and /ruser commands do a /userhost on a nick to find the nick's address, thus they are delayed commands since they need to wait for a reply from the server. mIRC tries to get around this delay by maintaining it's own Internal Address List which will speed things up in certain situations.

#131699 03/10/05 04:58 PM
Joined: Jul 2003
Posts: 655
Fjord artisan
Offline
Fjord artisan
Joined: Jul 2003
Posts: 655
Going on the assumption from your code that $did(level.load,1).seltext in the ruser command represents the nickname, couldn't you just specify the address so it does not have to do a userhost lookup?


"Allen is having a small problem and needs help adjusting his attitude" - Flutterby
#131700 03/10/05 05:32 PM
Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
OP Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
That might speed things up, but I was making up names anyway.
Operating on the premis that you might want to add a user without them actually being online at the time you set them up.
Oh well, it isn't anything that I can find in what I wrote so I am not going to worry over it too much.
That being said there was changes in the .info part of what I did to deal with blank areas from messing up the other fields.
Code:
alias level.load { dialog -m level.load level.load }
dialog level.load {
  title "User Level Manager"
  size -1 -1 200 95
  option dbu
  list 1, 1 1 99 78, sort
  edit "", 2, 121 1 79 10
  edit "", 3, 121 15 79 10
  edit "", 4, 121 25 79 10
  edit "", 5, 121 35 79 10
  edit "", 6, 121 45 79 10
  edit "", 7, 121 55 79 10
  edit "", 8, 121 65 79 10
  edit "New User ", 100, 1 79 99 10
  text "Levels  ", 201, 101 1 20 10
  text "D.O.B. ", 202, 101 15 20 10
  text "Sex    ", 203, 101 25 20 10
  text "EMail  ", 204, 101 35 20 10
  text "Name   ", 205, 101 45 20 10
  text "Address", 206, 101 55 20 10
  text "Phone  ", 207, 101 65 20 10
  button "Add/Update ", 301, 121 80 39 10
  button "Remove User", 302, 161 80 39 10
}
on *:dialog:level.load:init:0:{ loadup.levels }
alias loadup.levels {
  var %t.users = $ini(remote.ini,users,0)
  var %i = 1
  while (%i <= %t.users) {
    var %n.user = $ini(remote.ini,users,%i)
    did -a level.load 1 $gettok($gettok($readini(remote.ini,users,%n.user),1,32),2,58)
    inc %i
  }
}
on *:dialog:level.load:sclick:1:{
  did -r level.load 2,3,4,5,6,7,8,100
  did -a level.load 100 $did(level.load,1).seltext
  did -a level.load 2 $remove($level($did(level.load,1).seltext),=)
  var %user.info = $ulist($did(level.load,1).seltext).info
  var %user.info.t = $gettok(%user.info,0,124)
  var %i = 1
  var %x = 3
  while (%i <= %user.info.t) {
    did -a level.load %x $replace($gettok(%user.info,%i,124),$chr(9),$chr(32))
    inc %i
    inc %x
  }
}
on *:dialog:level.load:sclick:301:{
  .auser $did(level.load,2) $did(level.load,100)
  .iuser $did(level.load,100) $+($did(level.load,3) $chr(9),$chr(124),$did(level.load,4) $chr(9),$chr(124),$did(level.load,5) $chr(9),$chr(124),$did(level.load,6) $chr(9),$chr(124),$did(level.load,7) $chr(9),$chr(124),$did(level.load,8))
  flushini remote.ini
  did -r level.load 1,2,3,4,5,6,7,8,100
  loadup.levels
}
on *:dialog:level.load:sclick:302:{ 
  .ruser $did(level.load,1).seltext
  flushini remote.ini
  did -r level.load 1,2,3,4,5,6,7,8,100
  loadup.levels
}


Link Copied to Clipboard