Rûn Objects: The Player
The objects for the character she plays and the people with her: Player, Party, Input and Needs. Their full method lists are on Rûn Programs; event scripts reach the same things with verbs (give, take, gold, heal, xp, teleport) and readings (hp, gold, count(<item>)), on the Rûn Verb Index and Line Scripts.
Player: fields
Fields read with a dot and answer from the game as it stands: .hp, .maxHp, .mp, .maxMp, .gold, .level, .xp, .xpNext, .points, .fame, .x, .y, .vx, .vy, .facing (0 to 7), .grounded, .class, .race, .weight, .capacity, .flashlight, .battery, .stamina, .crouched and .hidden. A script can set .hp, .mp, .gold, .points, .battery, .stamina, .crouched and .hidden.
print(Player.level >= 1, Player.hp <= Player.maxHp)on onPlayer.gold = 120
Player.gold = Player.gold - 20
print(Player.gold)100Player: methods
- Pockets
Player.Give(item [, count]),Player.Take(item [, count])(all or nothing),Player.Count(item),Player.Equip(item),Player.Unequip(slot).- Growth
Player.GrantXP(amount),Player.LevelTo(level),Player.Stat(attribute),Player.SetStat(attribute, n),Player.LearnSpell(spell),Player.LearnSkill(skill).- Health
Player.Heal(amount),Player.Effect(id, rounds).- Story
Player.Quest(quest, stage),Player.QuestStage(quest),Player.Currency(id),Player.AddCurrency(id, amount).- Movement
Player.Teleport(x, y),Player.Move(dx, dy),Player.Preset(preset, on),Player.Nearest().
Methods that change her need a running game and refuse in the editor. Readings work in both. A name the game does not have (an item, a spell, a quest) is an error that names it, and nothing changes.
Player.Give("no_such_thing", 1)no_such_thingParty
Party.Count() is how many companions travel with her; Party.Id(i) names one, 0 the first. Party.HP(who), Party.Level(who) and Party.GrantXP(who, amount) read and grow them. See Companions.
print(Party.Count())0Input
Input.Held(action), Input.Pressed(action) and Input.Released(action) read the keys by their action's word (left, jump, attack, interact, or a custom action's word). They belong in an on update block, which runs every frame; see Rûn Events: Where Scripts Run and the controls part of Rûn Programs.
Needs
When the project has survival needs, Needs.Value("hunger") reads one from 0 to 100 (100 is met) and Needs.Add("thirst", 25) gives some back. See Needs.