Jump to content
  • 0
Sign in to follow this  
Castro

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

Question

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.

Share this post


Link to post

5 answers to this question

Recommended Posts

  • 0

Try a debug version:

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

Share this post


Link to post
  • 0

It would be nice to paste complete your quest.

 

When you install the quest, you do a reboot or reload q?

Share this post


Link to post
  • 0

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?

Share this post


Link to post
  • 0

 

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

Share this post


Link to post
  • 0

 

 

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

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • 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.