Re-Working That one "Old" Mod

A place to discuss mods in development and concepts for new mods.
Post Reply
User avatar
pip
Militia Lieutenant
Militia Lieutenant
Posts: 114
Joined: Fri Jul 13, 2012 6:31 am

I am a huge fan of a particular mod that I started using back in 1.01, only it's compatibility with every version since has been spotty at best.
Bobby's Repair Droids

So far I've been able to determine that everything seems to work as intended barring a single function: (setq snForcedAutoInstall (lambda (Source Item)
What is supposed to happen is that the droids (which are basically cowardly patch spiders) hide in your cargo bay when your shields drop past 15%, then come out again when it's safe.
What does happen is that they hide away perfectly fine, but then refuse to come out again ie: be "auto" installed by the exp above and end up in an infinite loop of trying to install yet failing.
This can be temp fixed by manually installing the item, but does not resolve the underlying problem.

Now I have pretty limited experience with scripting/coding languages so am looking at this and wearing a hole in my head with all this scratching wondering what the hay changed to upset this thing.
Anyone have a clue?
FourFire
Militia Captain
Militia Captain
Posts: 567
Joined: Sun Aug 12, 2012 5:56 pm

I too an a fan of this really useful mod, and I would also like to see the problem resolved, I however don't have a clue how to fix it.
Perhaps looking in the code will help?

Ok:
first we have

Code: Select all

<Events>
			<onUpdate>
			(block Nil
				(snRepairDroidAutoInstall)
				(snPteravoreDefense 70)
			)
			</onUpdate>
		</Events>
Then

Code: Select all

<Invoke>
			(intAutoInstall gSource gItem)
		</Invoke>
The Hide code is

Code: Select all

(setq snRepairDroidAutoInstall (lambda Nil
			;don't do anything if it is damaged
			(if (not (itmIsDamaged gItem))
				(block Nil
				;if shield is down and enemies are near
					(if (and (geq (shpGetShieldDamage gSource) (divide (shpGetShieldMaxHitPoints gSource) 2)) (sysFindObject gSource "stAE N:85;"))
						;only do anything if it is installed
						(if (itmIsInstalled gItem)
							(block Nil
								;set some data and remove it.
								(setq gItem (objSetItemCharges gSource gItem 1))
								(snForcedAutoInstall gSource gItem)
							)
						)
						(if (and (not (itmIsInstalled gItem)) (gr (itmGetCharges gItem) 0))
							(block Nil
								;set some data and install it.
								(setq gItem (objSetItemCharges gSource gItem Nil))
								(snForcedAutoInstall gSource gItem)
							)
						)
					)
				)
			)
		))
The reinstall code (which from my experience is what is looping and not functioning properly) is

Code: Select all

(setq snForcedAutoInstall (lambda (Source Item)
			(if (itmIsInstalled Item)
				; Uninstall item
				(block Nil
					(block Nil
						(objSendMessage Source Nil (cat (itmGetName Item 1) " takes shelter."))
						(shpRemoveDevice Source Item)
					)
				)
				
(block (result)
					(block Nil
						(objSendMessage Source Nil (cat (itmGetName Item 1) " back to work."))
						(shpInstallDevice Source Item)
					)
				)
			)
		))
If someone can somehow figure it out then that would be great, personally I don't know how to code, but I vaguely
suspect that there is some problem with noy having the opposite of "snRepairDroidAutoInstall (lambda Nil)" somewhere in there, or something.
(func(Admin Response)= true){
if(admin func(amiable) = true)
Create func(Helpful Posts)
else func(Keep Calm and Post derisive topics)}
PM
Fleet Admiral
Fleet Admiral
Posts: 2570
Joined: Wed Sep 01, 2010 12:54 am

I just uploaded a patch to Xelerus.
Download and Play in 1.9 beta 1...
Drake Technologies (Alpha): More hardware for combat in parts 1 and 2!
Star Castle Arcade: Play a classic arcade game adventure, with or without more features (like powerups)!
Playership Drones: Buy or restore exotic ships to command!

Other playable mods from 1.8 and 1.7, waiting to be updated...
Godmode v3 (WIP): Dev/cheat tool compatible with D&O parts 1 or 2.
User avatar
pip
Militia Lieutenant
Militia Lieutenant
Posts: 114
Joined: Fri Jul 13, 2012 6:31 am

Post Reply