🇨🇳
R2Northstar Wiki
Chinese
Chinese
  • 欢迎来到Northstar
  • 加入我们
  • 安装Northstar
    • 基础教程
    • 故障处理
  • Northstar用户手册
    • Mods(模组)
    • 服务器列表
    • 直连服务器
    • 游戏模式
    • 控制台指令
    • 启动参数
    • 在Linux上游玩
  • 常见问题解答
  • 使用 Northstar托管服务器
    • 前期准备
    • 托管私人比赛服务器
    • 托管独立的服务器端
      • 实践经验
      • 在Linux上托管服务器
    • 故障处理
    • 视频教程
  • 修改与开发教程
    • 开始修改
      • 基础修改
      • 教程
      • 参考列表
      • Squirrel(松鼠)脚本
        • 线程处理
        • 基础代码块
        • Respawn(重生)创建的函数
        • 表和数组
        • 回调函数
        • 游戏模式修改
          • 开始修改
        • 自定义设置
          • 关于mod.json文件
          • 关于本地化语言文件
          • 关于Mod(模组)文件
      • 设置语法高光
      • 本地化翻译
      • 收尾工作
    • 开发者
  • 其他
    • 特别感谢
由 GitBook 提供支持
在本页
  • What is Squirrel
  • File format
  • Squirrel as a typed language
  • Variable types
  1. 修改与开发教程
  2. 开始修改

Squirrel(松鼠)脚本

What is Squirrel

Squirrel is a programming language used in titanfall 2 and northstar mods, it is worth noting that the version of squirrel used by titanfall appears to be a modified version of the langauge

File format

All files using squirrel are saved as .nut or .gnut

when creating mods your mod will typically be a series of functions and callbacks

Squirrel as a typed language

All variables and functions in squirrel must have a type defined on declaration

function dosomething()

is not acceptable and should instead be

void function dosomething()

Similarly when declaring a variable

funnynumber = 69

will not work, instead use:

int funnynumber = 69

Variable types

void: can be used to define functions that do not return a value, but still do things. most of your functions will be void

interger: a whole number

float: a none-whole number.

string: text

entity: an entity and all its associated information

bool: true or false (Squirrel does not treat 1 as true or 0 as false)

array: an ordered list of items indexed from 0, increasing with the number of items such as: 0:"hello",1:1000,2:entity player ...

table: a list of items with indexes defined on object entry such as: "word":"hello", "kilo":1000", "pilot":entity player ...

struct: a series of attributes assigned to a structure and accessed through with structname.variablename

var: Var typically refers to variables that lack any stated type, this will cause issues with many functions unless you use the untyped identifier at the start of your file, or if you use expect type(variable) when passing the variable to that function

上一页参考列表下一页线程处理

最后更新于3年前