backIndex

Xelagot action script

Projects

See Surveying, building... and the lists for general information.

Projects are collections of objects. Each bot has the possibility of having one such collection. The script has statements which allow to manipulate this collection. Projects and building activities are associated with a number of other collections, like the survey collection (used when querying property), the Result (Res) collection (used when looking for objects), the success and failures lists and, in 3.1 worlds, the Cell buffer.

The following operations apply to Projects.

Variables shown in black may be substituted by literal values, variables shown in red are assigned the result of the operation, variables in green may not be substituted by their literal equivalents.

ProjectCount %a Counts the number of objects in the project, and stores that number in %c
ProjectBounds %n %s %w %e %h %l %c
ProjectBounds @a @b %c
stores the N, S, W, E, High and Low boundaries of the project (in meters) in variables %n %s %w %e %h %l, or as two location variables @a and @b which represent the oposite vertices of the project region (@a the NW High corner, @b the SE Low corner). Variable %c stores the number of objects in the project.
ProjectClear Clears the project collection, removing all objects from memory.
ProjectLoad $f [%r] loads a project from file specified in $f. Optionally %r will contain 0 if the operation succeeds, -1 if it fails.

xelagot 3.607 or newer
The filename convention is explained in the section Filenames.

xelagot 3.606 or older
The path defaults to the path of the current script file. A full drive + path may also be specified, see Program paths.
ProjectMerge $f [%r] merges a project from file specified in $f. Optionally %r will contain 0 if the operation succeeds, -1 if it fails.

xelagot 3.607 or newer
The filename convention is explained in the section Filenames.

xelagot 3.606 or older
The path defaults to the path of the current script file. A full drive + path may also be specified, see Program paths.
ProjectSave $f [%r] saves a project to file specified in $f. Optionally %r will contain 0 if the operation succeeds, -1 if it fails.

xelagot 3.607 or newer
The filename convention is explained in the section Filenames. If the destination path and folder does not exist, it will be created to accommodate the file.

xelagot 3.606 or older
The path defaults to the path of the current script file. A full drive + path may also be specified, see Program paths.
version 3.07

ProjectSavePropdump $f [%r]
saves a project to file specified in $f in propdump format. Optionally %r will contain 0 if the operation succeeds, -1 if it fails.

xelagot 3.607 or newer
The filename convention is explained in the section Filenames. If the destination path and folder does not exist, it will be created to accommodate the file.

xelagot 3.606 or older
The path defaults to the path of the current script file. A full drive + path may also be specified, see Program paths.
ProjectFromSurvey loads a project from the Survey buffer. Requires a previous Query to have been completed (see Event Query Complete)
ProjectFromSurveyFilter loads objects into the Project buffer from the Survey buffer, applying a Filter. Requires a previous Query to have been completed (see Event Query Complete)
ResFromProjectFilter loads objects into the Res collection from the Project buffer, applying a Filter. See also Filters and searching for objects, the Res buffer
ProjectFromRes
ProjectFromResFilter
Copies the objects in the Res buffer and adds them to the Project buffer. ProjectFromResFilter applies a filter. Does not clear the buffers. See also Filters and searching for objects, the Res buffer
ProjectFromListAS
ProjectFromListAF
ProjectFromListAU
ProjectFromListDS
ProjectFromListDF
ProjectFromListDU
ProjectFromListTD
Copies the objects in the corresponding list to the Project buffer.
  • AS is AddSuccess
  • AF is AddFailed
  • AU is AddUnconfirmed
  • DS is DeleteSuccess
  • DF is DeleteFailed
  • DU is DeleteUnconfirmed
  • TD is ToDo
