PDA

View Full Version : Combat tracker problem



Blue Haven
January 9th, 2008, 21:05
Hi there :)
I have a classic D&D ruleset that has a problem with the combat tracker and iīm looking for someone that could help me out fixing this problem...when i drag the character to the combat tracker i get an error nil value "ac" and i canīt figure out what to do to fix this...because the program freezes after that and its very annoying :(
Does anyone understands the script of the combat tracker?? can anyone help me out??
I use negative values in the armor class because its Classic D&D...
help me please :)

joshuha
January 9th, 2008, 21:16
Do you have an AC field on your character sheet? Did you rename or modify it by chance?

Is this both with NPCs and PCs?

Blue Haven
January 9th, 2008, 22:36
Yes i do have an AC field on the character sheet and no i don´t rename it :(
This only happens whit the players...when i drag the character portrait to the combat tracker, appears a window with a warning like i said nil value "ac" and the game freezes to me not to the players...
If i send you the character sheet can you look to see what´s wrong??
Thanks

joshuha
January 10th, 2008, 04:39
Well it may not be your PC sheet that is the problem. When you get the error does it reference a line number and a file? I am guessing its combattracker.lua file, maybe line 107?

If thats the case, create a character for me and just PM or e-mail me the DB.xml entry for just that character.

DNH
January 10th, 2008, 09:31
I had the same problem when developing my 2e ruleset. I tracked it down to the 'setLink' call for the total AC, which looks as though it should work exactly as it is ... only it doesn't. The total AC on the character sheet is a linkednumber, with sources like armour type, Dex bonus, shield, etc. I wanted to be able to alter the AC on the character sheet and have that reflect on the combat tracker, just like it does with hit point, name or anything else.

This is the line of code which won't work:


newentry.ac.setLink(source.getChild("ac.totals.general"));

Anyway, I gave up in the end and employed a workaround; namely, simply looking up the overall AC value for the character and using 'setValue' to that. I figure that AC does not normally change dynamically during the course of a combat anyway.

This is the code which does work:


local acgeneral = source.getChild("ac.totals.general").getValue();
newentry.ac.setValue(acgeneral);

Blue Haven
January 10th, 2008, 09:58
Well it may not be your PC sheet that is the problem. When you get the error does it reference a line number and a file? I am guessing its combattracker.lua file, maybe line 107?

If thats the case, create a character for me and just PM or e-mail me the DB.xml entry for just that character.

But i didnīt touch the combattracker.lua file :( but i will try some things...

Blue Haven
January 10th, 2008, 11:14
I had the same problem when developing my 2e ruleset. I tracked it down to the 'setLink' call for the total AC, which looks as though it should work exactly as it is ... only it doesn't. The total AC on the character sheet is a linkednumber, with sources like armour type, Dex bonus, shield, etc. I wanted to be able to alter the AC on the character sheet and have that reflect on the combat tracker, just like it does with hit point, name or anything else.

This is the line of code which won't work:


newentry.ac.setLink(source.getChild("ac.totals.general"));

Anyway, I gave up in the end and employed a workaround; namely, simply looking up the overall AC value for the character and using 'setValue' to that. I figure that AC does not normally change dynamically during the course of a combat anyway.

This is the code which does work:


local acgeneral = source.getChild("ac.totals.general").getValue();
newentry.ac.setValue(acgeneral);

I worked on line 107 just like you did and this is what i get...:(
Can you help me...?

Blue Haven
January 10th, 2008, 11:40
I had the same problem when developing my 2e ruleset. I tracked it down to the 'setLink' call for the total AC, which looks as though it should work exactly as it is ... only it doesn't. The total AC on the character sheet is a linkednumber, with sources like armour type, Dex bonus, shield, etc. I wanted to be able to alter the AC on the character sheet and have that reflect on the combat tracker, just like it does with hit point, name or anything else.

This is the line of code which won't work:


newentry.ac.setLink(source.getChild("ac.totals.general"));

Anyway, I gave up in the end and employed a workaround; namely, simply looking up the overall AC value for the character and using 'setValue' to that. I figure that AC does not normally change dynamically during the course of a combat anyway.

This is the code which does work:


local acgeneral = source.getChild("ac.totals.general").getValue();
newentry.ac.setValue(acgeneral);

Should i erase all the line 107 and put what you have written??

DNH
January 10th, 2008, 12:57
Well, the default d20 version is this:


newentry.ac.setLink(source.getChild("ac.totals.general"), source.getChild("ac.totals.touch"), source.getChild("ac.totals.flatfooted"));

You could erase it, yes, but I tend to comment things out until I know my own stuff works and I don't need the original anymore. It's also useful as reference material. To comment out in lua, just add a double-hyphen ("--") before the line.

I would try my workaround just to get things working until Joshuha-sensei or some other guru can figure out why the setLink thing won't work, but take care to reference the correct element in your character sheet xml code (although I think "ac.totals.general" will do it if you haven't renamed anything).

Blue Haven
January 10th, 2008, 14:18
Well, the default d20 version is this:


newentry.ac.setLink(source.getChild("ac.totals.general"), source.getChild("ac.totals.touch"), source.getChild("ac.totals.flatfooted"));

You could erase it, yes, but I tend to comment things out until I know my own stuff works and I don't need the original anymore. It's also useful as reference material. To comment out in lua, just add a double-hyphen ("--") before the line.

I would try my workaround just to get things working until Joshuha-sensei or some other guru can figure out why the setLink thing won't work, but take care to reference the correct element in your character sheet xml code (although I think "ac.totals.general" will do it if you haven't renamed anything).

I erased the line 107 and changed to the new code you said and then i get this error...

Blue Haven
January 10th, 2008, 14:26
AHHH :D it works!!!! lolol i forgot to clean some letters lol
Thanks!!!! :D

Blue Haven
January 11th, 2008, 12:16
Ok now i have a new error :( this happens when i close the combat tracker and open it again...but if i press the button to close and open the tracker i get no error :confused: i only get this error when i close with the option (right click mouse) can you guys see where is the problem???

Hamish
January 11th, 2008, 14:43
Pressing the button doesn't actually close the combat tracker, it just hides the window, so that explains that difference. I haven't really followed the rest of the thread, since I don't play anything but 3.5, so I can't help with the error, sorry.

Blue Haven
January 11th, 2008, 16:12
So it means that , even if i use the button , next time i play and open the tracker bum...crash :( what now...?

joshuha
January 11th, 2008, 16:22
The issue really is that you have modified your character sheet enough that the way the AC builds for other scripts is causing issues.

Look at line 290 in the combattracker_entry.lua file.

It should look similar to this:

ac.setLink(targetnode.getChild("ac.totals.general"), targetnode.getChild("ac.totals.touch"), targetnode.getChild("ac.totals.flatfooted"));

Again if you don't have those other fields or have your AC setup differently its best to just do an ac.setValue and not worry about dynamically updating the AC on the tracker.

Blue Haven
January 11th, 2008, 18:40
So i use the ac.setValue on this one too?? is that what you´re saying?? i use the same line but now with this new combattracker_entry.lua file...?

Blue Haven
January 11th, 2008, 19:32
The issue really is that you have modified your character sheet enough that the way the AC builds for other scripts is causing issues.

Look at line 290 in the combattracker_entry.lua file.

It should look similar to this:

ac.setLink(targetnode.getChild("ac.totals.general"), targetnode.getChild("ac.totals.touch"), targetnode.getChild("ac.totals.flatfooted"));

Again if you don't have those other fields or have your AC setup differently its best to just do an ac.setValue and not worry about dynamically updating the AC on the tracker.

I have that line exactly as you show in here and then i changed to the ac.setValue and i get this error :(

joshuha
January 11th, 2008, 19:48
It won't be the exact same line as its a different section of the code.

It would be something similar to this:

ac.setValue(targetnode.getChild("ac.totals.general").getValue());

I can't say for certain because you have modified the PC sheet but the above should work.

Blue Haven
January 11th, 2008, 20:45
I have written that and i get another error saying bla bla bla nil value... :( if i send you the character sheet can you try to fix this???

joshuha
January 11th, 2008, 20:52
Nope sorry, I can try and help you through your own code but it may not be as simple as the PC sheet or the combattracker and I don't know exactly what you have done to the sheet or the rest of the ruleset.

What is the exact error you get when you used the line from above in place of the original line?

Blue Haven
January 12th, 2008, 14:35
When i use that i get this error...
Sorry for the delay...

Blue Haven
January 16th, 2008, 12:13
No one knows what to do to fix this error...? :(

joshuha
January 16th, 2008, 14:22
The thing thats hard about this is you have customized your ruleset and not knowing exactly what you did to what files it makes it difficult to determine why it's not finding that field. I am guessing you modified or remove large sections of the automatic AC calculation since that's not used in Classic D&D but that has effects like you see above.

Can you goto in the db.xml and look for one of your characters you have created and paste that XML here? From the structure there I should be able to help determine how your AC is being recorded.

Blue Haven
January 16th, 2008, 16:26
Here goes the file :) sorry i didnīt post this sooner...

joshuha
January 16th, 2008, 16:33
I realized due to formatting my last attempt to give you a line had a space in it where it shouldn't have.

Try this:


ac.setValue(targetnode.getChild("ac.totals.general").getValue());


If that still gets you an error try these instead for some debugging purposes.


print(targetnode.getChild("ac").getNodeName());
print(targetnode.getChild("ac.totals").getNodeName());
print(targetnode.getChild("ac.totals.general").getNodeName());
print(targetnode.getChild("ac.totals.general").getValue());
ac.setValue(targetnode.getChild("ac.totals.general").getValue());


Then just give me a screenshot of the error.

Blue Haven
January 16th, 2008, 17:46
LOL that space left behind does the trick :) IT WORKS!!! eh eh eh thanks a lot Joshuha :) i didn´t see that space before :)
Thanks :D