• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Global variables doesn't work on raids scripts

  • Thread starter Deleted member 141899
  • Start date
D

Deleted member 141899

Guest
Hello,

Maybe any of you can give me a light..

I'm using tfs 1.1, and i'm trying to set a global variable in a raid script on data/raids/scripts, like that:
Code:
function onRaid()
    print("executed")
    MITCRaidActive = true
end

I have printed the script to check if its really executed, so i saw thats its working fine.

The problem is, after setting this variable to true, its returning nil for all others scripts. if i set a global variable in a talkaction or other place for example, its work and return true in others scripts. This is not the only problem, raids scripts doesn't work with compat.lua functions, if i need to call some function i need to use a doFile for it.

I tried to review my raids.cpp and .h, but i didn't find nothing weird..

Someone have an idea what is causing this?
 
Is there a reason why you're still using 1.1?
My assumption is that there's no shared Lua environment in 1.1 for raids like there is for all other interfaces, they might have forgotten to implement it.
 
I'm using 1.1 cause my source is fully optimized..

Thanks for your post, i have searched about lua interfaces and found something different from raids to others interfaces.. for e.g, raids don't have this:
Code:
LuaScriptInterface& Actions::getScriptInterface()
{
    return m_scriptInterface;
}

However in raids.h have something there.. i really don't know how to fix this xD

Other weird thing that i found:

if we test this simple script on raids:
Code:
function print2(var)    
print(var) 
end 

function onRaid()    
print("executed")     
testvar = true    
print(testvar)    
addEvent(print2, 4000, testvar) 
end

Its give an error on addEvent, saying that print2 is not a function..

If we use the same script on a talkaction, works fine.
 
Back
Top