Forum

> > CS2D > Scripts > combining scripts
Forums overviewCS2D overview Scripts overviewLog in to reply

English combining scripts

9 replies
To the start Previous 1 Next To the start

old combining scripts

Fossil
User Off Offline

Quote
Hey all. Now before you go on saying " dude really?" Or something like that, I just want to let you know that I know nothing about lua scripts. So don't go bashing on me. So is it possible to combine 2 or more lua scripts together?
edited 1×, last 31.08.11 04:00:13 pm

old Re: combining scripts

EngiN33R
Moderator Off Offline

Quote
Just add two or more dofile lines in your server.lua file. You can execute up to lots of Lua scripts at the same time.

old Re: combining scripts

Bowlinghead
User Off Offline

Quote
Did you ever heard "server.lua". There are more then 1 Script! (Example the samples!)
EDIT: lol. few seconds too late

old Re: combining scripts

Fossil
User Off Offline

Quote
user EngiN33R has written
Just add two or more dofile lines in your server.lua file. You can execute up to lots of Lua scripts at the same time.
thank you for the quick reply. Thanks it works. Will using 2 or more lua scripts cause any certain lag issues?

old Re: combining scripts

DC
Admin Off Offline

Quote
yeah depends on the scripts.
plus there is another important point: combining scripts does not always work without problems! be careful! scripts might use the same variables or the same hooks. in some cases you have to rewrite parts of the scripts or you have to use priorities for the cs2d lua cmd addhook command (if hooked functions use the return value).

old Re: combining scripts

Bowlinghead
User Off Offline

Quote
Yeah or they both use serveraction hook. (If both scripts use F2).
EDIT: You can have unlimit addhooks (Of the same) if they all have a different variable.
edited 1×, last 31.08.11 04:10:29 pm

old Re: combining scripts

EngiN33R
Moderator Off Offline

Quote
Yes indeed - conflicting scripts are a pain in the arse. Though it doesn't happen so often it's still a possibility.

old Re: combining scripts

Fossil
User Off Offline

Quote
user DC has written
yeah depends on the scripts.
plus there is another important point: combining scripts does not always work without problems! be careful! scripts might use the same variables or the same hooks. in some cases you have to rewrite parts of the scripts or you have to use priorities for the cs2d lua cmd addhook command (if hooked functions use the return value).
thank you for that. On my spare time I might read on the lua tutorials here so I can understand them better.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview