Filter bug

These are old bug reports that have been closed.
obsidean
Commonwealth Pilot
Commonwealth Pilot
Posts: 52
Joined: Sat Mar 22, 2008 12:36 am

I was screwing around with the code in the "fun with filters" thread to see if I could get that ore scan code working when I noticed something odd. The version of the code I was using that Periculi wrote puts out the message as intended.. but it does it even if there are no asteroids around, and for that matter it doesn't target asteroids that should contain ore.

If it was just a bit of bad coding that I could understand, but the exact same code in two different systems producing different results? That's just strange. On his machine (xp I believe) the code works perfectly well, on mine (win98se, everything else in the new version works fine btw) well it's basically as useful as a "hello world" program.

I'll post the whole extension just for that sake of it.

Code: Select all

<?xml version="1.0" ?>
<!DOCTYPE TranscendenceExtension
[
<!ENTITY itOrescanner			"0xD0B11000">

]>

<TranscendenceExtension UNID="0xD0B11200" version="0.99a">

<ItemType UNID="&itOrescanner;"
		name=				"Ore Scanner"
		level=				"5"
		value=				"7000"
		mass=				"1"
		frequency=			"uncommon"
		modifiers=			"Consumable"

		description=		"This device scans for ore in asteroids and can be used again."

		charges=			"1"
		valueCharges=		"true"
		>

	<Image imageID="&rsItems1;" imageX="192" imageY="96" imageWidth="96" imageHeight="96"/>

