mIRC Home    About    Download    Register    News    Help

Print Thread
#117290 14/04/05 05:05 AM
Joined: Feb 2005
Posts: 10
R
Roanoke Offline OP
Pikka bird
OP Offline
Pikka bird
R
Joined: Feb 2005
Posts: 10
; Information is linked simply enough. In good code the commands are created with a design for expansion.

Select Case <Variable> {

Case (DATA)
; The variable set in active memory.. So by calling a variable it takes less memory...
Case Else
; The overhead and memory required for an if statement to be ran, is vertually the same as a Case statement.
; A few variables IE 3 will remain in memory until finish of the Case Segment.
}
; The code itself will look cleaner, and allow for users to understand the creators code easier.


Where as a work arround is a little bit more work and more taxing on mIRC

After each select case is passed through a custom identifier several alias's are called and variables each time
where as with a switch its simpler and easily ported
especially since the code for "if then else" can be easily modified to accept for switch/select case commands.


alias Select {
if ($1 = Case) {
STRING SET GLOBAL Select_Case $2-
return $true
}
if ($1 = END) {
STRING DELETE GLOBAL Select_Case
}
}

alias Case {
STRING GET GLOBAL Select_Case
var %Select_Case = $result
if ($prop = CS) {
return $iif($1- === %Select_Case, return $true)
}
if ($prop = ISIN) {
return $iif($1- isin %Select_Case, return $true)
}
if ($prop = ISWM) {
return $iif($1- iswm %Select_Case, return $true)
}
if ($prop = ISWMCS) {
return $iif($1- iswmcs %Select_Case, return $true)
}
return $iif($1- = %Select_Case, return $true)
}


alias STRING {
if ($1 = SET) {
hadd -m $2 $3 $4-
return $TRUE
}
if ($1 = GET) {
return $hget($2 , $3)
}
if ($1 = DELETE) {
hdel $2 $3
return $TRUE
}
if ($1 = CLEAR) {
hdel $2
return $TRUE
}
:ERROR
echo -s $error
reseterror
return $FALSE
}


The above is a work arround - Copy it if you want for now, but at some point it should be implimented to prevent mIRC from slowingdown/locking up as much.

#117291 14/04/05 05:02 PM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
You asked for this less than 2 months ago, Since the versions havent changed between then and now, i dont see much point in asking for it again, NOT that its a bad request of course.

I really wouldnt do it by script, I know i wrote one to do it, but I may have been deluded/delusional that day.

If your going to have to use a script to emualte it you might as well just use IF ELSEIF ELSE, I have never seen what is so hard with using one, when code is broken down to its simplest elemets there isnt a case select anyway, its always yes or no, true or false, 1 or 7 ummm no 5 errrr 8 no thats right looks like 8, 1 or 0 smile


Link Copied to Clipboard