mIRC Home    About    Download    Register    News    Help

Print Thread
#45629 31/08/03 05:29 AM
Joined: Feb 2003
Posts: 8
O
Oliver Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
O
Joined: Feb 2003
Posts: 8
Hi, i havent seen it posted before, and mIRC 6.1 is still kind of fresh so...
i noticed quite a big bug with /hdec, it seems to increment instead of decrement.. it screwed some of my bigger scripts up quite a bit, leaving me wondering.
//hadd -m test hello 5 | .hdec test hello | .echo -a $hget(test,hello)
does indeed echo 6 for me.. temporarily i changed all /hdec to /hinc ... ... -1 in my scripts. but i think this is something that needs quick fixing :P
(and i also checked whether /hdec is an alias somewhere.. it isnt, and it also happens with remotes off)

#45630 31/08/03 05:32 AM
Joined: Dec 2002
Posts: 24
M
Ameglian cow
Offline
Ameglian cow
M
Joined: Dec 2002
Posts: 24
6

time for a new version wink

#45631 31/08/03 07:06 AM
Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
Interesting workaround smile
I get the same here, /hdec increases the value, although /hdec -c decreases. :P

#45632 31/08/03 07:22 AM
Joined: Dec 2002
Posts: 30
A
Ameglian cow
Offline
Ameglian cow
A
Joined: Dec 2002
Posts: 30
Really bad bug good thing I dont use hinc or hdec yet cause of all the past problems with these.

#45633 12/09/03 10:29 AM
Joined: Feb 2003
Posts: 810
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Feb 2003
Posts: 810
For now, I'd use something like
Code:
alias hdec {
  var %0 = $($ $+ $0,2), %ifmatchbug = $ifmatch
  $+(!,$iif(!$show,.),hinc) $iif(%0 isnum,$($!1- $+ $calc($0 -1),2) - $+ %0,$1- -1)
  if (%ifmatchbug) { }
}

I can't test it right now, but it should work..
The $ifmatch part is some workaround to deal with the well known (I suppose) $ifmatch bug (which is very old already, it should be fixed too frown), since it uses $iif().


* cold edits his posts 24/7
#45634 12/09/03 04:50 PM
Joined: Feb 2003
Posts: 810
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Feb 2003
Posts: 810
Sorry, this one is cleaner and better:
Code:
alias hdec {
  var %0 = $($ $+ $0,2), %ifmatchbug = $ifmatch
  !hdec $1- $iif(%0 !isnum,1) $+ $iif(%ifmatchbug,$null)
}
A friend of mine just saw /hdec actually works if you supply a decrease value. Also, I don't get why did I think $show was needed here..


* cold edits his posts 24/7
#45635 12/09/03 05:09 PM
Joined: Feb 2003
Posts: 2,812
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,812
ifmatchbug is fixedid! grin

Edited: I dont reckon there ever was an $iif($ifmatch, ...) bug, just an $iif($isid, ...) bug.
The following code works on versions all the way back to 5.81 (2000-Nov-9).

//if (abc) echo -a > $ifmatch $iif($ifmatch,$ifmatch y,n)
> abc abc y


Well. At least I won lunch.
Good philosophy, see good in bad, I like!
#45636 13/09/03 09:51 AM
Joined: Feb 2003
Posts: 810
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Feb 2003
Posts: 810
P.S.: Sorry if you're receiving 2 emails for this reply, I accidentally deleted the first one while editing it (don't ask me how) blush.
P.S2.: Damn. I always edit a post a thousand times after posting it. I actually use the preview feature, but I think I just can't preview it decently. *sigh*


I wasn't referring to $iif($ifmatch,...), I was referring to $ifmatch generally. :tongue: It's value isn't script-specific. Like in this silly example (just to demonstrate):
Code:
alias alias1 {
  if ($asctime) { echo -a $alias2 Date is $ifmatch }
}
alias alias2 {
  if ($time(h) isnum 6-11) { return Good morning. }
}


This echoes "Good morning. Date is 6" instead of "Good morning. Date is Sat Sep 13 06:21:32 2003". Shouldn't alias1's $ifmatch refer to $asctime instead of alias2's $time(h)?
I believe it's a bug, but I can see that it could be $ifmatch's intended behaviour, although I don't agree with it. I think this doesn't make sense.

The issue above, for now, can be solved putting brackets around alias1's $ifmatch, to evaluate it before $alias2. But if I used alias2 as a command instead of an identifier, calling it before, brackets wouldn't do the job. I'd have to put $ifmatch in a %var before calling alias2, then use it.

My current workaround is to let alias2 clear it's $ifmatch value itself, instead of having to use %vars from everywhere I want to call it. In this specific case, it would be something ugly like:
Code:
alias alias2 {
  var %ifmatchbug = $ifmatch
  if ($time(h) isnum 6-11) {
    return Good morning. $+ $iif(%ifmatchbug,$null)
  }
  if (%ifmatchbug) { }
}
That's why I used $iif() (and /if) there, to force %ifmatchbug to be $ifmatch again.

These code examples may not show exactly the work I have dealing with $ifmatch everytime, but I couldn't think of anything else right now (it's 6:30am here :tongue:)..

This bug/issue is already related here by praetorian.

Last edited by cold; 13/09/03 10:01 AM.

* cold edits his posts 24/7
#45637 14/09/03 12:18 AM
Joined: Feb 2003
Posts: 2,812
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,812
Interesting issue.

I guess I never noticed because I don't rely on $ifmatch a great distance from the actual /if check, and I find I primary use it in WHILE loops (near the beginning).

I might say this is the intended behavior of $ifmatch, being a single globally stored value like $returned and $readn... but I guess that's up to Khaled to decide. Good thing to know about though, now I can anticipate this behavior in future use.

Note: If corrected and made local, your use would cease to work... requiring that you pass $ifmatch as a parameter and reference $1- instead.

- Raccoon


Well. At least I won lunch.
Good philosophy, see good in bad, I like!
#45638 14/09/03 12:51 PM
Joined: Jul 2003
Posts: 33
B
Ameglian cow
Offline
Ameglian cow
B
Joined: Jul 2003
Posts: 33
All these crazy 'workarounds' are facetious. Just specify the decrement value. /hdec <ht> <item> 1 works.

#45639 15/09/03 10:41 PM
Joined: Feb 2003
Posts: 810
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Feb 2003
Posts: 810
Its purpose is to avoid putting 1 in a thousand /hdec's you may already have in your thousand scripts. If you don't need it, fine. But some people need it, instead of going to the annoying search for every /hdec call to put a single '1' at its end, which would be much "crazier" (and rather "facetious" too) than overriding the command for such a simple fix, since /hdec is obviously going to be fixed.


* cold edits his posts 24/7

Link Copied to Clipboard