Wildcards and functions to manipulate strings?

Freeform discussion about anything related to modding Transcendence.
Post Reply
gunship256
Militia Commander
Militia Commander
Posts: 451
Joined: Sat Jul 25, 2015 11:41 pm
Location: repairing armor

I've been playing with (typGetXML) (really cool, by the way).

Since XML isn't case-sensitive, I've been having trouble using (find) with the resulting string that contains the XML code.

For example, in trying to determine whether an item marked as a missile actually contains the <Missile> element, which determines whether it can be fired by a launcher without adding additional code to the missile, I've been using (find missileXML "issile>") to search for the end tag. While this method handles </Missile> and </missile> correctly, it won't handle </MISSILE>, </mIsSle>, or other variants correctly.

Is there a function that will capitalize all the letters in a string but leave the rest of the characters alone? Alternatively, is there support for wildcard searches using Transcendence lisp?

Thanks if anyone can help!

Code: Select all

						(setq missileCode "")
						(setq missileNames "")
						(enum (itmGetTypes "m") missileUNID 
							(block Nil
								(setq missileCode (cat missileCode "<Missile ammoID=\"" missileUNID "\" />"))
								(setq missileXML (typGetXML missileUNID))
								(if (find missileXML "issile>")
									(setq isMissile "Ready to fire")
									(setq isMissile "NOT ready to fire")
									)
								(setq missileNames 
									(cat 
										missileNames 
										" " 
										(itmGetName (itmCreate missileUNID 1) 0) 
										isMissile
										)
									)
								)
							)
george moromisato
Developer
Developer
Posts: 2997
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

I can't quite reproduce the problems. (find...) is case-insensitive, so it should find strings regardless of case.
Post Reply