weird debug message.

Freeform discussion about anything related to modding Transcendence.
Post Reply
F50
Fleet Officer
Fleet Officer
Posts: 1004
Joined: Sat Mar 11, 2006 5:25 pm

from debug log:
11/02/2008 11:58:48 SendPicxToGuard [Unknown Beacon]: Function name expected: list ### (shpOrderGate thisPicx outGate) ###
11/02/2008 11:59:44 WirEncounter [Unknown Beacon]: Function name expected: list ### (setq WirList (list (sysCreateShip -543031289 wirVec -543027198))) ###
thisPicx is created by (enum)erating what should be a list of references.


EDIT: I guess I should probably post this code too.

Code: Select all

	(block Nil
		(setq extSetObjListData (lambda (source name refList)
			(block (x thisObj)
				(setq x 0)
				(enum refList thisObj
					(block Nil
						(objSetObjRefData source (cat name x) thisObj)
						(setq x (add x 1))
					)
				)
				(objSetData source (cat name "X") x)
			)
		))
		(setq extGetObjListData (lambda (source name)
			(block (x finXValue newObj)
				(setq finXValue (objGetData source (cat name "X")))
				(setq List (list Nil))
				(for x 0 finXValue
					(block Nil
						(setq newObj (objGetObjRefData source (cat name x)))
						(setq List (append List (list newObj)))
					)
				)
			)
			List ;return value
		))
	)
This is supposed to get/set lists of references. It would be a useful pair of functions if I could prove that they work. The problem expressed in the first debug line arises when I save a list known to be valid (PicxPlayerEscort), and then do this code in an event:

Code: Select all

(block (PixList thisPicx outGate)
	(setq PicxList (extGetObjListData gSource "PicxPlayerEscort"))
	(setq outGate (sysGetObjectByName gSource "Outbound"))
	(enum PicxList thisPicx
		(shpOrderGate thisPicx outGate)
	)
	(sysAddObjTimerEvent 40 gSource "PicxFinCheck")
)
If I am lucky, this is my last bug to work through for the first Post-Heretic system.
F50
Fleet Officer
Fleet Officer
Posts: 1004
Joined: Sat Mar 11, 2006 5:25 pm

In-lining the "get" function gets rid of the error message, but still doesn't seem to allow you to work with the original objects again.
F50
Fleet Officer
Fleet Officer
Posts: 1004
Joined: Sat Mar 11, 2006 5:25 pm

Sorry for triple-post, but I've found a bug.

When in-lining the function, no error message is produced. If you replace the (shpOrderGate thisPicx outGate) statement with (objDestroy thisPicx) or (objJumpTo thisPicx (objGetPos gPlayerShip)), it works (proving that I have access to the object). However, shpOrderGate (and any other order for that matter) fails. The ships continue with their previous objective (escort playership), and pick escort positions in what seems like a random fashion.

What could possibly create this behavior?

I'll ask permission to post the entire mod (including a savefile that I have been using to test) on Xelerus along with instructions to replicate the bug (I've tested more than 10 times and the same thing happens every time).
User avatar
Atarlost
Fleet Admiral
Fleet Admiral
Posts: 2391
Joined: Tue Aug 26, 2008 12:02 am

I think that's what the bug tracker is for. You can file a bug report and attach files, including saves, to it.
F50
Fleet Officer
Fleet Officer
Posts: 1004
Joined: Sat Mar 11, 2006 5:25 pm

YURGH! (shpCancelOrders) solves my problem.

Which leaves me with two questions:

1. What does the error message "Function name expected: list" really mean?

2. Why doesn't this function properly return a list (once this is solved I'll put my two functions in the useful functions script reference topic).

Code: Select all

      (setq extGetObjListData (lambda (source name)
         (block (x finXValue newObj)
            (setq finXValue (objGetData source (cat name "X")))
            (setq List (list Nil))
            (for x 0 finXValue
               (block Nil
                  (setq newObj (objGetObjRefData source (cat name x)))
                  (setq List (append List (list newObj)))
               )
            )
         )
         List ;return value
      )) 
speedofsquid
Commonwealth Pilot
Commonwealth Pilot
Posts: 55
Joined: Wed Aug 27, 2008 6:30 pm
Location: USA

I noticed some irregularities with your get function:

The explicit return value is outside of the block, so I think it is ignored.

The variable "List" used for the return value is defined outside of the block.
(It is given an initial value for use in the block, so this should not cause any problem.)

The initial value of "List" is set as a list containing Nil, so the first element of the returned list is Nil.

finXValue is the number of objects, but the variables holding their references are numbered from zero to finXValue-1.

Was this your intent? (untested):

Code: Select all

      (setq extGetObjListData (lambda (source name)
         (block (x finXValue newObj List)
            (setq finXValue (objGetData source (cat name "X")))
            (setq List Nil)
            (for x 0 (subtract finXValue 1)
               (block Nil
                  (setq newObj (objGetObjRefData source (cat name x)))
                  (setq List (append List (list newObj)))
               )
            )
         List ;return value - actually redundant for this function
         )
      ))
F50
Fleet Officer
Fleet Officer
Posts: 1004
Joined: Sat Mar 11, 2006 5:25 pm

speedofsquid wrote:The explicit return value is outside of the block, so I think it is ignored.
You're right. That is probably my problem. LISP is nice, but parentheses are easy to misuse. :oops:

I set List to Nil so that List would be a list when I used append on it. It may be extranious though. I'll test. I got it to work using (lnkRemoveNil) after the inline function so I wouldn't have noticed.

If the for loop in the sett function acts like a C for loop using x++ and not ++x, then finXValue would be correct and not finXValue-1, however if it is the other way around then you are correct.

I'll try it. Thanks speedofsquid! Apparently I'm still learning the basics of transcendence scripting. Thanks!

OT: Why did you think of the name "speedOfSquid", and how fast does a squid move anyways?
speedofsquid
Commonwealth Pilot
Commonwealth Pilot
Posts: 55
Joined: Wed Aug 27, 2008 6:30 pm
Location: USA

F50 wrote:I set List to Nil so that List would be a list when I used append on it. It may be extranious though. I'll test.
I did a quick test, and Nil is equivalent to the empty list when used as an argument to append.
F50 wrote:If the for loop in the sett function acts like a C for loop using x++ and not ++x, then finXValue would be correct and not finXValue-1, however if it is the other way around then you are correct.
(for x 0 0 'iterated) returns iterated
(for x 0 -1 'iterated) returns Nil

OT: My name has no particular significance. I have no special knowledge of squid.
F50
Fleet Officer
Fleet Officer
Posts: 1004
Joined: Sat Mar 11, 2006 5:25 pm

Your code works flawlessly. I will post my functions to scripting reference.
Post Reply