Hi all,
after about a year I have returned to trying to use LUA.
I have had a little more sucess.. it runs now.. but I am still unsure what exactly it is capable of.
Let me try to explain. Ive just been reading 'MUD Game programming' and I figured I might try to write a simple MUD in BMax. The problem comes when in the book the author uses Python and C++ to write scripts for everything. eg. If a player tries to pick up an object the game calls a script function canpickup and passes it the player object and the object to be picked up. The script then finds the player encumberance values ( current and max ) by reading through a MAP and then sees if the object weight plus the current 'Encumberance' will exceed the 'MaxEncumberance' and returns true or false.
And there is my problem... can I pass a TYPE to LUA ?.. and if I can then if the player Type contains a TMAP can lua access it ? I dont want to have to pass specific values based on what script function Im calling because that would make the script calling pointless as every new function would require code changes in BMax.
btw.. Im currently trying to use the scriptEngine... I dont know if thats the best way to do it or whether I should call lua at a lower level.
and while Im at it... if I want to use the script engine do I have to call setscripttext everytime I want to call a different function ( I was planning on having seperate script files for every function ) or do I have to put all the functions into 1 HUGE script file ?
Finally.. when you call SetScriptText you give it 2 parameters... can someone explain why ?... I mean when you run RunScript it doesnt take a parameter so why do I have to give it a name when I set it ?.. or is this the way I can load lots of scripts into the engine ?.. anyway.. Ive only been playing around for an hour or so so maybe I can answer that last question myself tommorow when I get some time.
Thanx for any help
QuietBloke
after about a year I have returned to trying to use LUA.
I have had a little more sucess.. it runs now.. but I am still unsure what exactly it is capable of.
Let me try to explain. Ive just been reading 'MUD Game programming' and I figured I might try to write a simple MUD in BMax. The problem comes when in the book the author uses Python and C++ to write scripts for everything. eg. If a player tries to pick up an object the game calls a script function canpickup and passes it the player object and the object to be picked up. The script then finds the player encumberance values ( current and max ) by reading through a MAP and then sees if the object weight plus the current 'Encumberance' will exceed the 'MaxEncumberance' and returns true or false.
And there is my problem... can I pass a TYPE to LUA ?.. and if I can then if the player Type contains a TMAP can lua access it ? I dont want to have to pass specific values based on what script function Im calling because that would make the script calling pointless as every new function would require code changes in BMax.
btw.. Im currently trying to use the scriptEngine... I dont know if thats the best way to do it or whether I should call lua at a lower level.
and while Im at it... if I want to use the script engine do I have to call setscripttext everytime I want to call a different function ( I was planning on having seperate script files for every function ) or do I have to put all the functions into 1 HUGE script file ?
Finally.. when you call SetScriptText you give it 2 parameters... can someone explain why ?... I mean when you run RunScript it doesnt take a parameter so why do I have to give it a name when I set it ?.. or is this the way I can load lots of scripts into the engine ?.. anyway.. Ive only been playing around for an hour or so so maybe I can answer that last question myself tommorow when I get some time.
Thanx for any help
QuietBloke