Resource:Editor/Plugins

From Multi Theft Auto: Wiki
Revision as of 02:00, 8 March 2009 by Talidan (talk | contribs) (New page: == Introduction == The editor allows basic importing of elements from external resources. Normally creating elements outside the editor makes them unseeable or unmanipulatable. By impor...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Introduction

The editor allows basic importing of elements from external resources. Normally creating elements outside the editor makes them unseeable or unmanipulatable. By importing these elements, the editor is made to be compatible and is able to manipulate them, and save them into its map resource. In practice, this allows basic development of plugins, or allowing manual compatibility to external resources.

Commands

An "import" command is exported in order to allow users to import the elements of a specified resource:

import <resourceName>
  • resourceName: The name of the resource you wish to import from.


The elements from the resource will then be imported. A practical use is for the importing of custom models. While the editor is unable to load custom models itself, by importing models from a resource which can, a custom map can be created. For example, the following steps could be performed in order order to modify custom map sth-aztec

  • Start the editor
  • Start (Not Open) sth-aztec manually. This will start the map and load the custom models.
  • Type "import sth-aztec" and the objects will be imported into the editor
  • The map will now be loaded

Functions

The "editor" resource also exports an import function. This replicates the command, but also allows importing elements. Essentially this allows resources to import themselves forming simple plugins.

bool import ( element rootElement/resource resourceToImportTo )
  • rootElement: The root element of which you wish to report (The root itself and all children will be imported)

<

OR:

  • resourceToImportTo: The resource pointer of which you wish to import.

Example plugins

An example use for this is the loop generator plugin, adapted from Offroader23's work on offedit. This resource adds a "mloop" command which can be used to create perfect loops out of standard objects. After perfoming this, it uses the exported import function and allows the editor to manipulate them.