Using scripts with strings in Names

Freeform discussion about anything related to modding Transcendence.
Post Reply
User avatar
Mutos
Militia Lieutenant
Militia Lieutenant
Posts: 218
Joined: Thu Aug 14, 2008 3:31 am
Location: Near Paris, France
Contact:

I use in my first Docking Screen the following code :

Code: Select all

name="=(objGetName gSource)"
Could it be possible to include strings in the LISP code that gets evaluated ? For instance to make it "Parking orbit for <world name>".

I tried using the \ escape character to escape a " character, but to no avail. I also found no example of this in the source code.

So is it possible or not ? Or if not, is it possible to embed it into an <Initialize> script ?

Thanks for any hint ^-^
@+

Benoît 'Mutos' ROBIN
Hoshikaze 2250 Project
User avatar
Periculi
Fleet Officer
Fleet Officer
Posts: 1282
Joined: Sat Oct 13, 2007 7:48 pm
Location: Necroposting in a forum near you

name = "=(myCustomScreenNamer)"

....


<Globals>
(block nil

(setq myCustomScreenNamer (lambda nil

(block (name)
;return the name as a string from here

(setq name (random (list "A name" "B name" "C name")))

;any code that returns the name as a string is fine

)

))

)
</Globals>


That will allow you to place a dynamic generated name in the name = "", but it also seems like you want to use a ", for which you may want to try using a ' instead, perhaps.

If you are just trying to get it to add some text to (objGetName gSource), use:
(setq name (cat "Parking orbit for " (objGetName gSource)))
User avatar
Mutos
Militia Lieutenant
Militia Lieutenant
Posts: 218
Joined: Thu Aug 14, 2008 3:31 am
Location: Near Paris, France
Contact:

Hi Periculi,


Thanks for the answer, I should have thought about using a function... My LISP is 15-yrs-old so it come back slowly ^-^
@+

Benoît 'Mutos' ROBIN
Hoshikaze 2250 Project
Post Reply