mIRC Home    About    Download    Register    News    Help

Print Thread
Converting %vars to a hash or ini file #110142
05/02/05 12:03 AM
05/02/05 12:03 AM
Joined: Sep 2004
Posts: 237
New Orleans
JAFO Offline OP
Fjord artisan
JAFO  Offline OP
Fjord artisan

Joined: Sep 2004
Posts: 237
New Orleans
I have a ton of this stuff.
on *:DIALOG:ME:sclick:*: {
set %ME104 $iif($did(104).state == 1,ON,OFF)

on *:DIALOG:ME:INIT:0: {
if (%ME104 == On) { did -c ME 104 }

I don't mean to be a bother, i was just reading a post that covered this last night and i can't remember where the post is. I would like to get rid of all those variables to either a hash or ini file. If you know where that thread is that will be more than enough info.
Thanks!

Re: Converting %vars to a hash or ini file #110143
05/02/05 12:44 AM
05/02/05 12:44 AM
Joined: Aug 2003
Posts: 1,831
I
Iori Offline
Hoopy frood
Iori  Offline
Hoopy frood
I

Joined: Aug 2003
Posts: 1,831
Convert existing vars to hash...
Code:
  var %i = 1
  ; find all matching vars
  while $var(%me*,%i) {
    ; hadd them (you can remove the -m switch, it only makes sure the hash table is open.
    ; - $mid($v1,2) removes the first char from the varname (the "%") 
    ; - $($v1,2) is the vars value
    hadd -m tablename $mid($v1,2) $($v1,2)
    inc %i
  }
  unset %me*


On dialog events...
Code:
on *:DIALOG:ME:sclick:*:{
  hadd -m Tablename ME104 $iif($did(104).state == 1,ON,OFF)
 ...
}
on *:DIALOG:ME:INIT:0: {
  if $hget(tablename,ME104) == On { did -c ME 104 }
 ...
}

Re: Converting %vars to a hash or ini file #110144
05/02/05 01:10 AM
05/02/05 01:10 AM
Joined: Sep 2004
Posts: 237
New Orleans
JAFO Offline OP
Fjord artisan
JAFO  Offline OP
Fjord artisan

Joined: Sep 2004
Posts: 237
New Orleans
Thanks a LOT!!!!!!!!!!!!!!!!

Re: Converting %vars to a hash or ini file #110145
06/02/05 02:14 AM
06/02/05 02:14 AM
Joined: Sep 2004
Posts: 237
New Orleans
JAFO Offline OP
Fjord artisan
JAFO  Offline OP
Fjord artisan

Joined: Sep 2004
Posts: 237
New Orleans
I finished the project i was working on. So now before i convert the variables, i would like a better idea of just how far i can go with them. I have a dozen or so checkboxes, a few color selection combos. So in the calling script it goes something like if (%var == on) do this ...... so now its if ($hget(tablename,name) == on) do this. Would this work pretty much the same with the color variables too?
Example of calling colors:
echo @DCC.Info $timestamp  $+ %ME322x *** DCC Send from $nick REJECTED ( $filename ) File Type REJECTED.
Would now be more like this?
echo @DCC.Info $timestamp  $+ $hget(Tablename,ME322x)*** DCC Send from $nick REJECTED ( $filename ) File Type REJECTED.

Is that right?

Re: Converting %vars to a hash or ini file #110146
06/02/05 04:26 AM
06/02/05 04:26 AM
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline
Planetary brain
DaveC  Offline
Planetary brain
D

Joined: Sep 2003
Posts: 4,230
yes

but watch the 3 *'s there touching the $hget

$hget(Tablename,ME322x)***

Re: Converting %vars to a hash or ini file #110147
06/02/05 06:02 AM
06/02/05 06:02 AM
Joined: Sep 2004
Posts: 237
New Orleans
JAFO Offline OP
Fjord artisan
JAFO  Offline OP
Fjord artisan

Joined: Sep 2004
Posts: 237
New Orleans
Thanx, yeah i know it was just a typo when i put it on here. wink Just wanted to make sure before i made all those changes.