Jump to content

[SOLVED] Problem with LUA code when porting around ( using global vars in different Cores )


Go to solution Solved by ATAG,

Recommended Posts

Hi Guys :D

I have a problem with a quest im currently working on, or better said the part it should execute after getting ported to a map.
 

With this Code;

 

pc.warp(x,y) -- Warps to map with mapindex == 352

 

when login with pc.get_map_index() == 352 begin

 

 

 

 

It works fine as long as you were on Channel99 before porting. When you try to port from Channel1 to this map (ch99 ) it doesnt start the code.

 

Does anyone know why this is the case?

 

sincerely Castro

 

SOLUTION: 

The solution is that global vars are unique for every Core. You have to use MYSQL to make them accessable by every core without getting errors like I did.

Link to comment
Share on other sites

Theres no use to post the quest here as it works perfectly. The problem is about the different Channels.

 

If you port from Ch99 to this map ( CH99 ) it works. If you port from CH1 to this map it doesnt.

 

I did both rleoad q and full reboot..

 

 

#Edit:

 

Can it be the problem that I use global Variables? Are they unique for Each Channel?

Link to comment
Share on other sites

  • Premium

 

Try a debug version:

when login begin
local mapidx = pc.get_map_index()
syschat("Map index: "..mapidx or "error")
if 352 == mapidx then
...

Correct, try with this method and if it returns error then you will know the reason.

  • Love 1

 

"Nothing's free in this life.

Ignorant people have an obligation to make up for their ignorance by paying those who help them.

Either you got the brains or cash, if you lack both you're useless."

Syreldar

Link to comment
Share on other sites

 

 

Try a debug version:

when login begin
local mapidx = pc.get_map_index()
syschat("Map index: "..mapidx or "error")
if 352 == mapidx then
...

Correct, try with this method and if it returns error then you will know the reason.

 

 

 

I tried it like this:

When login with pc.get_map_index() == 352 begin

chat("DEBUG: logged warp")

end

and it worked. 

Now it seems to me that global vars are unique for every core, maybe i have to use MYSQL for the table then, but thats fine. I will try it later and post the results here :) 

Anyways, thanks to the guys who helped me out! 

MFG Castro

 

#closerequest

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.