Board index
Programs with AI or Rules Enforcement
Magic: The Gathering - Duels of the Planeswalkers
Programming Talk



A possible way to debug without the old good script log
Moderator: CCGHQ Admins
A possible way to debug without the old good script log
by thefiremind » 22 Oct 2016, 20:38
I don't know if anybody knew this already, but I found how to get an error string that tells you what's wrong with your code.
I should warn you, though: I'm afraid it hangs the game with any code that produces no errors (the application still runs, but the duel doesn't progress). For this reason I think it's good only when you need to test a single function in search for the correct arguments.
Feel free to add any additional information you find.
- Code: Select all
local status, err = pcall(function()
-- Write here the code that you want to debug
end)
I should warn you, though: I'm afraid it hangs the game with any code that produces no errors (the application still runs, but the duel doesn't progress). For this reason I think it's good only when you need to test a single function in search for the correct arguments.
Feel free to add any additional information you find.
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
Currently busy with life...
-
thefiremind - Programmer
- Posts: 3515
- Joined: 07 Nov 2011, 10:55
- Has thanked: 118 times
- Been thanked: 722 times
Re: A possible way to debug without the old good script log
by Tejahn » 26 Oct 2016, 00:10
Do you have a screenshot of how this is displayed? A demonstration of sorts?
Re: A possible way to debug without the old good script log
by thefiremind » 26 Oct 2016, 08:38
Put this on a card (while using my message function):
But if you do this:
- Code: Select all
local status, err = pcall(function()
EffectController():GetManaPool(1)
end)
TFM_MessageBox(err)
But if you do this:
- Code: Select all
local status, err = pcall(function()
EffectController():GetManaPool()
end)
TFM_MessageBox(err)
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
Currently busy with life...
-
thefiremind - Programmer
- Posts: 3515
- Joined: 07 Nov 2011, 10:55
- Has thanked: 118 times
- Been thanked: 722 times
Re: A possible way to debug without the old good script log
by Tejahn » 26 Oct 2016, 15:17
Will test. Thanks!
Re: A possible way to debug without the old good script log
by Splinterverse2 » 31 Oct 2016, 13:24
This sounds interesting. Does it provide different info than the log does or does it just show it in a different place?
- Splinterverse2
- Posts: 52
- Joined: 20 Sep 2016, 13:52
- Has thanked: 13 times
- Been thanked: 0 time
Re: A possible way to debug without the old good script log
by thefiremind » 31 Oct 2016, 13:41
It's exactly the same as the log, which doesn't get created anymore in Magic Duels so it's a quite important discovery.Splinterverse2 wrote:This sounds interesting. Does it provide different info than the log does or does it just show it in a different place?
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
Currently busy with life...
-
thefiremind - Programmer
- Posts: 3515
- Joined: 07 Nov 2011, 10:55
- Has thanked: 118 times
- Been thanked: 722 times
Re: A possible way to debug without the old good script log
by Splinterverse2 » 31 Oct 2016, 15:36
Wow. I had no idea you didn't have the log in Duels. I can't live without that. I wouldn't complete anything. Glad you found this.thefiremind wrote:It's exactly the same as the log, which doesn't get created anymore in Magic Duels so it's a quite important discovery.Splinterverse2 wrote:This sounds interesting. Does it provide different info than the log does or does it just show it in a different place?
- Splinterverse2
- Posts: 52
- Joined: 20 Sep 2016, 13:52
- Has thanked: 13 times
- Been thanked: 0 time
Re: A possible way to debug without the old good script log
by thefiremind » 31 Oct 2016, 16:00
Well, if there's a syntax mistake the current action will stop running, so if in game you don't see happening what's supposed to happen, you know there's probably an error somewhere: it's a matter of looking back at the code and spotting what's wrong. The "pcall" discovery can certainly help, but not much: I still need to enclose the code in it, then test the card again, and hope that it doesn't hang the game before the error is encountered.
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
Currently busy with life...
-
thefiremind - Programmer
- Posts: 3515
- Joined: 07 Nov 2011, 10:55
- Has thanked: 118 times
- Been thanked: 722 times
8 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest