StoneScript

\*\*UNDER CONSTRUCTION\*\*

Basic StoneScript info from the developer (source: http://stonestoryrpg.com/stonescript/help.txt)

```
v1.9.0 - 2019/10/24

# Stonescript
Used in the Mind Stone to automate equipment choices.
Stonescript is very simple, yet powerful and will continue to be improved.
Need help? Want to collaborate on scripts? Go to: discord.gg/StoneStoryRPG

The goal of a good script is to equip the best items as the state of the game changes.
This could be as simple as automatically activating the potion if your health is low,
  or complex enough where combat is optimized to super-human levels.

Index
1. Example
2. Basics
3. Game State
4. Commands
5. Comparisons
6. Search Filters
7. Tips
8. Default script
9. Roadmap

# 1. Example
// Equips the Shovel for Rocky Plateau.
// In Caves of Fear it equips loadout 1,
//   except against the boss, where the
//   Grappling Hook and a 7 star War Hammer
//   are used instead.
// For Haunted Halls it uses two Wands,
//   specifying Poison for left hand and
//   Vigor for the right hand, however
//   if the difficulty is over 5 stars it uses
//   an enchanted +13 Vigor Staff instead.
// Potion activates if hitpoints fall below 10
?loc=rocky
 equip shovel
 ?loc=cave
  loadout 1
  ?foe=bolesh
   equip grap
   equip hammer *7 D
?loc=halls
 equipL poison wand
 equipR vigor wand
 ?loc.stars > 5
   equip vigor staff +13
?hp < 10
 activate potion

# 2. Basics
?   Compare and branch logic (if)
//  Comment
^   Continue previous line

# 3. Game State
These tell you what's happening and what's right in front of the player
?loc               the current location name
?loc.stars         the current location's difficulty
?foe               the current foe being targeted by the player
?foe.distance      the distance between the player and the foe being targeted
?foe.count         the number of foes within 40 units
?pickup            the current pickup being targeted by the player
?pickup.distance   the distance between the player and the pickup being targeted
?hp                the player's current hitpoints
?maxhp             the player's maximum hitpoints
?time              the current frame number of the location
?totaltime         the current frame number of the location, accumulated in case of boss sub-location
?foe.hp            the current hitpoints of the foe being targeted by the player
?foe.maxhp         the maximum hitpoints of the foe being targeted by the player
?foe.armor         the current armor of the foe being targeted by the player
?armor             the player's current armor
?maxarmor          the player's maximum armor
?pos.x             the player's current x position
?debuffs.count     the number of debuffs currently on the player
?foe.debuffs.count the number of debuffs on the foe being targeted
?face              the player's current facial expression. E.g. ?face =( ^^)

# 4. Commands
These tell the game to do something
> <str>          Prints a string to the top of the screen.
equip  <str>     Equips an item. <str> has a limit of 7 criteria
equipL <str>     Equips an item to the left hand
equipR <str>     Equips an item to the right hand
loadout <n>      Equips a specific loadout number
activate <item>  Activates a given item. Possible values: "potion", "P", "left", "L", "right" and "R".
>(abcd           Shows a custom facial expression on the player. E.g. >( OwO
>oX,Y,[#rrggbb,]<str>  Advanced print relative to the player's head position.
>`X,Y,[#rrggbb,]<str>  Advanced print relative to the upper-left corner of the screen.
>cX,Y,[#rrggbb,]<str>  Advanced print relative to the center of the screen.
>fX,Y,[#rrggbb,]<str>  Advanced print relative to the target foe's head position.
  E.g. ">o-6,3,#ff0000,walk forward ->"

# 5. Comparisons
Used in conjunction with game state to make decisions
=  Compares values equal or string contains
!  Compares values not equal or string does not contain. E.g.: "?foe!poison"
 &  And. E.g.: "?loc=caves & foe=boss"
>  Greater than compare. Can be used with a location's difficulty, number of foes, health, etc
<  Less than compare

# 6. Search Filters
These are used when evaluating game state. E.g.: "?foe = insect"
poison
vigor
aether
fire
air
ice
arachnid
serpent
insect
machine
humanoid
elemental
boss
spawner
flying
slow
ranged
unpushable
undamageable
magic_resist
magic_vulnerability
immune_to_stun
immune_to_ranged
immune_to_debuff_damage
immune_to_physical
*[number]  star level of a location or item
+[number]  enchantment bonus of an item

# 7. Tips
Space (identation) matters when defining what happens as a result of '?' comparisons (scope).
The script can be changed in the middle of a run by pressing 'M' on your keyboard.
The Power button in the top-right of the Mind Stone turns the script ON/OFF.
If multiple equip Commands are called, whichever comes last will occur.
The script executes 30 times per second (once per frame).
To experiment with different scripts it's recommended to copy them into an external text editor, such as Notepad.
Common shortcuts such as Ctrl+A, Ctrl+C and Ctrl+V are useful.
Holding the Tab key in-game gives you a lot of information about game state.
A print command can be broken into multiple lines by using '\n' in the text

# 8. Default script
?hp < 10
  activate potion
loadout 1
?loc = rocky
  equip shovel
 ?foe = poison
   equipL crossbow

  Roadmap

 Things that are planned, but not yet in the game:

 ?ai.enabled  True if the AI is ON, False if the AI is off (e.g. during a cinematic moment)

 ?has = potion  Evaluates if there is a potion available to use
 ?has = <item>  Evaluates if the given item is equipped
 ?hasL = <item>  Evaluates if the given item is equipped on the Left
 ?hasR = <item>  Evaluates if the given item is equipped on the Right

 ?harvest  returns the current harvest object targeted by the player
 ?harvest.distance  returns the distance between the player and the target harvest location

 var a  Declare a new int variable, single character. Up to 26 variables from a to z
 =   Assign a value to a variable

 Variable Operations
 +  add two variables
 -  subtract two variables
 ++ increment variable
 -- decrement variable
 *  multiply two variables
/  divide two variables
%  modulus

:   Else logical branch

?key  Allows custom key inputs. E.g. ?key = A

?foe.level
?foe.state (cast,perf,cooldown)
?foe.statetime

brew [resources] Creates a potion at the beginning of a location. E.g.: brew wood stone

> #func  Possibility to insert function return values into the print
> #var   Possibility to insert variables into the print
> #foe.distance, etc

equipF <str>  equips an item to the Faerie

foes  The list of foes within 30 units

```