Skip to content
General IRCX

Need Help With Dialog / Ini Reading

A TG007 community discussion started by JasonK.

Discussion 2 posts
Page 1 of 1
Open
Topic #11366 · 2 published posts · 1,680 views

Hello,

 

I am trying to create a dialog with a bunch of check boxes,

 

dialog new_table {
  title "New Project"
  size -1 -1 103 75
  option dbu
  box "", 2, 1 0 100 73
  text "Log the following:", 6, 4 5 51 8
  check "Kicks", 14, 52 14 24 10
  check "Text", 11, 52 23 24 10
  check "Actions", 27, 52 32 28 10
  check "Aways", 12, 52 41 28 10
  check "Returns", 13, 52 50 31 10
  check "IP Address", 7, 6 14 40 10
  check "GateKeeper", 8, 6 23 40 10
  check "Joins", 9, 6 32 26 10
  check "Parts", 10, 6 41 24 10
  check "Quits", 15, 6 50 26 10
}

 

 

And using an ini file with the line:

 

test.ini

 

[settings]

Log=IP,GATE,JOINS,PARTS,QUITS,KICKS,TEXT,ACTION,AWAY,RETURN

 

How can I make the dialog read from the ini file with this line and tick off the boxes based on what items are in the Log?

 

this is what I have so far, but I think its poorly written and sloppy

 

var %f = $+($scriptdir,seen\,seen.ini)
    var %log = $readini(%f,Settings,Log)
    Tokenize 44 %log
    if (IP isin $1-) { did -c $dname 7 }

 

Thanks a bunch.

 

Cheers,

 

Jay

 

That doesn't work?

 

Ok, you have a line of data seperated by the comma token. $chr(44)

 

$readini(seen\seen.ini,settings,log) == IP,GATE,JOINS,PARTS,QUITS,KICKS,TEXT,ACTION,AWAY,RETURN

 

 

You do not need to tokenize 44 this line, it already is. That's a good idea to save this to a local variable since you will have to keep referring to it for each check box.

 

How you did it should be fine.

 

on *:dialog:<name>:init:*:{
  var %ini = $readini(seen\seen.ini,settings,log)
  if (IP isin %ini) { did -c $dname 7 }
  if (Gate isin %ini) { did -c $dname 8 }
}

 

Alternatively you could set them in the ini line as the number of the check box they are.

 

$readini(seen\seen.ini,settings,log) == 11,27,12

 

This means boxes 11,27 & 12 are checked.

 

Then you could use a loop in your init event.

 

var %ini = $readini(seen\seen.ini,settings,log), %xx = $numtok(%ini,44)
while (%xx) {
did -c $dname $gettok(%ini,%xx,44)
dec %xx
}

 

Just an idea. :)