Psych Engine Logo
Psych Engine - Lua Script API

变量


这些变量都可以在 Lua 中直接访问,不要使用 "getProperty"获取,不然你什么也获取不到,但是更改它们不会对其他脚本或游戏本身产生直接影响。

因为各个版本的变量可能不互通,所以我会特别注明。


Lua 脚本变量

  • luaDebugMode - 切换为显示错误, 默认为false。
  • 版本: [1.0.0],[0.7.3]


  • luaDeprecatedWarnings - 显示错误函数应该替换成的新函数, 但是 luaDebugMode 必须为true。 默认为true。
  • 版本: [1.0.0],[0.7.3]



  • scriptName - 正在运行的 Lua 脚本所在的路径。
  • 版本: [1.0.0],[0.7.3]


  • modFolder - Lua脚本正在运行的Mod文件路径。
  • 版本: [1.0.0]


  • currentModDirectory - 正在游玩自定义周的 Mod 文件夹,原版游戏周为空。
  • 版本: [1.0.0],[0.7.3]


    Psych Engine信息变量

  • version - Psych Engine的版本号。
  • 版本: [1.0.0],[0.7.3]


  • buildTarget - Psych的运行环境,可以是: "windows", "windows_x86" 或 "linux"。
  • 版本: [1.0.0],[0.7.3]


    函数返回变量

  • Function_StopLua - 仅在下一个 Lua 脚本中停止调用该函数。
  • 版本: [1.0.0],[0.7.3]


  • Function_StopHScript - 仅在下一个 HScripts 中停止调用该函数。
  • 版本: [1.0.0],[0.7.3]


  • Function_StopAll - 停止在下一个 Lua 脚本和 HScript 中调用该函数。
  • 版本: [1.0.0],[0.7.3]


  • Function_Stop - 取消比如startCountdown或endSong之类的功能,主要用于过场动画。
  • 版本: [1.0.0],[0.7.3]


  • Function_Continue - 一旦脚本运行,就像平常一样继续。
  • 版本: [1.0.0],[0.7.3]


    flixel.FlxG 变量

  • screenWidth - FlxG.width,屏幕宽度。
  • 版本: [1.0.0],[0.7.3]


  • screenHeight - FlxG.height,屏幕高度。
  • 版本: [1.0.0],[0.7.3]


    歌曲变量

  • songName - 当前歌曲名字。
  • 版本: [1.0.0],[0.7.3]


  • songPath - songName的格式化版本, 所以字母都是小写,用“-”代替空格。
  • 版本: [1.0.0],[0.7.3]


  • loadedSongName - 歌曲在Freeplay/Story Menu的名字。
  • 版本: [1.0.0]


  • loadedSongPath - loadedSongName的格式化版本, 所以字母都是小写,用“-”代替空格。
  • 版本: [1.0.0]



  • bpm - 歌曲的BPM。
  • 版本: [1.0.0],[0.7.3]


  • songLength - 歌曲时长(以毫秒为单位)。
  • 版本: [1.0.0],[0.7.3]


  • startedCountdown - 如果倒计时已经开始,他就为false。
  • 版本: [1.0.0],[0.7.3]


  • seenCutscene - 在歌曲中第一次尝试时为 False,当您重新启动歌曲或被拒绝时设置为 True,用于检测过场动画是否已经看过。
  • 版本: [1.0.0],[0.7.3]


  • inGameOver - 用于确认你是否已经死亡。
  • 版本: [1.0.0],[0.7.3]


    铺子变量

  • chartPath - 铺子的目录,包括文件扩展名。
  • 版本: [1.0.0]


  • curStage - 铺子编辑器中显示的歌曲背景名称。
  • 版本: [1.0.0],[0.7.3]


  • scrollSpeed - 起始的箭头滚动速度。
  • 版本: [1.0.0],[0.7.3]


  • hasVocals - 歌曲是否启用人声。
  • 版本: [1.0.0],[0.7.3]


    难度变量

  • difficulty - 难度ID。
  • 版本: [1.0.0],[0.7.3]


  • difficultyName - 难度名称。
  • 版本: [1.0.0],[0.7.3]


  • difficultyPath - 将难度名称转化为小写并以连符开头,普通难度时为空。
  • 版本: [1.0.0],[0.7.3]


  • difficultyNameTranslation - 翻译的难度名称。
  • 版本: [1.0.0]


    Story Mode/Week 变量

  • isStoryMode -是否是从story mode开始的歌曲。
  • 版本: [1.0.0],[0.7.3]


  • weekRaw - Week的ID.
  • 版本: [1.0.0],[0.7.3]


  • week - 当前Week在weeks/的名称。
  • 版本: [1.0.0],[0.7.3]


    Section Variables

  • curBpm - 当前BPM。
  • 版本: [1.0.0],[0.7.3]


  • curSection - Section的ID.
  • 版本: [1.0.0],[0.7.3]


  • curBeat -当前的beat ID.
  • 版本: [1.0.0],[0.7.3]


  • curStep - 当前的Step ID.
  • 版本: [1.0.0],[0.7.3]


  • curDecBeat - beat ID,但是这会显示距离下一个beat的时长。
  • 版本: [1.0.0],[0.7.3]


  • curDecStep - Step ID,但是这会显示距离下一个Step的时长。
  • 版本: [1.0.0],[0.7.3]


  • crochet - Beat 在当前段落中花费的时间(以毫秒为单位)。
  • 版本: [1.0.0],[0.7.3]


  • stepCrochet - Step 在当前段落中花费的时间(以毫秒为单位)。
  • 版本: [1.0.0],[0.7.3]



  • mustHitSection - 当前部分是否针对玩家的。
  • 版本: [1.0.0],[0.7.3]


  • altAnim - 当前部分启用了 Alt Animation。
  • 版本: [1.0.0],[0.7.3]


  • gfSection - 当前部分是否针对gf的。
  • 版本: [1.0.0],[0.7.3]


    Score Variables

  • score - 当前分数。
  • 版本: [1.0.0],[0.7.3]


  • misses - 当前错过的箭头数。
  • 版本: [1.0.0],[0.7.3]


  • hits - 当前已经击打的箭头数。
  • 版本: [1.0.0],[0.7.3]


  • combo - 当前的连击数。
  • 版本: [1.0.0],[0.7.3]


  • deaths - 到目前为止你死了多少次。
  • 版本: [1.0.0]



  • rating - 准确率,从0~1。
  • 版本: [1.0.0],[0.7.3]


  • ratingName - "?", "Sick!", "Good", 等其他的。
  • 版本: [1.0.0],[0.7.3]


  • ratingFC - 可能是: "Clear", "SDBC", "FC", "GFC", "SFC".
  • 版本: [1.0.0],[0.7.3]


  • totalPlayed - 错过的 + 已经打击的, 用于计算准确率。
  • 版本: [1.0.0]


  • totalNotesHit - 用于评分计算的命中率的累积分数,"Sick" = +1, "Good" = +0.67, "Bad" = +0.34, "Shit" = 0.
  • 版本: [1.0.0]


    Gameplay 变量修饰符

  • playbackRate - 默认为 1
  • 版本: [1.0.0],[0.7.3]


  • healthGainMult - 默认为 1
  • 版本: [1.0.0],[0.7.3]


  • healthLossMult - 默认为 1
  • 版本: [1.0.0],[0.7.3]


  • instakillOnMiss - 默认为关闭
  • 版本: [1.0.0],[0.7.3]


  • practice - 默认为关闭
  • 版本: [1.0.0],[0.7.3]


  • botPlay - 默认为关闭
  • 版本: [1.0.0],[0.7.3]


    箭头变量

  • defaultPlayerStrumX0 - 玩家的左箭头 X: 732
  • defaultPlayerStrumY0 - 玩家的左箭头 Y: 50 (Upscroll模式) - 570 (Downscroll模式)
  • defaultPlayerStrumX1 - 玩家的下箭头 X: 844
  • defaultPlayerStrumY1 - 玩家的下箭头 Y: 50 (Upscroll模式) - 570 (Downscroll模式)
  • defaultPlayerStrumX2 - 玩家的上箭头 X: 956
  • defaultPlayerStrumY2 - 玩家的上箭头 Y: 50 (Upscroll模式) - 570 (Downscroll模式)
  • defaultPlayerStrumX3 - 玩家的右箭头 X: 1068
  • defaultPlayerStrumY3 - 玩家的右箭头 Y: 50 (Upscroll模式) - 570 (Downscroll模式)
  • defaultOpponentStrumX0 - 对手的左箭头 X: 92
  • defaultOpponentStrumY0 - 对手的左箭头 Y: 50 (Upscroll模式) - 570 (Downscroll模式)
  • defaultOpponentStrumX1 - 对手的下箭头 X: 204
  • defaultOpponentStrumY1 - 对手的下箭头 Y: 50 (Upscroll模式) - 570 (Downscroll模式)
  • defaultOpponentStrumX2 - 对手的上箭头 X: 316
  • defaultOpponentStrumY2 - 对手的下箭头 Y: 50 (Upscroll模式) - 570 (Downscroll模式)
  • defaultOpponentStrumX3 - 对手的右箭头 X: 428
  • defaultOpponentStrumY3 - 对手的右箭头 Y: 50 (Upscroll模式) - 570 (Downscroll模式)
  • 注意:所有 Strum 变量仅在调用 “onCountdownStarted” 后可用,否则其值为 0。

    版本: [1.0.0],[0.7.3]


    角色变量

  • defaultBoyfriendX - 玩家的X,他在背景的 .JSON
  • defaultBoyfriendY - 玩家的Y,他在背景的 .JSON
  • defaultOpponentX - 对手的X,他在背景的 .JSON
  • defaultOpponentY - 对手的Y,他在背景的 .JSON
  • defaultGirlfriendX - Girlfriend的X, 他在背景的 .JSON
  • defaultGirlfriendY - Girlfriend的Y, 他在背景的 .JSON
  • 版本: [1.0.0],[0.7.3]



  • boyfriendName - 当前玩家角色的 .JSON 名称(不带扩展名)。
  • dadName - 当前对手角色的 .JSON 名称(不带扩展名)。
  • gfName - 当前Girlfriend角色的 .JSON 名称(不带扩展名)。
  • 版本: [1.0.0],[0.7.3]


    设置变量

  • downscroll - 默认为false
  • middlescroll - 默认为false
  • framerate - 默认为60
  • ghostTapping - 默认为true
  • hideHud - 默认为false
  • timeBarType - 默认为"Time Left"
  • scoreZoom - 默认为true
  • cameraZoomOnBeat - 默认为true
  • flashingLights - 默认为true
  • noteOffset - 默认为0
  • healthBarAlpha - 默认为1.0
  • noResetButton - 默认为false
  • lowQuality - 默认为false
  • shadersEnabled - 默认为true
  • guitarHeroSustains - 默认为true
  • noteSkin - 默认为"Default"
  • splashSkin - 默认为"Psych"
  • splashAlpha - 默认为0.6

  • noteSkinPostfix - 箭头皮肤(比如: "-future", "-chip", 默认为空).
  • splashSkinPostfix - 飞溅皮肤(比如: "-diamond", "-vanilla", Psych 为空).
  • 版本: [1.0.0],[0.7.3]