My app is completely broken now

I’ve been waiting for the widget 2.0 update for weeks because I needed scrollview to get fixed.
As soon as it was out, I updated corona and was expecting to have to change and fix some things.

Buttons are totally broken, but I’ve been able to fix them, and I believe scrollview is fixed but here is where everything goes to crap.

I can’t test the feature that was broken in scrollview, namely scrolltoBottom() which has now been changed to scrollView:scrollTo(“bottom”,…) because my end turn function crashes corona every time now.

I am trying to figure it out, but I am still pretty much a monkey with coding so I’ve had 5 hours with no progress and now I’m getting drunk, so that’ll help I’m sure.

My end turn function worked flawlessly before, and now, when storyboard calls a scene I use to run some checks and advance the turn number etc, corona locks up. It goes so far as to createscene and then nothing.

I don’t have a clue as to what to post for anyone to look at. My maingame lua file is 4500 lines of code, and overlord.lua is only about 130 lines. I suppose I can post my end turn function.

local endTurnEvent = function()  
 print( "endTurnEvent Triggered" )  
  
 gameTable[12] = 0  
 -- save the change  
 loadsave.saveTable(gameTable, "newGame.json")  
  
 timerStash = nil  
 timerStash = {}  
  
 -- These cycle through each display group with a for statement and removeSelf()  
 wipeEditMenu()  
 wipeContextMenu()  
 wipeGrid()  
 wipePanel()  
 wipeTransfer()  
 wipeResearch()  
 wipeLeader()  
 wipeMarket()  
 wipeVictory()  
  
 -- Final Cleaning  
 grid = nil  
 panel = nil  
 transfer = nil  
 research = nil  
 leader = nil  
 market = nil  
 victory = nil  
 editMenu = nil  
 contextMenu = nil   
 scrollView = nil  
 mainDisplay = nil  
  
 sound:destroy()  
 sound = nil  
  
 storyboard.gotoScene( "overlord", "crossFade", 300 )   
 end   
  

I don’t know what the problem is. I guess I have to go back to an earlier version of corona except I need scrollView to work, and were talking about hours worth of time to change buttons back so they work agian…

I’ll update this later if I find anything else out [import]uid: 170004 topic_id: 36237 reply_id: 336237[/import]

there are no visual elements in overlord, which advances the turn count and player turn numbers, etc, before calling my maingame scene again [import]uid: 170004 topic_id: 36237 reply_id: 143938[/import]

What kind of error message are you getting? or does it just hard lock (freeze)? [import]uid: 41884 topic_id: 36237 reply_id: 143961[/import]

it just hard lock freezes after it creates the scene in my overlord.lua but before it enters the scene.
[import]uid: 170004 topic_id: 36237 reply_id: 143966[/import]

Hey tbernard.

I want to help you, but it’s hard with limited information. I understand that your main file is too big to post up here.

Your best place to start I believe in figuring out this issue is to do this:

wipeEditMenu()  
wipeContextMenu()  
wipeGrid()  
wipePanel()  
wipeTransfer()  
wipeResearch()  
wipeLeader()  
wipeMarket()  
wipeVictory()  

My hunch is that the problem lies in one of those functions. I obviously don’t know the code contained in them but I believe you should be able to isolate it by first:

  1. Comment out that whole block of code. If you don’t get the freeze, you know at least that the issue is in the code contained in one of those functions.

  2. If #1 helps, uncomment the whole block and start commenting each function out, one by one. Hopefully that should enable you to track it down to hopefully one of the functions that contains the issue.

  3. After completing steps 1 & 2, post up the code contained in the culprit function and I may be able to shed some light on the issue.

PS: Did your code work in daily build 1033?

Thanks
[import]uid: 84637 topic_id: 36237 reply_id: 143974[/import]

Hi Danny, I will do that tomorrow.

all those wipe functions are all the same and look like this

-- function to clear Context Menu  
 local wipeContextMenu = function ()  
 -- Remove all buttons from contextMenu display group  
 for i = contextMenu.numChildren, 1, -1 do  
 contextMenu[i]:removeSelf()  
 end  
 end  

It was working great at 1031
I hadn’t upgraded until 1034, but with the number of changes needed to make it run, it wasn’t ready to before I upgraded this morning to 1035.

So I don’t know if was working with 1034 or not. I will check that in the morning as well. [import]uid: 170004 topic_id: 36237 reply_id: 143975[/import]

The code snippet you posted seems fine.

After you do your checks in the morning, if you still can’t work it out post up overlord.lua and we will take it from there.

Thanks [import]uid: 84637 topic_id: 36237 reply_id: 143976[/import]

4500 lines of code in one module? Sheesh… I’m working on a game that uses my own programmed code for physics and includes a level editor for tile, enemies, object and decoration, and I don’t have any module over 1500 line in code. What I’m trying to say is that I feel like you have a serious flaw in the underlying structure of your code --> which often makes it so complex to correct errors like these that projects become unmanageable. If I were you I’d split up the code into smaller chunks or modules. [import]uid: 70134 topic_id: 36237 reply_id: 143984[/import]

