Definition
A C-style, strongly-typed scripting language used in League. LSC stands for League Script, for lack of a better name. LSC is based on C# and resembles the language, but is heavily modified.

Functions
LSC defines functions in the global namespace, as it is not OO and has no concept of namespaces. Functions do not have accessability modifiers like methods do in C#.

Example:
// Kills all units in a given region
void ClearRegion(Region r) {
    foreach (Unit u in r.Contained)
        u.Die();
}


Hooking Events
LSC can hook functions to Events in League by use of the on keyword. The function is then automatically run when the event occurs.

Example:
// Make the current player omniscient
on MapInit: void Foo() {
    Player.CurrentPlayer.DisableBlackMask();
}


Specific Events
Specific events are events which may occur differently but would be too numerous to have their own events. Specific events are defined as followed:

Example:
// Called when the `amke` ability code is invoked
on AbilityCast("amke"): bool Ability_Cast_amke(Ability ability, Unit caster, object target) {
    UnitType.CreateUnit(ability.Data[0], (Vector2)target, caster.Owner);
}


List of Events
The following events exist in League and may be hooked. They are defined as:
[Sync] Event[(specifics)]: Signature [// note about return]
Sync indicates that this event is run synchronously and thus may not use the waiting functions as it will lag the entire engine.
  • MapInit: void()
  • TimeElapsed(float seconds): void()
  • Periodic(float seconds): void()
  • UnitCreated: void(Unit created)
  • UnitDied: void(Unit died)
  • RegionEntered(string region): void(Unit enterer)
  • RegionLeft(string region): void(Unit leaver)
  • Sync AbilityCast(string uaid): bool(Ability ability, Unit caster, object target) // successful?
  • Sync AbilitySmart(string uaid): bool(Ability ability, Unit caster, object target) // is target handled?
  • Update: void(GameTime gameTime) // run every game update
  • Sync ParticleSystem(string vid): void(ParticleSettings settings) // creates particle systems for particle emitters

Last edited Dec 21, 2007 at 5:56 PM by Paamayim, version 3

Comments

No comments yet.