Code | Explanation |
inst | |
new: comp 1 1 1234 "smalltextbox" 1 0 9000 | Create a compound object with a classifier of 1 1 1234. It will use 1 image from 'smalltextbox' starting at frame 0. Image plane is 9000 |
attr 38 | give it attributes |
pat: fixd 1 "smalltextbox" 1 10 5 0 "blackonwhitechars" | Create part 1 - a fixed text part. It uses frame 1 in the 'smalltextbox' file, with an offset of (10,5) from part 0. Relative plane is 0. The font to use is called 'blackonwhitechars'. |
part 1 | change to part 1 ... |
ptxt "test" | ... and make it display this text string "test" |
flto 300 100 | Float the object to (300,100) |
************************** | |
scrp 1 1 1234 4 | The pickup script for this agent |
part 1 | Make the text part display "pickup" |
ptxt "pickup" | |
endm | |
************************** | |
scrp 1 1 1234 5 | The drop script for this agent |
part 1 | Make the text part display "drop" |
ptxt "drop" | |
endm | |
************************** | |
scrp 1 1 1234 1 | The activate script for this agent |
part 1 | Make the text part display "press" |
ptxt "press" | |
endm |
Download the COS file at the bottom of this article.
This creates a small box on screen with the word 'test' written on it.
Picking up, dropping or clicking on the box will all alter the text within the box.
A common problem with creating a fixed text part is making the part too small to display the text needed ... especially with the default FRMT.
FRMT allows you to change the appearance of text parts by altering the justification of text and the spacing of borders. If no text is being displayed and you think there should be try making the borders as small as possible and see if that helps. If not then you need to enlarge the text part.