fun with filter

This is a moderated forum that collects tutorials, guides, and references for creating Transcendence extensions and scripts.
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.

:D I'm certainly going to have to use these soon!
(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

:lol:

(filter (sysGetNodes) node (eq (count (sysGetStargates node) ) 2))

Which returns SE as well thanks to Debug gate. :evil:
obsidean
Commonwealth Pilot
Commonwealth Pilot
Posts: 52
Joined: Sat Mar 22, 2008 12:36 am

I tried making an ore scanner using your code, but it's simply either not finding the asteroids, or not showing the nearest one. According to Periculi the code works just fine on his machine, but all it does on mine is output the "ore found" message and that's it. If you guys have any idea how to make it work let me know.

There's the extension I made
http://neurohack.com/transcendence/foru ... php?t=1723

It might have something to do with my windows version but the only things that's given it any problems before was system26.
Retroactive
Commonwealth Pilot
Commonwealth Pilot
Posts: 66
Joined: Wed Mar 21, 2007 12:45 am

I won't pretend that I understand the script all that well, but is there any limit in the code that would prevent the AI from using a script like this? Say, on a police ship that would fly out from Commonwealth stations to meet incoming vessels and scan them for contraband at close range? Or shifty privateers who only attack you if your armor and shields are below a certain level?
User avatar
Betelgeuse
Fleet Officer
Fleet Officer
Posts: 1920
Joined: Sun Mar 05, 2006 6:31 am

Nope enemy ships can also use this kind of stuff. (anywhere you can put code you can use filter)
For things like police ships I would give them a timed event so they would check every so often.

But I do like the idea of having privateers going after weak ships or even you could make wreck looting or destroying ships.
Crying is not a proper retort!
User avatar
Betelgeuse
Fleet Officer
Fleet Officer
Posts: 1920
Joined: Sun Mar 05, 2006 6:31 am

a new use for filter that I just used in my tinkerer plus one mod.

to test if every element in a list is true for a condition you just

(eq (count (filter myList element condition)) (count myList))

and now you have a conditional to test if every element in a list passes a condition 8)
Crying is not a proper retort!
F50
Fleet Officer
Fleet Officer
Posts: 1004
Joined: Sat Mar 11, 2006 5:25 pm

I would like to use (sysFindObj) and or (filter) to find a planet/star with a certain name, how would I go about doing that?
User avatar
Betelgeuse
Fleet Officer
Fleet Officer
Posts: 1920
Joined: Sun Mar 05, 2006 6:31 am

Code: Select all

(filter (sysFindObj gplayership "t") spaceobject (eq (objGetName spaceobject) name)  
where name is the name you are looking for would return a list of everything with that name
or use sysGetObjectByName. (that would seem easier)
Crying is not a proper retort!
F50
Fleet Officer
Fleet Officer
Posts: 1004
Joined: Sat Mar 11, 2006 5:25 pm

Betelgeuse wrote: or use sysGetObjectByName. (that would seem easier)
There's a special function for that? :oops:

Here I thought I would have to figure out sysFindObj or do something a bit more difficult. Thanks, and sorry.
Post Reply