goto

Category: Script
Since engine version: 4.6.5.0 CP (extended in 4.9.1.0 GWE)

Description

Sets the script counter for scenario scripts to the specified value. The script counter is responsible for calling the ScriptXXX functions in a scenario script. This does not apply to object scripts - those should be using TimerCall or ActMaps with StartCall/PhaseCall/EndCall.

Syntax

bool goto (int iCounter);

Parameter

iCounter:
New value for the script counter. The next scenario script function called will be ScriptXXX.

Remark

In older script versions goto() would also cause an immediate return(). This behaviour has changed with the #strict standard. Now you have to write your return() separately.

Example

#strict

protected func Initialize()
  {
  // Scriptcounter starten
  ScriptGo(1);
  // Fertig
  return(1);
  }

protected func Script100()
  {
  // Flints erzeugen
  CastObjects(FLNT,10,200, Random(LandscapeWidth()), 20);
  return(goto(90));
  }
A scenario script: a typical flint rain. Every 100 Frames 10 flints are created.
See also: ScriptCounter, ScriptGo
jwk, April 2002