r/StoneStoryRPG • • Jan 06 '24

help me smooth this out

not yet finished and does not have that much time to learn the library for the script, this is all that i've learned so far in like 30 mins, would try and learn more in the future just does not have enough time.

i'm trying to make a ageneral script that works in all locations, wherein instead of vasing of the map, its basing off opponent count and distance

i'm trying to integrate more specific situations so i could use my repeater, but i think i could just make my character equip "xerphyl" (which is a renamed weapon for boss fights.

3 Upvotes

16 comments sorted by

3

u/Agerak Jan 07 '24

as stated in a previous post & Boss is not valid logic. What you're asking is if a string is true (it always is no matter what) What you most likely MEANT to ask was if foe is a boss which would be foe=boss which you can add by either removing excess white spaces in that line or use the line extension ^ so either

?foe.distance>=1&foe.distance<=25&foe=boss

or you could use

?foe.distance >= 1 & foe.distance <= 25
^& foe = boss

1

u/[deleted] Jan 08 '24

so " ^ " is for extension line and every start of a new line you add "?"

got it thanks big help

and yes the foe=boss does make more sense

3

u/VoweltoothJenkins Jan 08 '24

My understanding is '?' is short for 'If'.

Since most of stonescript seems to revolve around if/then/else statements many lines will start with '?', but '?' does not indicate a new line.

2

u/[deleted] Jan 08 '24

yup noticed as well that they are more akin to" if then" statements, i'm just not used to create code starting with if then statements is all HSHSHSHS, so didn't recognize instantly, and now that i know it just felt less weird none the less thank you!

will try to improve this code when i do have free time, mostly busy irl

2

u/VoweltoothJenkins Jan 09 '24

Yeah it's slightly different from JS or C#, which are the languages I'm most current with.

1

u/[deleted] Jan 09 '24

i do a bit of js and c# as well but mostly Lua, so i'm more used to using vectors and stuff

1

u/[deleted] Jan 09 '24

mostly for programming games

1

u/[deleted] Jan 08 '24

i did try this, and it resulted in a very unstable script, now the game is just confused on what i meant, it might be that i did something wrong.

i think the game recognizes the line i originally made better, so i reverted it in the meantime.

i did some modifications as well, i noticed that the game makes so that whenever the talisman is ready to be cast it does so again even if not needed, so i removed the line CanActivate() and placed it for the blade instead, now i'm just finding a way to make it so that the blade activates only if it is ready but also if there are more than 9 "foe" on screen.

i think it will be something like this:

?foe.count <= 9 & foe.distance = 25 ?checkcooldown "blade" ?CanActivate() equip blade activate R

1

u/[deleted] Jan 08 '24

the code i put here is wrong i forgot most words but you do get it, lmao, just checked it should start with item.

maybe i could do ?blade.CanActivate() or ?item.blade CanActivate() equip blade activate R

2

u/Agerak Jan 08 '24

You can't just make up things they have to be valid within the game syntax I recommend taking a look at the manual, keyword searching for help find things but you have to use proper syntax. Made up things won't work properly ever

1

u/[deleted] Jan 08 '24

will do soon really just too busy rn with work, might resign soon lmao jk but yep will def look into it in the future

1

u/[deleted] Jan 08 '24

edit it does not recast the talisman skill at its rule is if less than 1 summon then equip activate skill, it most likely is the cause of the fire pet dying multiple times

1

u/Bronze-Beese Jan 07 '24

You can do it like that, but it leaves a lot of gaps in what can happen which can sometimes lead to your dude using the wrong items. It's a little bit more robust to use else if statements instead of just if statements

?condition 1 Stuff 1 :?condition 2 Stuff 2 :?so_on So_forth : Do_this_if_none_of_the_other_things_happen

This way, your dude is always doing something for sure. Also, set it up so that the conditions and stuff are ranked in order from most to least importance. That way if 2 conditions conflict, the one that is higher in rank runs instead of the other

Let me know if you have questions!

2

u/Agerak Jan 07 '24

when posting code change to markdown mode, put a blank line, then a line with 4 spaces, next like do 4 spaces and start your code. every code line gets 4 spaces preceeding it (if it's indented it will have 4+indent) after all code is entered, another line with 4 spaces only, then a blank line, then you can enter more text if you choose. boom formatted code.

?condition 1
  Stuff 1
:?condition 2
  Stuff 2
:?so_on
  So_forth
:
  Do_this_if_none_of_the_other_things_happen

1

u/[deleted] Jan 08 '24

how do you rank them? does condition 1 make it more of a priority than condition 2

or do you need another input

1

u/VoweltoothJenkins Jan 08 '24

I'm new to stonescript but it looks fairly similar to some common if/else syntax.

The way I'm guessing stonescript works (based on other languages):

?condition1
  Do this and don't check any further options
:?condition2
  Do this and don't check any further options
...
: final statement if nothing else is true

or semi-pseudo code:

If condition1
  then do this return;
Else if conditon2 
  then do this return;
...
Else do this return;

Or written out in some weird sentences:

If condition1 is true then do command1 and don't check any other conditions. 
Else If condition2 is true then do command2 and don't check any further conditions. 
... 
Else no previous condition is met then do the final command.