Difference between revisions of "Let"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>Rirein
(Created page with "A command for Oblivion Script Extender. '''Syntax:''' (nothing) Let expr := expr The Let statement is OBSE's version of Oblivion's ...")
 
Line 16: Line 16:
  let arr[(num + player.GetPos Z) / player.GetPos X] := player.GetDistance someRef ^ 2
  let arr[(num + player.GetPos Z) / player.GetPos X] := player.GetDistance someRef ^ 2


 
i
==See Also==
==See Also==
*[[TestExpr]]
*[[TestExpr]]

Revision as of 13:15, 21 December 2023

A command for Oblivion Script Extender.

Syntax:

(nothing) Let expr := expr

The Let statement is OBSE's version of Oblivion's Set statement. It takes the form let expr1 := expr2 where expr1 evaluates to something which can hold a value, such as a variable or array element, and expr2 is an expression of a type which can be stored in expr1. Values within expressions can include arithmetic expressions, function calls, etc. The assignment operator checks the types of its operands, so it will allow assigning a number to a short variable but not to a string_var.

Examples

string_var str
array_var arr
short num
let str := "a string"
let str := str[0:num] + player.GetName + " some more text"
let arr := ar_Construct Map
let arr[(num + player.GetPos Z) / player.GetPos X] := player.GetDistance someRef ^ 2

i

See Also