Is it POSSIBLE to save a screen description..

Freeform discussion about anything related to modding Transcendence.
Post Reply
shanejfilomena
Fleet Officer
Fleet Officer
Posts: 1533
Joined: Tue Mar 22, 2011 8:43 pm
Location: Alaska
Contact:

In other words, the obj chooses a random name or word to select as part of the desription, can the object save that choice and recall the screen description later?

mmmm ... because I have 342 of these objects and each one selects a different word for the description.....but saving that choice is a challenge I have yet to win.

*such as :
(cat " (random '( ......

****now save that choice so I can pull it up later and read it...

Image
Flying Irresponsibly In Eridani......

I don't like to kill pirates in cold blood ..I do it.. but I don't like it..
TVR
Militia Commander
Militia Commander
Posts: 334
Joined: Sat Sep 08, 2012 3:26 am

Code: Select all

<OnPaneInit>
	(block (desc name listOfRandomNames)
		(setq listOfRandomNames '(name1 name2 name3))

		;; If obj already has name
		(if (objGetData gSource "savedName")
			;; Then set savedName as name
			(setq name (objGetData gSource "savedName"))

			;; Else pick name from listOfRandomNames and save it
			(block Nil
				(setq name (random listOfRandomNames))
				(objSetData gSource "savedName" name)
			)
		)

		;; Concatenate text with name
		(setq desc (cat "Hello, " name "! How do you do?"))

		;; Set text as pane description
		(scrSetDesc gScreen desc)
	)
</OnPaneInit>
Fiction is reality, simplified for mass consumption.
PGP: 0x940707ED, 5DB8 4CB4 1EF5 E987 18A0 CD99 3554 3C13 9407 07ED
Bitcoin: 1LLDr7pnZDjXVT5mMDrkqRKkAPByPCQiXQ
shanejfilomena
Fleet Officer
Fleet Officer
Posts: 1533
Joined: Tue Mar 22, 2011 8:43 pm
Location: Alaska
Contact:

THANX :)
I will try it with my items.
****************************
WORKS!!!!!!!..........except for ONE TINY thing.......( but still does exactly what is expected of it within it's limits )

I think I might need to assume the player having more then one Item in the ship ( of course they stack
( so it shows a quantity, like fuel rods ) )
so if you use the dockscreen you only get the random destination name for THAT one ( the on top of the stack )

BUT THAT IS FINE.....that was good......

however, if I drop all my items, pull out 2 and seperate them in cargo boxes each of them pull up the same saved name ( I UNDERSTAND that they are " the same item " ) but is there a way to differentiate them ?

I was thinking of using # like on the stations ( pod A%00 )..... but I needed an opinion on that before I went ahead.. Because usually when I ThINK - it's usually not right......My last code idea for this item was crashing the game :)

OR should I go with "enum" to check if there is more then one of the same item ?
Flying Irresponsibly In Eridani......

I don't like to kill pirates in cold blood ..I do it.. but I don't like it..
TVR
Militia Commander
Militia Commander
Posts: 334
Joined: Sat Sep 08, 2012 3:26 am

Code: Select all

<ItemType>

<StaticData>
	<listOfRandomNames>
		(list
			"name1"
			"name2"
			"name3"
		)
	</listOfRandomNames>
</StaticData>

<Events> 
	<GetName>
		;; GetName and OnUpdate have identical code
		(block (name)
			;; If item already has name
			(if (itmGetData gItem "savedName")
				;; Then set savedName as name
				(setq name (itmGetData gItem "savedName"))
				
				;; Else pick name from listOfRandomNames and save it
				(block Nil
					(setq name (random (itmGetStaticData gItem "listOfRandomNames")))
					(objSetItemData gSource gItem "savedName" name 1)
				)
			)
			
			;; Return name
			(list (cat "[unit of]" name) 0x02)
		)
	</GetName>
	
	<OnUpdate>
		;; GetName and OnUpdate have identical code
		(block (name)
			;; If item already has name
			(if (itmGetData gItem "savedName")
				;; Then set savedName as name
				(setq name (itmGetData gItem "savedName"))
				
				;; Else pick name from listOfRandomNames and save it
				(block Nil
					(setq name (random (itmGetStaticData gItem "listOfRandomNames")))
					(objSetItemData gSource gItem "savedName" name 1)
				)
			)
			
			;; Return name
			(list (cat "[unit of]" name) 0x02)
		)
	</OnUpdate>
</Events>

</ItemType>
Fiction is reality, simplified for mass consumption.
PGP: 0x940707ED, 5DB8 4CB4 1EF5 E987 18A0 CD99 3554 3C13 9407 07ED
Bitcoin: 1LLDr7pnZDjXVT5mMDrkqRKkAPByPCQiXQ
shanejfilomena
Fleet Officer
Fleet Officer
Posts: 1533
Joined: Tue Mar 22, 2011 8:43 pm
Location: Alaska
Contact:

items differentiating themselves as individuals is the problem......the code works fine..it addressed my original question.

BUT ( there always seems to be one of those ) .. the next item thinks it is the first and calls up the same data.

.........
I am going to go break something...I mean try another code :)

I have tried using charges, as welll as the ammobox open ...but the item still refuses to think of itself as an individual.
Flying Irresponsibly In Eridani......

I don't like to kill pirates in cold blood ..I do it.. but I don't like it..
TVR
Militia Commander
Militia Commander
Posts: 334
Joined: Sat Sep 08, 2012 3:26 am

The second snippet of code, when placed on an itemtype, automatically destacks an itemStruct into separate items with different names.

For example, if that code is added to a slave coffin, if you were to spawn 20 slave coffins, they would automatically turn into 20 separate slave coffins with 20 different names, even though they all share the same UNID. This is the same method that is used to create multiple stacks of fresh fruit.
Fiction is reality, simplified for mass consumption.
PGP: 0x940707ED, 5DB8 4CB4 1EF5 E987 18A0 CD99 3554 3C13 9407 07ED
Bitcoin: 1LLDr7pnZDjXVT5mMDrkqRKkAPByPCQiXQ
shanejfilomena
Fleet Officer
Fleet Officer
Posts: 1533
Joined: Tue Mar 22, 2011 8:43 pm
Location: Alaska
Contact:

Yes.....Thankyou : I was doing multiple things at the same time : and the " same" items were copied to my ship (so I had some instead of having to search for them) ....

So in the end my own ship was messing me up because I did not copy YOUR codes to the items on my ship ( and my ship's items were taking over anything else ingame - even if I found the item - the code in my ship's .xml would rule over the item :()


I never knew that could happen....

I will go back to those items : right now I am playing very evil things with the PlayerShip - it was an old idea that if you did not see a hostile coming, and you dock : you can get killed .... I KNOW the new warning system can help prevent that, But IF the Player is playing without the sound ( like in a public place ) it might still be a relevant idea to put into the .xml
Flying Irresponsibly In Eridani......

I don't like to kill pirates in cold blood ..I do it.. but I don't like it..
Post Reply