<Invoke> 
   (block (miningAsteroids guessAsteroid) 
   (setq miningAsteroids (sysFindObject gSource "t:asteroid")) 
   (setq miningAsteroids (filter miningAsteroids asteroid (objGetItems asteroid "*U +Ore"))) 

   (loop miningAsteroids 
      (block nil 
      (setq guessAsteroid (item miningAsteroids 0)) 
      (setq miningAsteroids (filter miningAsteroids asteroid (ls (objGetDistance asteroid gSource) (objGetDistance guessAsteroid gSource)))) 
      ) 
   ) 
   (objSetName guessAsteroid "Ore Detected") 
   (objSetIdentified guessAsteroid) 
   (objSendMessage gPlayership guessAsteroid "Ore detected!")
   (shpCancelOrders gPlayership) 
   (shpOrder gPlayership 'dock guessAsteroid) 
   ) 
   </Invoke>
</ItemType>

</TranscendenceExtension>
User avatar
Periculi
Fleet Officer
Fleet Officer
Posts: 1282
Joined: Sat Oct 13, 2007 7:48 pm
Location: Necroposting in a forum near you

George this is a bigger problem than just a filter bug.

obsidean did some experiments and sent me this pm
Well I messaged you before about the problem I was having with that ore scanner extension I was trying to make and I recently discovered something interesting.

I used a trick from my c++ classes and added some messages that should pop up when different parts of the invoke statement are used:

Code:

<Invoke>
(block (miningAsteroids guessAsteroid)
(setq miningAsteroids (sysFindObject gSource "t:asteroid"))
(objSendMessage gPlayership guessAsteroid "Expletive 1 Deleted!")
(setq miningAsteroids (filter miningAsteroids asteroid (objGetItems asteroid "*U +Ore")))

(loop miningAsteroids
(block nil
(setq guessAsteroid (item miningAsteroids 0))
(objSendMessage gPlayership guessAsteroid "Expletive 2 Deleted!")
(setq miningAsteroids (filter miningAsteroids asteroid (ls (objGetDistance asteroid gSource) (objGetDistance guessAsteroid gSource))))
)
)
(objSetName guessAsteroid "Ore Detected")
(objSetIdentified guessAsteroid)
(objSendMessage gPlayership guessAsteroid "Expletive 3 Deleted!")
(shpCancelOrders gPlayership)
(shpOrder gPlayership 'dock guessAsteroid)
)
</Invoke>


As you can see each block has a message in the middle and this allowed me to make a discovery, for some reason the computer is skipping the loop completely, regardless of the amount of asteroids on the map or screen only messages 1 & 3 displayed. Does this help you figure anything out, maybe how to fix it?
I have no idea why his machine would ignore the loop, the code works fine for me- so how can I fix it for him? Do you have any idea why loops and other iterative functions would be failing to be performed on an older version of windows?

I am on a Vista, and obsidean is on something prior to XP- a bunch of mods I have made don't work at all for him, and it looks like we figured out why- unfortunately, on many mods I can't think of any other way to do things besides loops or looping through lists.

Any ideas on what to do to help fix this short of getting obsidean an upgrade would be nice.
george moromisato
Developer
Developer
Posts: 2997
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

It's hard to know without more help debugging. I can think of a few avenues to try:

1. What is the value of miningAsteroids right before the loop? If it is Nil, then the loop would never execute.

2. How much memory is Transcendence using? Is it possible that the machine is running out of memory? What kind of machine is it? What OS is it running?

3. Are there other extensions or programs loaded?

4. In the second line, instead of "t:asteroid" try "t:populated" and see if it detects a station with ore in it (sell some ore to the nearest commonwealth station).

I think this is a memory problem.
obsidean
Commonwealth Pilot
Commonwealth Pilot
Posts: 52
Joined: Sat Mar 22, 2008 12:36 am

Memory shouldn't be a problem, I've had only one other problem with an extension and that was with System26. I'm using win98se, and as i said I've only had one problem extension before.
4. In the second line, instead of "t:asteroid" try "t:populated" and see if it detects a station with ore in it (sell some ore to the nearest commonwealth station).
I tried this and it found the station.

I'm working on finding out the value of miningAsteroids, I should have it later, but since it found the station the first option seems likely.
obsidean
Commonwealth Pilot
Commonwealth Pilot
Posts: 52
Joined: Sat Mar 22, 2008 12:36 am

Ok, I found out why it's not going into the loop, the first section is reporting nil always when I use "t:asteroid", but it works when I use "t:populated".

I've tested it far from asteroids, near them, near floating ore newly blasted from the asteroid, and still it returns nil.

So, is there any way to fix that or is something just screwed up?
george moromisato
Developer
Developer
Posts: 2997
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

You are running out of memory.

There are hundreds of asteroids; but only a few populated stations. That's why it works for +populated.

Try increasing the size of your virtual memory file.
User avatar
Aury
Fleet Admiral
Fleet Admiral
Posts: 5421
Joined: Tue Feb 05, 2008 1:10 am
Location: Somewhere in the Frontier on a Hycrotan station, working on new ships.

how much ram do you have?
using paging files would slow the game down though
(shpOrder gPlayership 'barrelRoll)
(plySetGenome gPlayer (list 'Varalyn 'nonBinary))
Homelab Servers: Xeon Silver 4110, 16GB | Via Quadcore C4650, 16GB | Athlon 200GE, 8GB | i7 7800X, 32GB | Threadripper 1950X, 32GB | Atom x5 8350, 4GB | Opteron 8174, 16GB | Xeon E5 2620 v3, 8GB | 2x Xeon Silver 4116, 96GB, 2x 1080ti | i7 8700, 32GB, 6500XT
Workstations & Render machines: Threadripper 3990X, 128GB, 6900XT | Threadripper 2990WX, 32GB, 1080ti | Xeon Platinum 8173M, 48GB, 1070ti | R9 3900X, 16GB, Vega64 | 2x E5 2430L v2, 24GB, 970 | R7 3700X, 32GB, A6000
Gaming Systems: R9 5950X, 32GB, 6700XT
Office Systems: Xeon 5318Y, 256GB, A4000
Misc Systems: R5 3500U, 20GB | R5 2400G, 16GB | i5 7640X, 16GB, Vega56 | E5 2620, 8GB, R5 260 | P4 1.8ghz, 0.75GB, Voodoo 5 5500 | Athlon 64 x2 4400+, 1.5GB, FX 5800 Ultra | Pentium D 3.2ghz, 4GB, 7600gt | Celeron g460, 8GB, 730gt | 2x Athlon FX 74, 8GB, 8800gts 512 | FX 9590, 16GB, R9 295x2 | E350, 8GB | Phenom X4 2.6ghz, 16GB, 8800gt | random core2 duo/atom/i5/i7 laptops
User avatar
Periculi
Fleet Officer
Fleet Officer
Posts: 1282
Joined: Sat Oct 13, 2007 7:48 pm
Location: Necroposting in a forum near you

back to the memory limits again, eh? I am fairly certain that was why System26 didn't want to run for you either, obsidean.

Hopefully the new navigation computer mod will work for you!
User avatar
FAD
Militia Captain
Militia Captain
Posts: 732
Joined: Thu Aug 10, 2006 5:33 am
Location: Area 51

I'm running Win98SE as well and I don't have any problems with the game or mod.

Obsidean, try setting your Virtual Memory so that Minimum is set to 60 (leave Windows to set the max, however). This will allow a constant "auxiliary" memory to buffer so you won't run out.
User avatar
digdug
Fleet Admiral
Fleet Admiral
Posts: 2620
Joined: Mon Oct 29, 2007 9:23 pm
Location: Decoding hieroglyphics on Tan-Ru-Dorem

here there is a nice article on windows 98 memory management and how to set vcache and virtual memory (and why)
http://aumha.org/win4/a/memmgmt.htm

hope it helps you :)
obsidean
Commonwealth Pilot
Commonwealth Pilot
Posts: 52
Joined: Sat Mar 22, 2008 12:36 am

I tried setting the size of my swap file, it actually made the game run worse, random freezes, sudden slowdowns and speedups. I never had a problem like that before I tried changing the virtual memory settings.
User avatar
Fatboy
Militia Lieutenant
Militia Lieutenant
Posts: 247
Joined: Fri Feb 22, 2008 1:52 am
Location: California

What was the size of it before, and what is it now.
What is your RAM amount.
obsidean
Commonwealth Pilot
Commonwealth Pilot
Posts: 52
Joined: Sat Mar 22, 2008 12:36 am

192 mb of ram and before I let windows manage the swap file

Now I have it set up for the swap file to be at least 200mb and for the computer to use the ram before the swap file.

Of course the extension still doesn't work, so I am going to quit trying to get it working.
User avatar
Periculi
Fleet Officer
Fleet Officer
Posts: 1282
Joined: Sat Oct 13, 2007 7:48 pm
Location: Necroposting in a forum near you

George mentioned adding an out-of-memory check to the sysFindObject in 099b- did you get the new version and try the mod with that?
obsidean
Commonwealth Pilot
Commonwealth Pilot
Posts: 52
Joined: Sat Mar 22, 2008 12:36 am

No, after I read about the save file corruption I decided to wait until he put out the fixed version.
Locked