ProjectBackup @a @b %r Rudimentary backup facility for a world area. @a and @b have the coordinates of 2 oposite corners of a NSWE oriented rectangular area, %r receives the number of zones that will be queried. This statement deletes the world cache files for the area required (so it does not matter if UseCache is turned on or off), queries the server and adds to the project buffer the contents of the whole rectangle. You must manually save the project or use ProjectSave. Not meant for huge areas - tested on a 500 by 500 sq.m. world, worked ok. See the bottom of the page for a full script using this facility. Triggers events QueryBegin and QueryComplete (multiple times, that's where %r plays a role, see script).
ProjectAdd ~a [%r] Adds object ~a to the project. Optional %r will contain 0 if the operation succeds, -1 if it fails. Please note: new objects, created in the script, must have their object number put to zero with GetObjectNumber ~a 0 for ProjectAdd to work properly.
ProjectDelete ~a [%r] deletes object ~a from the project. Optional %r will contain 0 if the operation succeds, -1 if it fails.
ProjectMove @a
ProjectMove &a
ProjectMove ~a
Moves the Project origin (if defined) to the position specified by @, &a or ~a. Rotates the project by an angle equal to the yaw of the variable minus the yaw of the origin. If no origin has been defined, functions as ProjectMoveMidBot.
ProjectMoveMid @a
ProjectMoveMid &a
ProjectMoveMid ~a
Moves the centre of the project to the position specified by @, &a or ~a. Rotates the project to the yaw of the variable (no rotation if it faces north). Does not alter the altitude.
ProjectMoveMidTop @a
ProjectMoveMidTop &a
ProjectMoveMidTop ~a
Moves the centre top of the project to the position specified by @, &a or ~a. Rotates the project to the yaw of the variable (no rotation if it faces north). Alters the altitude.
ProjectMoveMidCen @a
ProjectMoveMidCen &a
ProjectMoveMidCen ~a
Moves the centre of the project to the position specified by @, &a or ~a. Rotates the project to the yaw of the variable (no rotation if it faces north). Alters the altitude.
ProjectMoveMidBot @a
ProjectMoveMidBot &a
ProjectMoveMidBot ~a
Moves the centre bottom of the project to the position specified by @, &a or ~a. Rotates the project to the yaw of the variable (no rotation if it faces north). Alters the altitude.
ProjectSetTempo %t sets the build and destroy tempo. 1 means sent one object per second to the server, 25 is the highest.
ProjectBuild [%r] Starts sending data to the world server to build the objects specified in the project, as belonging to the citizen number of the bot. Optional %r will contain 0 if the operation started successfully, -1 if it failed to start. A failure message will usually mean another project is still being built or destroyed. Triggers event ProjectComplete on completion.
ProjectBuildED [%r] Starts sending data to the world server to build the objects specified in the project, as belonging to the citizen numbers specified in the project. Requires Eminent Domain and that all citizen numbers in the project have build right. Optional %r will contain 0 if the operation started successfully, -1 if it failed to start. A failure message will usually mean another project is still being built or destroyed. Triggers event ProjectComplete on completion.
ProjectDestroy [%r] Starts sending data to the world server to destroy the objects specified in the project if they have the citizen number of the bot. Requires that the objects exist in the world server and that the bot has build right. Optional %r will contain 0 if the operation started successfully, -1 if it failed to start. A failure message will usually mean another project is still being built or destroyed. Triggers event ProjectComplete on completion.
ProjectDestroyED [%r] Starts sending data to the world server to destroy the objects specified in the project. Requires that the objects exist in the world server and that the bot has Eminent Domain. Optional %r will contain 0 if the operation started successfully, -1 if it failed to start. A failure message will usually mean another project is still being built or destroyed. Triggers event ProjectComplete on completion.

3.1 worlds (world server 28 or higher)

ProjectFromCell
ProjectFromCellFilter
loads objects into the Project collection from the Cell buffer. ProjectFromCellFilter applies a filter.

Example of a complete script for backing up a 500x500 sq.m. world. Start this script when the bot is in the world you wish to back up.

[Head]
Type=Script
Version=2.0

[Settings]
Origin=0.000n 0.000w 0.00a 0.0°

[Script]
   # survey and backup a 500x500 sq.m. world (25n to 25s etc)
   OnQueryBeginEvent QB
   OnQueryCompleteEvent QC
   %i = 1
   @a = "25n 25w"
   @b = "25s 25e"
   ProjectClear
   ProjectBackup @a @b %r
   Label Loop
   IfInt %i <= %r Goto Loop
End

Event QB
   # only the first query triggers this event
   Concat $a "Surveying zone " %i " of " %r
   Say $a
EndEvent

Event QC
   inc %i
   IfInt %i > %r Goto QC1
   Concat $a "Surveying zone " %i " of " %r
   Say $a
   EndEvent
   
   Label QC1
   Concat $a "Survey of " %r
   Concat $a $a " zones completed. "
   Concat $a $a "Please save your project with the Survey Manager"
   Say $a
   OnQueryBeginEvent
   OnQueryCompleteEvent
EndEvent



backIndex