sdphantom
Full Member
Savior and Destroyer
Posts: 230
|
Post by sdphantom on Jan 19, 2006 8:52:12 GMT -5
I found a temperary workaround for this, but it would be nice to be able to send windower commands directly into windower itself. Currently, I have the lua script write a temperary windower script file then tell windower to execute it using Windower.console_Exec(), setting the function to wait until the file finnished executing, then erase it.
|
|
|
Post by TinyTerror on Jan 19, 2006 9:37:44 GMT -5
X-drop and I talked about this. I'll add it this weekend.
|
|
|
Post by X-Drop on Jan 19, 2006 13:46:35 GMT -5
I have been trying to send commands to windower as well. Now I can write to a temparary text file and have windower execute the script but what windower will not do is execute the command "/console". Sure you can type this in manually, but I think they nerfed windowers ability to call this command via a script to prevent ppl from making loops. Honestly though, it's not hard to make loops using windower scripts anyways. My point is, I wanna be able to have a parent lua script open up one or more child lua scripts. And no I don't wanna use dofile and run the file as a lua chunk. Rather I want the child scripts to run completely independant. As if I type in ".Lunar load script.lua" myself. But without being able to use "/console", I think I'm outta luck atm. [EDIT]I'm a bonehead! Read futher for solution.
|
|
sdphantom
Full Member
Savior and Destroyer
Posts: 230
|
Post by sdphantom on Jan 19, 2006 19:30:16 GMT -5
Here's the workaround code I made to accomplish this.
function getPath() local filePath=string.gsub(debug.getinfo(getPath).source, "@", "", 1) return string.sub(filePath,1,string.len(filePath)-string.len(Windower.script_GetArg(1))) end
function runCmd(cmd) local windowerPath=string.sub(getPath(),1,string.find(string.lower(getPath()),"\\plugins\\lunar\\scripts")) local scriptFile local fopt
scriptFile=os.tmpname()..".fws" if string.sub(scriptFile,1,1)=="/" or string.sub(scriptFile,1,1)=="\\" then scriptFile=string.sub(scriptFile,2) end
fopt=io.open(windowerPath.."scripts/"..scriptFile,"wt") if fopt then fopt:write(cmd) fopt:close() Windower.console_Exec(scriptFile,true) os.remove(windowerPath.."scripts/"..scriptFile) else Windower.console_Write(" - Unable to write command script.") end end
Here's how the runCmd() function is used. runCmd([[ alias scriptmgr_reload .Lunar command ]]..Windower.script_GetArg(1)..[[ reload alias scriptmgr_unload .Lunar command ]]..Windower.script_GetArg(1)..[[ unload alias scriptmgr_show .Lunar command ]]..Windower.script_GetArg(1)..[[ show alias scriptmgr_hide .Lunar command ]]..Windower.script_GetArg(1)..[[ hide alias scriptmgr_exit .Lunar command ]]..Windower.script_GetArg(1)..[[ unload exit ]])
Here's some code that would load another script with the use of this function. runCmd(".Lunar load "..curScript)
<Edit: Used simplier code from another script I wrote and is stored in archives>
|
|
|
Post by X-Drop on Jan 19, 2006 21:31:58 GMT -5
I am such a knucklehead.... I completely wrote a similar script which also wrote a temparary windower script in an attempt to execute a Lunar script. But I tried in vain to form the statement. I tried, - /console .Lunar load script.lua
- /echo .Lunar load script.lua
- /input .Lunar load script.lua
- /input ".Lunar load script.lua"
- /input /echo .Lunar load script.lua
I musta tried about 15 different combinations with and without quotes.... and *sob*! All I had to do was simply write .Lunar load script.lua!! Thx Phantom.... I can get so carried away sometimes... lol
|
|
|
Post by TinyTerror on Jan 19, 2006 23:16:15 GMT -5
So you guys got it figured out? I'll add the functions anyway for the sake of simplicity.
|
|
sdphantom
Full Member
Savior and Destroyer
Posts: 230
|
Post by sdphantom on Jan 20, 2006 1:19:28 GMT -5
I am such a knucklehead.... I completely wrote a similar script which also wrote a temparary windower script in an attempt to execute a Lunar script. But I tried in vain to form the statement. I tried, - /console .Lunar load script.lua
- /echo .Lunar load script.lua
- /input .Lunar load script.lua
- /input ".Lunar load script.lua"
- /input /echo .Lunar load script.lua
I musta tried about 15 different combinations with and without quotes.... and *sob*! All I had to do was simply write .Lunar load script.lua!! Thx Phantom.... I can get so carried away sometimes... lol lol, np ^^ The windower scripts are formatted in the same way as you would type commands straight into the windower console, the same way batch scripting works.. as a mater of fact, that's exactly what a windower script is. ^.^;
|
|
|
Post by azural on Jan 22, 2006 2:35:05 GMT -5
I had been trying to figure this out myself, Thanks . Thought I was just a moron for not seeing how it could be done. Can't wait for all this to be in the new release. Neat and tidy.
|
|