modding:guide:usable_objects
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| modding:guide:usable_objects [2012/03/17 01:18] – external edit 127.0.0.1 | modding:guide:usable_objects [2014/12/27 04:40] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | Discuss this page on this page's [[Usable objects Talk Page|Talk Page]]. | ||
| + | ==== Creating Usable Objects for Total n00bs ==== | ||
| + | |||
| + | This exercise has been brought to you by [[community: | ||
| + | |||
| + | ==== Step One: Decide what to do ==== | ||
| + | |||
| + | It's probably not a good idea to go overboard here. So what you need is something that you're sure will be ' | ||
| + | |||
| + | ==== Step Two: Create a file ==== | ||
| + | |||
| + | We'll go with the obvious JanesROM.xml and create a blank .xml file with the standard start/end bits. | ||
| + | |||
| + | <code xml> | ||
| + | <?xml version=" | ||
| + | < | ||
| + | [ | ||
| + | < | ||
| + | < | ||
| + | ]> | ||
| + | < | ||
| + | |||
| + | < | ||
| + | |||
| + | </ | ||
| + | </ | ||
| + | |||
| + | If you read the last tutorial then the only really new thing here is the ' | ||
| + | |||
| + | ==== Step Three: Add item details ==== | ||
| + | |||
| + | Looking at the [[http:// | ||
| + | |||
| + | In the traditional way (since when?) I'm also including code so that typing (romME) in the debug console will produce a copy to test. | ||
| + | |||
| + | <code xml> | ||
| + | < | ||
| + | name= " | ||
| + | level= " | ||
| + | value= " | ||
| + | mass= " | ||
| + | frequency= " | ||
| + | modifiers= " | ||
| + | description= | ||
| + | "This is a trial offer ROM which will run only once, after which its database is wiped. It can identify one object or device (that is not alien or illegal)." | ||
| + | > | ||
| + | |||
| + | <Image imageID="& | ||
| + | |||
| + | < | ||
| + | |||
| + | ;... stuff goes here ... | ||
| + | |||
| + | </ | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | (setq romME (lambda Nil | ||
| + | (objAddItem gPlayerShip (itmCreate & | ||
| + | )) | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | So far so good, but it doesn' | ||
| + | |||
| + | <code xml> | ||
| + | name= " | ||
| + | level= " | ||
| + | value= " | ||
| + | mass= " | ||
| + | frequency= " | ||
| + | unknownType= "& | ||
| + | modifiers= " | ||
| + | description= | ||
| + | "This is a trial offer ROM which will run only once, after which its database is wiped. It can identify one object or device (that is not alien or illegal)." | ||
| + | > | ||
| + | |||
| + | <Image imageID="& | ||
| + | |||
| + | < | ||
| + | (block Nil | ||
| + | |||
| + | ; Identify the item | ||
| + | (itmSetKnown gItem) | ||
| + | |||
| + | ; Remove ROM | ||
| + | (objRemoveItem gSource gItem 1) | ||
| + | ) | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | (setq romME (lambda Nil | ||
| + | (objAddItem gPlayerShip (itmCreate & | ||
| + | )) | ||
| + | </ | ||
| + | |||
| + | So, what have we got now? It's an unknown ROM when first encountered, | ||
| + | |||
| + | ==== Step four: Make it do stuff ==== | ||
| + | |||
| + | When it is used (invoked) we want it to | ||
| + | * Display all items on your ship (installed, or uninstalled) and prompt you to select one. | ||
| + | * Either identify the item selected, or (if it alien or illegal) give an error message. | ||
| + | |||
| + | === Display list and select an item === | ||
| + | |||
| + | I had a look around and there are other usable items that do this, like [[http:// | ||
| + | |||
| + | < | ||
| + | A new attribute needed in the ItemType element. | ||
| + | |||
| + | <code xml> | ||
| + | An extra UNID for the DockScreen. | ||
| + | |||
| + | And here's the one from AlmightyWrench (with a whole bunch o' | ||
| + | |||
| + | <code xml> | ||
| + | < | ||
| + | name= " | ||
| + | type= " | ||
| + | backgroundID= | ||
| + | > | ||
| + | |||
| + | < | ||
| + | dataFrom= " | ||
| + | list= " | ||
| + | /> | ||
| + | |||
| + | < | ||
| + | <Default | ||
| + | desc= "What item do you wish to repair?"> | ||
| + | |||
| + | < | ||
| + | |||
| + | ;... skip bits ... | ||
| + | |||
| + | </ | ||
| + | |||
| + | < | ||
| + | <Action name=" | ||
| + | |||
| + | ;... skip bits ... | ||
| + | |||
| + | </ | ||
| + | <Action name=" | ||
| + | < | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | At this point: Whoops! We don't need the < | ||
| + | |||
| + | Right, onwards and upwards. | ||
| + | |||
| + | <code xml><? | ||
| + | < | ||
| + | [ | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | ]> | ||
| + | < | ||
| + | |||
| + | < | ||
| + | |||
| + | < | ||
| + | name= " | ||
| + | level= " | ||
| + | value= " | ||
| + | mass= " | ||
| + | frequency= " | ||
| + | unknownType= "& | ||
| + | modifiers= " | ||
| + | useScreen= "& | ||
| + | description= | ||
| + | "This is a trial offer ROM which will run only once, after which its database is wiped. It can identify one object or device (that is not alien or illegal)." | ||
| + | > | ||
| + | <Image imageID="& | ||
| + | |||
| + | </ | ||
| + | |||
| + | <!-- The dockscreen for the ROM user interface: --> | ||
| + | < | ||
| + | name= " | ||
| + | type= " | ||
| + | backgroundID= | ||
| + | > | ||
| + | |||
| + | < | ||
| + | dataFrom= " | ||
| + | list= " | ||
| + | /> | ||
| + | |||
| + | < | ||
| + | <Default | ||
| + | desc= "What item do you wish to identify?"> | ||
| + | |||
| + | < | ||
| + | <Action name=" | ||
| + | (block Nil | ||
| + | |||
| + | ;... stuff goes here ... | ||
| + | |||
| + | ; Identify the Jane's ROM we have just used. | ||
| + | (itmSetKnown gItem) | ||
| + | |||
| + | ; Remove Jane's ROM | ||
| + | (objRemoveItem gSource gItem 1) | ||
| + | ) | ||
| + | </ | ||
| + | <Action name=" | ||
| + | < | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | < | ||
| + | (setq romME (lambda Nil | ||
| + | (objAddItem gPlayerShip (itmCreate & | ||
| + | )) | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | === (Finally) Identify item === | ||
| + | |||
| + | OK, we're nearly there. | ||
