Page 1 of 1

Debug OXP on Linux/Ubuntu

Posted: Mon Jul 21, 2008 10:16 pm
by DaddyHoggy
OK I'm clearly being a dumbass

https://bb.oolite.space/viewtopic.php?t=4589

According to that thread Ahruman states:
On other platforms, I’d suggest starting by reading the included Read Me file.
But I can't find a readme and I don't know how to use/start the oxp/debug - all I want to do is drop a ship I'm testing right in front of me as I launch from a station so I can get a good look at it.

Any help much appreciated.

Posted: Mon Jul 21, 2008 10:43 pm
by Disembodied

Code: Select all

{
   "daddyhoggy_test_ship" = (
       {
           conditions = (
               "status_string equal STATUS_LAUNCHING"
           ); 
           do = (
               "addSystemShips: daddyhoggy 1 1.0"
           ); 
       }
   );
} 
might do the trick as a script.plist. If I've not gucked the whole thing up – always a possibility – this should drop a ship called a daddyhoggy somewhere inside the aegis on launching. To perhaps increase your confidence, I took the code from the wiki...

Posted: Tue Jul 22, 2008 8:09 am
by DaddyHoggy
Thanks disembodied - I'm not sure my ship will appear but it'll be nice to know it should - the problem I've got is that I've copied and modified the original worm to make my own version (i.e. the Lave Roover) but I thought I'd get clever and add some glows and stuff (not brave enough to try Shaders yet) - but while the worm stuff is obviously in the original xml style format the new glow stuff examples I've found are in the more readable format you've just given me and I'm not sure I've correctly converted between one type and the other or even if you can mix and match (I suspect not!)

Posted: Tue Jul 22, 2008 8:19 am
by another_commander
DaddyHoggy: To use the debug OXP, you must have the debug console running. On Windows, this is distributed as a separate executable. As far as I can tell, there is no debug console port for Linux yet, although the Python source files are part of the console distribution on Berlios and in theory it can be set up and should work. Someone will have to do it first, though.

Alternatively, you can try what we had done with Ahruman when the debug console was being tested for the first time: One system capable of running the console on one side (Mac or Windows PC), your Linux system running Oolite with debug OXP on the other, connected via TCP/IP. You execute commands on the console computer and see the results on the Linux side.

If this is not feasible, then I guess for now Disembodied's solution should be the best that can be done for Linux.

Edit: In fact, there _is_ a readme in the console package and it states this:
OODebugConsole_Readme.txt wrote:
You can run the python code _as is_ on macs and linux systems, but you need to install the twisted-python library first - http://twistedmatrix.com/trac/wiki/Downloads
So, I guess you can go for it, after all.

Posted: Tue Jul 22, 2008 4:50 pm
by JensAyton
Detailed instructions for using the debug console under Ubuntu:
  • Put the Debug OXP in your OXP place.
  • Open Synaptic and install “python-twisted” and “python-tk”.
  • Extract the OoDebugConsole_Src.zip archive from the oolite-debug-console package.
  • Open a terminal, cd into the extractedOoDebugConsole_Src folder, and run “python DebugConsole.py”. (A window should appear, saying “waiting for connection…” with exceptionally badly-rendered text.)
  • Run Oolite. The text “Opened connection with Oolite version 1.71.2” should appear in the console. You can now enter JavaScript expressions. For instance, try “P” (short for “player”) or “P.credits = 500000”.
Currently, the debug console does not work with the trunk, even if you fiddle with requires.plist. I’m not certain why.

Posted: Tue Jul 22, 2008 4:55 pm
by another_commander
Ahruman wrote:
Currently, the debug console does not work with the trunk, even if you fiddle with requires.plist. I’m not certain why.
Is this problem Linux specific? I seem to have it working fine with trunk under Windows

Posted: Tue Jul 22, 2008 4:59 pm
by JensAyton
another_commander wrote:
Ahruman wrote:
Currently, the debug console does not work with the trunk, even if you fiddle with requires.plist. I’m not certain why.
Is this problem Linux specific? I seem to have it working fine with trunk under Windows
Dunno, I just noticed. The log gives me that most helpful of messages – “error: unknown error”.

