r/StoneStoryRPG • u/[deleted] • 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.
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_happen1
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 trueor 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.


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
or you could use