code query '

Freeform discussion about anything related to modding Transcendence.
Post Reply
relanat
Militia Captain
Militia Captain
Posts: 601
Joined: Tue Nov 05, 2013 9:56 am

Wed Jun 27, 2018 3:12 am

Querying what ' does when used in code.

This example works to format an item name with an item count and non quoted speech showing in unknown item names.

Code: Select all

(itmGetName theItem '(countAlways escapeQuotes))
but I'm copying, not understanding.
It looks like it could be similar to 'and' or 'list'.
What is it doing, what restrictions are there and how does it work? TIA.

User avatar
AssumedPseudonym
Fleet Officer
Fleet Officer
Posts: 1036
Joined: Thu Aug 29, 2013 5:18 am
Location: On the other side of the screen.

Wed Jun 27, 2018 5:09 pm

 It was probably best explained here.
Image

My mods on Xelerus: Click here!

Of all the things I’ve lost in life, I miss my mind the least. (I’m having a lot more fun without it!)

relanat
Militia Captain
Militia Captain
Posts: 601
Joined: Tue Nov 05, 2013 9:56 am

Fri Oct 19, 2018 1:30 am

See the link that AP posted. (Thank you.)
The quote character is used when you don't want to evaluate the arguments in the list. The list function is used when you do.
So if you want to select or compare a value but not do anything to it then use '.
Examples from 1.8b3.3 SOTP listed here for easy reference.

Antarctica02.xml
Check for typData values with 'find'.

Code: Select all

(find '(underAttack friend) (typGetData &msEscapeFromDantalion; 'status)
also nodeIDs (CommonwealthAgricultural.xml)
(find '(SE SK CD) (@ theEntry 2))
BattleArena.xml
Select a value using 'random',

Code: Select all

(random '("Starton Eridani" "St. Katharine's Star" "Rigel Aurelius" "Centauri" "Kibo"))
(random '(-500 -250 -100 -50 -25 -25 0 0 0 +25 +25 +50 +100))
also
select an item (CommonwealthFleetMission02.xml)
(random '(&itGradeAGrains; &itWaterIce; &itMedicalSupplies; &itSalmonite;))
select a UNID (CharonPirates.xml)
(random '(&etPirateAmbush1; &etPirateAmbush2;))
select an enhancement (Volkov.xml)
(random '(0x0102 0x0105 0x0A28 0x0A38))
BattleArena.xml again
Use several options with 'itmGetName' name flags.
Can also be used with 'objGetName' in the same way.
And for the options on 'objHasItem/objRemoveItem'.

Code: Select all

(itmGetName shieldItem '(short actual))
(itmGetName theItem '(short actual capitalize))
BattleArenaMelee.xml
Set data values with 'objSetData'.

Code: Select all

(objSetData arenaObj 'results '(0 0 0 0))
CommonwealthFleetMission02.xml
Use for multiple 'map' options.

Code: Select all

(map stationList '(reduceMin original) thePair (objGetDistance (@ thePair 0) (@ thePair 1)))
also (CoreCode.xml)
(map (sysGetStargates) '(excludeNil reduceMin original) gateID (sysGetTopologyDistance (sysGetStargateDestinationNode gateID) nodeID))
CommonwealthMilitia.xml
Select a value using '@' ('item' is the same as '@' but is deprecated).

Code: Select all

(item '(Alpha Beta Gamma Delta Epsilon) count)
also (CoreExplosions.xml)
(@ '(0 40 60 90 120 165) explosionSize)
Neurohack.xml
Create a decimal format color.

Code: Select all

(cnvDrawRect 0 60 528 80 '(74 71 95))
PointJuno.xml
Create a list to select values from.

Code: Select all

(setq codes '(anvil boson cloud dour enigma fallen.........
RPGDockscreens.xml
To set multiple special options with 'scrSetActionLabel'.

Code: Select all

(scrSetActionLabel gScreen 'actionDone Nil Nil '(default cancel))
More complex examples.

Pteravores.xml
Use as an objSource value in 'objDamage'.

Code: Select all

(objDamage gSource &vtPteravoreBite; '("pteravores" 0x40) (objGetOverlayPos gSource aOverlayID))
SistersOfDomina.xml
As a list for 'enum'.

Code: Select all

(enum '(att rel desc) var
	(errBlock (err)
		(if (eq (typeOf (eval var)) 'list) (set var (eval (eval var))))
		(printTo 'log (cat "Domina donation error: " err))
		)
	)

HSCompatibility.xml
Create a list of lists.

Code: Select all

(intSetCompatibleFuelEx '((&itPteracniumFuelRod; 88) (&itXenotiteFuelRod; 88) (&itHeliumAssembly; 88)))
Dall01.xml
Set data values in a 'data id'. Note use of code inside '().

Code: Select all

<StaticData>
	<Data id="sisters.donation">
		;		attd	rel		text
		'(Nil	-1		200		(block Nil 
									(typSetData &itDallSphere; 'status 'donated)
									(typTranslate &itDallSphere; 'donationText)
									)
			)
	</Data>
</StaticData>

Post Reply