Posted: Tue Jul 22, 2008 8:22 pm
by DaddyHoggy
Thanks guys - As usual RL has got in the way - forgot I was going on holiday!

Will do precisely what Ahruman suggested as soon as I'm back,

Posted: Sun Sep 21, 2008 11:50 am
by Micha
The following change to OODebugTCPConsoleClient.m:readData gets it working with the oolite trunk (under Linux). There's probably a more elegant way to write the fix but it works for now. If the same fix works under MacOS perhaps this can go into the trunk.
Of course, the "if (length < 1)" test is superfluous now as well.

Also need to change the max version in the requires.plist of the OXP as well.

Code: Select all

	//while ([_inStream hasBytesAvailable])
	length = [_inStream read:buffer maxLength:kBufferSize];
	while( length > 0 )
	{
		if (length < 1)
		{
			// Under GNUstep, but not OS X (currently), -hasBytesAvailable will return YES when the buffer is in fact empty.
			if ([_inStream streamStatus] == NSStreamStatusReading) break;
			
			[self breakConnectionWithBadStream:_inStream];
			return;
		}
		
		data = [NSData dataWithBytesNoCopy:buffer length:length freeWhenDone:NO];
		OOTCPStreamDecoderReceiveData(_decoder, data);
		length = [_inStream read:buffer maxLength:kBufferSize];
	}

Posted: Sun Feb 01, 2009 8:21 pm
by Getafix
This is to confirm that using Debug.OXP 1.72 and following Ahruman's
instructions, the debug console is working properly for 1.72.2.
Furthermore, if max_version, in 'requires.plist', is changed (e.g. 1.73.99),
the debug console is also functional for trunk revision 2023.
Tested on Ubuntu 8.04 32bit and 64bit.

Posted: Sun Feb 01, 2009 9:25 pm
by DaddyHoggy
Excellent - I'll do Ahruman's fix and put debug.oxp back in my Addons folder then!

Re: Debug OXP on Linux/Ubuntu

Posted: Sat Jun 28, 2014 4:10 pm
by Diziet Sma
* Deleted to avoid unnecessary humiliation *

Re: Debug OXP on Linux/Ubuntu

Posted: Sat Jun 28, 2014 4:16 pm
by cim
Diziet Sma wrote:
I've made a DebugConsole.py file from the listing at https://github.com/OoliteProject/oolite ... Console.py and made it executable.
When you say "you made a DebugConsole.py file", what exactly do you mean? (If it wasn't using git to check it out, or using the "download zip" button on the right of https://github.com/OoliteProject/oolite-debug-console , then what did you do?)

I'm using exactly that file and it works fine here.

(Other thing to check - you say you're doing "python DebugConsole.py" - what happens if you just do "./DebugConsole.py"?)

Re: Debug OXP on Linux/Ubuntu

Posted: Sat Jun 28, 2014 4:19 pm
by Diziet Sma
cim wrote:
When you say "you made a DebugConsole.py file", what exactly do you mean? (If it wasn't using git to check it out, or using the "download zip" button on the right of https://github.com/OoliteProject/oolite-debug-console , then what did you do?)
Copy and pasted the listing into a text editor, saved it, made it executable.. nothing different than I've done many times with other listings.
cim wrote:
(Other thing to check - you say you're doing "python DebugConsole.py" - what happens if you just do "./DebugConsole.py"?)
Exactly the same error:

Code: Select all

  File "./DebugConsole.py", line 149
    else:
       ^
SyntaxError: invalid syntax

Re: Debug OXP on Linux/Ubuntu

Posted: Sat Jun 28, 2014 4:25 pm
by Diziet Sma
Never mind.. I'm an idiot.

Totally didn't see the "Download zip" button. Downloaded the entire thing, ran that file and all is working correctly. Been so long since I used it, I'd forgotten there were other files necessary for it to work properly.

I'll just go crawl under a rock now.. :oops: