Vanilla 1459 Posted April 24, 2014 Share Posted April 24, 2014 Hello dear folks! Well, I've got a huge problem and I can't seem to fix it. It's very complicated so I'll just get startet to explain it. I've upgraded lua to 5.2 as you may know. The server starts without any flaws, everything seems to work, it even understands the when-blocks etc.. Ingame you can see all the quest scrolls in the left side so even that works. And if you click them everything seems to work - unless some special parts and this is where the error lies. I've extended the error output to see more information. Whenever there are instructions like "select" it'll throw out an error. SYSERR: Apr 24 17:56:10 :: RunState: LUA_ERROR: wait WITH ERRORCODE YIELD SYSERR: Apr 24 17:56:10 :: RunState: LUA_STATE: index 1372862141 ref 3 SYSERR: Apr 24 17:56:10 :: WriteRunningStateToSyserr: LUA_ERROR: quest main_quests.main1_start click This is an example where the wait-instruction won't work. In some cases letters open and text will be displayed, but there are no selections. So when I click on the blacksmith nothing happens but a nice error message like this. Here is an example: SYSERR: Apr 24 17:44:40 :: RunState: LUA_ERROR: select WITH ERRORCODE YIELD SYSERR: Apr 24 17:44:40 :: RunState: LUA_STATE: index 0 ref 3 SYSERR: Apr 24 17:44:40 :: GetQuestStateName: QUEST wrong quest state file QUEST_CHAT_TEMP_QUEST.0 It's a little bit strange to have the index 0 I don't know if it's related to the error but as you can see in the upper example that the index worked fine there but still it's giving me an error. I also tried something like this: int ret = lua_resume(qs.co, NULL, qs.args); int y = 0; while(ret == LUA_YIELD) { ret = lua_resume(qs.co, NULL, qs.args); sys_err("LUA_ERROR: COROUTINE IS YIELDING! RETRYING. ATTEMPT %d", y); y++; if(y>=1000) { sys_err("LUA_ERROR: CAN NOT WAKE UP COROUTINE."); break; } } But well, the only result is this: Many quest scrolls disappeared and when I click on the blacksmith it tells me that it's Retrying with Attempt 0 (so it's the first time the loop is executed). Then nothing happens. It seems like in the second attempt the lua_resume returned LUA_OK but I guess the stack is lost so it won't do anything at all. It's very confusing :/ I hope someone with knowledge in c++ and the lua api is able to help so vanilla can be finished for everyone! There's to much work spent in this upgrade, I don't really want to go back to 5.0. And I won't. I'll still try but I hope someone could help me so I'll pass this faster. Best Regards, vanilla We are the tortured. We're not your friends. As long as we're not visible. We are unfixable. Link to comment Share on other sites More sharing options...
Alpha 484 Posted May 1, 2014 Share Posted May 1, 2014 o.o You upgraded it? Did you rewrite qc with the new Lexer? I tried to upgrade too the server worked fine but I couldnt upgrade qc because of the Lexer changes in lua 5.1 and 5.2 Link to comment Share on other sites More sharing options...
Active Member ATAG 311 Posted May 16, 2014 Active Member Share Posted May 16, 2014 Maybe the garbage collector makes fun? Link to comment Share on other sites More sharing options...
Vanilla 1459 Posted May 16, 2014 Author Share Posted May 16, 2014 It's still ongoing. Yeah, I managed to do some work on qc but it'll take some more time. My qc is now able to read some basic stuff but it got problems when reading most functions, that's when it always throws syntax error. But I was able to compile a cute, small quest with just an assert. 1 We are the tortured. We're not your friends. As long as we're not visible. We are unfixable. Link to comment Share on other sites More sharing options...
ricky92 29 Posted May 19, 2014 Share Posted May 19, 2014 If you still haven't found a solution for this problem, try treating LUA_YIELD as a valid return value. I upgraded to 5.1 and had to make this modification to make it work correctly, and I suspect that's the solution for Lua 5.2 as well. Afterall, it makes more sense than in Lua 5.0: if a coroutine "pauses", there's a need to know from outside of it if whether it just ended or if it yielded (which would mean that it's then waiting for a resume call). As a side note, may I suggest you make your core open-source? Afterall the base sources are Ymir's, and since you're offering your work to the community for free you might as well benefit from the community in return, and accept users' fixes. Link to comment Share on other sites More sharing options...
Vanilla 1459 Posted May 19, 2014 Author Share Posted May 19, 2014 The problem is that after I resume the thried and push a stack to it it's returning LUA_YIELD which is clearly not a normal behaviour. It'd return LUA_OK to show it got everything right. Additionally most quests got broken with that. And if I try to force a LUA_OK (I resume the thread as often as I can) it's working in a second or third attempt but well.. It's still totally broken. We are the tortured. We're not your friends. As long as we're not visible. We are unfixable. Link to comment Share on other sites More sharing options...
ricky92 29 Posted May 19, 2014 Share Posted May 19, 2014 What I'm trying to say is that the function lua_resume returning LUA_YIELD is normal behaviour: that's exactly how Lua coroutines work. Every function that "pauses" lua execution is able to do so because it is yielding, and that's why lua scripts can "interact" with the user in a non-blocking way. Check in the questlib.lua file and you'll see what I mean: function select(...) return q.yield('select', arg) end Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now