Stone Story RPG

Stone Story RPG

Not enough ratings
Programming Tricks
By Veni Vidi Vodka
Want to progress faster? Learn a thing or two? Ease the burden of development?
This guide will help you setting up a small environment and work towards better solutions without going all theoretical.
   
Award
Favorite
Favorited
Unfavorite
Basics
Common Links

Visual Studio Code
Let's get you started with selecting an editor. A great choice for stonescript is Visual Studio Code[code.visualstudio.com] as it has a well maintained extension[marketplace.visualstudio.com] to help you writing code.

After you have downloaded and installed Visual Studio Code (here, it's free)[code.visualstudio.com], open it, select the square-looking icon and search for "stonescript", install it.


-

Writing Code
Enter the following into your Explorer, it will directly move you into the storage location of the game.
%appdata%\..\LocalLow\Martian Rex, Inc_\Stone Story
You will find a similarly named folder with your SteamID, double-click it, and drag the "Stonescript" folder into Visual Studio Code:

-

You now have:
  • a capable editor
  • syntax highlighting
  • a workspace inside the scripting folder


Creating a test file and running it
Create a new file called "Test.txt" by right-clicking the folder structure in VS Code:

Let's try to print a text on the left side, roughly in the middle:
>`0,10,Hi, this is the test file


Now all that's left is to call that script from the game, like so:

Important: Notice the syntax, described in the manual: import Test, no file ending.

The game should now show a white text with "Hi, this is the test file".

With that you're good to go to write extensible segments.
Animation Cancelling
The first trick in the book is animation cancelling, as seen in this video:

// write it into a file, for example in a folder "Util/AnimationCancel.txt" // use as such, you can call it every tick, regardless of early or late: // var ac = import Util/AnimationCancel // ac.AnimationCancel() func AnimationCancel() var isTwoHanded = !item.left // evaluates to true if there's no weapon on left hand var leftItem = item.left // stores the weapon of the left hand in a variable var rightItem = item.right // stores the weapon of the right hand in a variable ?item.right.state = 3 // on the upswing right equipR shield *0 +0 // equips a zero-star basic shield ?item.left.state = 3 // on the upswing left equipL wand *0 +0 // equips a zero-star basic stone wand ?isTwoHanded // if it was two handed, then ?rightItem // if there was something in the right hand equip @rightItem@ // 'equip' is necessary for two-handed weapons :?leftItem // otherwise if there was something in the left hand equip @leftItem@ // 'equip' is necessary for two-handed weapons : // it was not two handed ?rightItem // if the right item was set equipR @rightItem@ // 'equipR' for right-hand ?leftItem // if the left item was set equipL @leftItem@ // 'equipL' for left-hand
Optimizing Oroboros & Pickups
The API allows access to close-by enemies by simply querying the distance. This means it's trivially possible to optimize health gain as well as pickups as much as possible.
This code always sets all items (left and right hand), which reduced the complexity of what you have to keep track of.

// wands have a range of 20, as long as enemies stay outside that distance // it's not necessary to equip any weapons ?foe.distance <= 20 // when the enemy is near, equip equipL wand *7 // if you're running dual wands currently, choose anything that fits your build equipR wand *7 : // otherwise (no enemies) ?pickup.distance <= 10 // if a pickup is close equipL ouroboros // keep ouroboros as long as possible up equipR star // and move as quickly as possible : // otherwise (no pickups, no enemies) equipL ouroboros // keep ouroboros as long as possible up equipR dashing shield // move as quickly as possible
3 Comments
trevordrake547 15 May, 2024 @ 4:40pm 
and arrays are not api
trevordrake547 15 May, 2024 @ 4:31pm 
and the discord server has people who will help if you ask, the link is https://discord.gg/stonestoryrpg
trevordrake547 15 May, 2024 @ 4:04pm 
ouroborus is not worth it, as it heals 1 hp every 3.14 seconds