the first is a filter that changes as it goes through the list
Code: Select all
(setq maxListCount 10)
(setq currentListCount 0)
(setq myCurrentSize 0)
(setq testFilter (lambda nil
;returns (0 1 2 3 6 12 24 48 96 192)
(block (myList)
(setq myList 0)
(for i 1 10000
(setq myList (append myList i))
)
(filter myList currentNumber
(if (and (ls currentListCount maxListCount) (geq currentNumber myCurrentSize))
(block nil
(setq myCurrentSize (add currentNumber myCurrentSize))
(setq currentListCount (add 1 currentListCount))
)
)
)
)
))
Code: Select all
(setq testNestedFilter (lambda nil
(block (shipList)
;get ships
(setq shipList (sysFindObject gPlayerShip "s"))
;get only friendly ships that have unequiped items that have mass greater than 100 and do not have the static data heavy
(setq shipList (filter (filter shipList myShip (objIsEnemy gplayership myShip)) enemyShip
(filter (objGetItems enemyShip "*U") element
(and (not (itmGetStaticData element "heavy")) (gr (itmGetMass element) 100))
)
))
)
))