Newbie questions on debugging and positions of selections

Help with writing and running scripts

Newbie questions on debugging and positions of selections

Postby Bracket » Sat Oct 27, 2007 11:06 pm

New to scripting with UE, I have two really simple (I hope) questions:


1. Is there any way to debug scripts in UE?

2. Is there any way to grab the line/column positions of the start and end of a selection?


TIA!
User avatar
Bracket
Basic User
Basic User
 
Posts: 35
Joined: Fri Oct 26, 2007 11:00 pm

Re: Newbie questions on debugging and positions of selection

Postby Mofi » Sun Oct 28, 2007 9:44 am

Look on my hopefully well commented functions at Replacment for macro command Find Select "..." which is an answer for your second question.

And your first question is also answered by my code. You will see how I have added debug messages and which techniques are possible for debugging. Writing to output window lets the script run without user interactions, but with infos where something not worked as expected. Using a message box has the advantage of pausing script execution and so you can see how the file currently looks like.

I think, a real debug with step by step execution is not possible. But I'm a newbie in script writing too.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4055
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: Newbie questions on debugging and positions of selection

Postby Bracket » Sun Oct 28, 2007 3:49 pm

I'm sad to see that a true debugging is not possible - that would have been fantastic if it could be done.

But that being the case, your code was indeed very helpful, in both respects. Thank you! :)
User avatar
Bracket
Basic User
Basic User
 
Posts: 35
Joined: Fri Oct 26, 2007 11:00 pm

Re: Newbie questions on debugging and positions of selection

Postby jorrasdk » Mon Oct 29, 2007 8:53 am

Nope, step-by-step and breakpoint debugging is currently not possible in the UE scripting engine. You have to rely on techniques as implemented by Mofi in his scripts.

From the start with javascript in webbrowsers the situation was much the same. A lot of document.write("<!-- my trace output -->") and alert() was used to debug. But in recent years more and more powerful tools are available to javascript developers in both IE and Firefox. The Venkman Javascript Debugger for Firefox is the most capable debugger I have come across. Maybe there are others even more capable that I just isn't aware of.

Sadly I can't see how this can integrate with the scripting engine in UE. But if the UE users continue to develop more and more complex scripting solutions, we might want to ask IDM to consider supplying an add-on debugging tool for UE, or some kind of integration with existing tools.

But for now, use Mofis approach and also clean your javascript code for the most obvious errors with JavaScript Lint
User avatar
jorrasdk
Master
Master
 
Posts: 275
Joined: Mon Mar 19, 2007 11:00 pm
Location: Denmark

Re: Newbie questions on debugging and positions of selection

Postby Bracket » Mon Oct 29, 2007 11:20 am

Out of curiosity, would UE Studio's integrated debugger allow for this functionality? Or would even that not work with their scripting engine?
User avatar
Bracket
Basic User
Basic User
 
Posts: 35
Joined: Fri Oct 26, 2007 11:00 pm


Return to Scripts