Toribash
Originally Posted by neoliminal View Post
Explain?

My Faked Shaders script checks when the mod is changed so it can reflect the objects.

This is how it should work:
check_mod should be hooked to trigger at game start (or constantly). load_slave_script loads the right script or each mod.
current_mod="no mod loaded"

function load_slave_script(s)
	if (s=="classic") then --or other mod
		run_cmd("/ls classic_script.lua") --or other script for this mod
	end
	dofile("master_script.lua") --reload the master script (this file) on top so both will be running and new mods are detected
	current_mod=get_game_rules().mod --prevent master script from reloading the slave script
end

function check_mod()
	if (current_mod~=get_game_rules().mod)then
		current_mod=get_game_rules().mod
		load_slave_script(current_mod)
	end
end
I have also developed a system to embed scriptable stuff into mods, if you have DeScript installed you can use it like that:

put a line in the mod file (e.g: "mymod.tbm") that reads:

# MODADDON MyModAddon
then create a file called "moa_MyModAddon.lua"
the file will be executed every time you load mymod.tbm

Advanced usage:
It is also possible to place some variables and/or functions directly into the mod file, to do so just place them under the MODADDON line into the file in a notation you would use to declare a table (but without the outer brackets). e.g:

# MODADDON MyModAddon
#    a = "I'm A",
#    alert = function()
#        echo('Hi there!')
#      end
then you can access the declared values from within "moa_MyModAddon.lua" like that:
-- run the alert function declared in the mod file
ModAddOn.alert()  -- prints "Hi there!" to the console
-- access the declared variable 'a'
echo(ModAddOn.a)  -- prints "I'm A" to the console

But as Melmoth pointed out a lot of stuff is disabled in Multiplayer Games, also remember that the script is executed on your local computer, not on the server.
Last edited by DeFransen; Jan 19, 2011 at 10:36 PM.
"Wenn Sensei Tanaka sein Shodushi ist, dann soll er hingehen und uns den Dimak zeigen!"
hey zas and melmoth and defransen,i know its possible to draw in LUA,but can you make an extended blinker script i mean it should be possible to rotate(sich drehen) on horizontal vertical axis,but it shouldnt look scripted it should generate joint movements,i mean FLYING,and there should be something black dust like around tori