Well there are about 8 different user displays that usually require data context specific to the operation in order to display the information to the user. So 80 percent of the code is just controlling those displays, plus the context menu’s etc.

I mentioned above I’m still kind of a monkey with code, but if I broke those things up into modules which I considered, it means making a fair number of globals so I can hand off the information needed to each of the modules, and everything I’ve read says not to, at least more things say not to then say to modulerize the programming.

Plus, everything was working great before, and when I’ve done something that breaks the code up to this point, it usually spits out some kind of error as opposed to crashing the simulator with no error message and it’s always been easy enough to comment out until I find the problem.

With this problem, I just don’t have a clue where to start, since it doesn’t give me any info to start with.
[import]uid: 170004 topic_id: 36237 reply_id: 144006[/import]

same crash of the simulator for me in 1034

operating on a windows 7 laptop [import]uid: 170004 topic_id: 36237 reply_id: 144007[/import]

I guess I neglected to mention that I also now get 9 Warning messages when my app begins

warning: could not load font helvetica-bold. using default font
says it 9 times in a row.

I don’t ever specify helvetica
all my text is formatted as display.newText(units, 0, 0, native.systemFontBold, 12)
where in this case units is a variable that stores the number of units assigned to a leader

I don’t know if that has anything to do with my troubles [import]uid: 170004 topic_id: 36237 reply_id: 144009[/import]

@tbernard: I don’t usually do this but… email me your project if you wish and I will take a look today.

danny [at] coronalabs [dot] com [import]uid: 84637 topic_id: 36237 reply_id: 144011[/import]

there are no visual elements in overlord, which advances the turn count and player turn numbers, etc, before calling my maingame scene again [import]uid: 170004 topic_id: 36237 reply_id: 143938[/import]

What kind of error message are you getting? or does it just hard lock (freeze)? [import]uid: 41884 topic_id: 36237 reply_id: 143961[/import]

it just hard lock freezes after it creates the scene in my overlord.lua but before it enters the scene.
[import]uid: 170004 topic_id: 36237 reply_id: 143966[/import]

Hey tbernard.

I want to help you, but it’s hard with limited information. I understand that your main file is too big to post up here.

Your best place to start I believe in figuring out this issue is to do this:

wipeEditMenu()  
wipeContextMenu()  
wipeGrid()  
wipePanel()  
wipeTransfer()  
wipeResearch()  
wipeLeader()  
wipeMarket()  
wipeVictory()  

My hunch is that the problem lies in one of those functions. I obviously don’t know the code contained in them but I believe you should be able to isolate it by first:

  1. Comment out that whole block of code. If you don’t get the freeze, you know at least that the issue is in the code contained in one of those functions.

  2. If #1 helps, uncomment the whole block and start commenting each function out, one by one. Hopefully that should enable you to track it down to hopefully one of the functions that contains the issue.

  3. After completing steps 1 & 2, post up the code contained in the culprit function and I may be able to shed some light on the issue.

PS: Did your code work in daily build 1033?

Thanks
[import]uid: 84637 topic_id: 36237 reply_id: 143974[/import]

Hi Danny, I will do that tomorrow.

all those wipe functions are all the same and look like this

-- function to clear Context Menu  
 local wipeContextMenu = function ()  
 -- Remove all buttons from contextMenu display group  
 for i = contextMenu.numChildren, 1, -1 do  
 contextMenu[i]:removeSelf()  
 end  
 end  

It was working great at 1031
I hadn’t upgraded until 1034, but with the number of changes needed to make it run, it wasn’t ready to before I upgraded this morning to 1035.

So I don’t know if was working with 1034 or not. I will check that in the morning as well. [import]uid: 170004 topic_id: 36237 reply_id: 143975[/import]

The code snippet you posted seems fine.

After you do your checks in the morning, if you still can’t work it out post up overlord.lua and we will take it from there.

Thanks [import]uid: 84637 topic_id: 36237 reply_id: 143976[/import]

4500 lines of code in one module? Sheesh… I’m working on a game that uses my own programmed code for physics and includes a level editor for tile, enemies, object and decoration, and I don’t have any module over 1500 line in code. What I’m trying to say is that I feel like you have a serious flaw in the underlying structure of your code --> which often makes it so complex to correct errors like these that projects become unmanageable. If I were you I’d split up the code into smaller chunks or modules. [import]uid: 70134 topic_id: 36237 reply_id: 143984[/import]

Well there are about 8 different user displays that usually require data context specific to the operation in order to display the information to the user. So 80 percent of the code is just controlling those displays, plus the context menu’s etc.

I mentioned above I’m still kind of a monkey with code, but if I broke those things up into modules which I considered, it means making a fair number of globals so I can hand off the information needed to each of the modules, and everything I’ve read says not to, at least more things say not to then say to modulerize the programming.

Plus, everything was working great before, and when I’ve done something that breaks the code up to this point, it usually spits out some kind of error as opposed to crashing the simulator with no error message and it’s always been easy enough to comment out until I find the problem.

With this problem, I just don’t have a clue where to start, since it doesn’t give me any info to start with.
[import]uid: 170004 topic_id: 36237 reply_id: 144006[/import]