AoRaToS Posted January 7, 2009 Posted January 7, 2009 (edited) This is rather easy I believe, let's say I have this script $x = 3 Msgbox(0,"",$x) This will show 3, but what If I want it to show $x instead, but not by including "$x", is there a way to indicate whether it will show the variable rather than the value it holds? I think in C++ when you use a & you get that... PS Is it called "call by reference"?And the other is by value? Edited January 7, 2009 by AoRaToS s!mpL3 LAN Messenger Current version 2.9.9.1 [04/07/2019] s!mpL3 LAN Messenger.zip s!mpL3
GrungeRocker Posted January 7, 2009 Posted January 7, 2009 Using & in C++ will show the address in memory of your var [font="Verdana"]In work:[list=1][*]InstallIt[*]New version of SpaceWar[/list] [/font]
AoRaToS Posted January 7, 2009 Author Posted January 7, 2009 Yes you're right about that What about what I want to do? s!mpL3 LAN Messenger Current version 2.9.9.1 [04/07/2019] s!mpL3 LAN Messenger.zip s!mpL3
GrungeRocker Posted January 7, 2009 Posted January 7, 2009 Yes you're right about that What about what I want to do?"$x" :-D [font="Verdana"]In work:[list=1][*]InstallIt[*]New version of SpaceWar[/list] [/font]
Zinthose Posted January 7, 2009 Posted January 7, 2009 (edited) Sorry but there is no way of acquiring the variable name, at least that I can see. But I did throw this together. It's not what you asked for but might be but you need. ConsoleWrite(_CodeLine(@ScriptLineNumber) & @CRLF); This Line will be Printed to the command line Func _CodeLine($ScriptLine) Local $Start, $End If @Compiled Then Return SetError(1, 0, "Compiled Script: Can not return Script line") Local $File = FileOpen(@ScriptFullPath, 0) Local $Data = FileRead($File) FileClose($File) If $ScriptLine = 1 Then $Start = 1 Else $Start = StringInStr($Data, @CRLF, 1, $ScriptLine - 1) + 2 EndIf $End = StringInStr($Data, @CRLF, 1, 1, $Start) If $End = 0 Then Return StringMid($Data, $Start) Return StringMid($Data, $Start, $End - $Start) EndFunc edit: fixed issues with calling from first and last lines of script. Edited January 7, 2009 by Zinthose --- TTFN
AoRaToS Posted January 7, 2009 Author Posted January 7, 2009 (edited) I can't use that I have a script but it's growing quite large cause I have to repeat stuff with slight differences, it would be easier if I could get a variable name and somehow change it so that the one function I have can work every time. I have 10 tabs to do the same thing with different variables like func 1 msgbox x1 msgbox x98 msgbox x54 endfunc func 2 msgbox x9 msgbox x3 msgbox x23 endfunc it's more complicated in the real script, it would be great if I could have a funcion called x and the I could call it and parse each parameter, I think I though of a way, I have to check it though... Edited January 7, 2009 by AoRaToS s!mpL3 LAN Messenger Current version 2.9.9.1 [04/07/2019] s!mpL3 LAN Messenger.zip s!mpL3
Zinthose Posted January 8, 2009 Posted January 8, 2009 I can't use that I have a script but it's growing quite large cause I have to repeat stuff with slight differences, it would be easier if I could get a variable name and somehow change it so that the one function I have can work every time.I have 10 tabs to do the same thing with different variables likefunc 1 msgbox x1 msgbox x98 msgbox x54endfunc func 2 msgbox x9 msgbox x3 msgbox x23endfuncit's more complicated in the real script, it would be great if I could have a funcion called x and the I could call it and parse each parameter, I think I though of a way, I have to check it though...Sounds to me like the functions need broken down further. Can you clarify more on what your trying to do? --- TTFN
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now