mIRC Home    About    Download    Register    News    Help

Print Thread
#35672 11/07/03 07:35 AM
D
demitrix
demitrix
D
Ok decided since i need alot of help ill just make a final thread laugh anyhow im having trouble i have a variable which is a string of other variables like %var1 = %var2 %var3 well wen i try to replace character in %var1 it doesnt process %var2 %var3 it just keeps them as %var2 %var3 any command to fix that

#35673 11/07/03 07:49 AM
Joined: Jan 2003
Posts: 2,973
K
Hoopy frood
Offline
Hoopy frood
K
Joined: Jan 2003
Posts: 2,973
var %var1 = $replace(%var2 %var2, <replacer>, <Repalce_with>)

#35674 11/07/03 07:51 AM
Joined: Feb 2003
Posts: 2,737
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,737
Your question is slightly confusing, however these examples should help you out. I'll include both methods that use $eval and [ ].

%Myvar. [ $+ [ %var1 ] $+ . $+ [ %var2 ] ]
$eval($+(%,Myvar.,%var1,.,%var2),2)
%Myvar.var1.var2

% [ $+ [ %var1 ] $+ [ %var2 ] ]
$eval($+(%,%var1,%var2),2)
%var1var2

Good Luck.
- Raccoon


Well. At least I won lunch.
Good philosophy, see good in bad, I like!
#35675 11/07/03 08:18 AM
D
demitrix
demitrix
D
ok sorry for not making my self clea. 4 AM here :S. i have dialog that allows u to enter variables (http://bob.xteo.net/options.jpg) and it stores them as a variable well i need &replace and $remove to see %var1 as processed %var2 %var3 not as actaul text %var1 %var2

#35676 11/07/03 08:24 AM
Joined: Feb 2003
Posts: 2,737
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,737
Lets try this again tomorrow. It's nearly 3:30 here aswell.
(btw, that made no sense again. crazy) (600)


Well. At least I won lunch.
Good philosophy, see good in bad, I like!
#35677 11/07/03 08:33 AM
Joined: Jan 2003
Posts: 2,973
K
Hoopy frood
Offline
Hoopy frood
K
Joined: Jan 2003
Posts: 2,973
Code:
; pass it contents of above text field
alias filename {
  var %a = 1, %filename
  while ($gettok($$1, %a, 32)) {
    var %filename = %filename $+ $ifmatch
    /inc %a
  }
  return $replace(%filename, $+(%,HUD.Server), _____, $+(%,HUD.ip), ______, $+(%,HUD.map), ______, $+(%,HUD.comment), ______)
}

#35678 14/07/03 12:13 AM
D
demitrix
demitrix
D
ok a few days have passed (my RAID drives went psycho) but heres my problem better described
i have a dialog which the user inputs variables in the availible variables are %HLDR.IP %HLDR.Server %HLDR.Map %HLDR.Comment
each of which contain a text/numeric string well those variables are set as %HLDR.Format so that the value of %HLDR.Format = %HLDR.IP %HLDR.Server (any order any amount thats just an example)
well i need to strip spaces,slashs, and all other illegal file name characters but $replace($HLDR.Format,/,-) doesnt work because it treats %HLDR.Format as a list of the variable names not a list of the variable values
hopefully that makes sense

#35679 14/07/03 02:27 AM
D
demitrix
demitrix
D
KingTomato is god like. Everyone bow to him.

#35680 27/07/03 04:52 PM
Joined: Dec 2002
Posts: 109
T
Vogon poet
Offline
Vogon poet
T
Joined: Dec 2002
Posts: 109
It really shouldn't be.

var %a = Foo
var %b = Bar
var %c = %a %b

-- %c is now "Foo Bar"

var %c = $replace(%c,$chr(32),-)

-- %c is now "Foo-Bar"

Variable assignments are instant. There are no references in mIRC, unless you toy with evaluation order. But you haven't been.

#35681 27/07/03 04:58 PM
Joined: Dec 2002
Posts: 109
T
Vogon poet
Offline
Vogon poet
T
Joined: Dec 2002
Posts: 109
Oh wait, I've just figured out what you were doing. You were storing the variable names as plain text form for template-like usage. wink

Ignore previous response.


Link Copied to Clipboard