Suggestions for new read commands in battle

Make games! Discuss those games here.

Moderators: Bob the Hamster, marionline, SDHawk

Post Reply
ArtimusBena
Slime Knight
Posts: 254
Joined: Thu Nov 16, 2017 5:22 am

Suggestions for new read commands in battle

Post by ArtimusBena »

Starting a new thread merely for organization. The scope of this thread is limited to suggestions on what kind of `read` commands could be added relating to battles. Whether someone decides to roll up their sleeves and do this themselves, or tmc ends up doing it himself eventually, it could be a convenient list to refer to. (If you wish to debate the idea of battlescripting itself, please add your opinions here: https://www.slimesalad.com/forum/viewtopic.php?t=8026)

Tmc in the "Let's talk about battlescripting" thread:
If you're willing to write FreeBASIC code, adding new script commands to read attack data would be very helpful. Currently you can only get attack names and captions. Adding script commands is read existing data is easy, requires almost no knowledge of the codebase, and we even have an article explaining how to do it.
How to add a new script command:
https://rpg.hamsterrepublic.com/ohrrpgc ... pt_command
But do discuss it before starting.
So let's discuss it.

Wishlist so far:
Command to read foemap data at a certain tile - Foxley
Access to item data - Kyle

-------tmc (read his post a few posts down for context):
read foemap (not sure if this is different from Foxley's request)
equippable in slot
get equip slot # Would only return first slot. This is very similar to "equip where" but doesn't check hero
get equip stat bonus
get equip elemental resist as int
equip elemental resist as int # alias, for consistency with herobaseelementalresistasint, enemyelementalresistasint
get item value
get item consumed
get weapon picture
get weapon palette
get weapon attack
get item attack as weapon
get item attack in battle
get item attack out of battle

-------bob votes for ("item" instead of "equip")
get item stat bonus
get item elemental resist as int
Last edited by ArtimusBena on Mon Jul 13, 2020 6:56 pm, edited 11 times in total.
User avatar
kylekrack
Liquid Metal Slime
Posts: 1242
Joined: Mon Jun 16, 2014 8:58 am
Location: USA
Contact:

Post by kylekrack »

The only get item ___ commands are get item name, get item description, and get item maximum stack size. All other item data needs access in scripts (can edit with a comprehensive list later).
My pronouns are they/them
Ps. I love my wife
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

Adding a command just to read the foemap would be easy, since it's just

Code: Select all

   battle_formation_set = readblock(foemap, x, y, 0)
(that's FB code) where 0 is the default for out-of-range x/y values.

A while back... a year ago... I started on adding a command to write foemaps, which is far harder because of saving map state and Test Game, etc. But I didn't get as far as adding actual script commands, so anyone is welcome to add a "read foemap" command and there won't be any redundant wok. Finishing "write foemap" isn't a priority for me right now.

Item commands are prime examples of ones where the naming and semantics need discussion. Here's the list of commands that I came up with (just the "get" versions):

Code: Select all

equippable in slot
get equip slot   # Would only return first slot. This is very similar to "equip where" but doesn't check hero
get equip stat bonus
get equip elemental resist as int
equip elemental resist as int   # alias, for consistency with herobaseelementalresistasint, enemyelementalresistasint
get item value
get item consumed 
get weapon picture
get weapon palette
get weapon attack
get item attack as weapon
get item attack in battle
get item attack out of battle
Script commands are named quite inconsistently, so naming is always a stumbling block for me.
Note that although they all act on items, the proposed name contains either "item", "equip" or "weapon" to distinguish different item subtypes, but you could argue for "get item weapon picture", etc, instead. I was trying to shorten the names. In particular, maybe "get equip slot" is too confusing a name.
Last edited by TMC on Thu Jul 09, 2020 1:36 pm, edited 2 times in total.
User avatar
Spoonweaver
Liquid Metal King Slime
Posts: 6466
Joined: Mon Dec 08, 2008 7:07 am
Contact:

Post by Spoonweaver »

Sure...
and the OTHER thread is the one that gets deleted....
:v:
What is even happening in this thread?

How about we all just make games quietly and post on here when we have an update on progress, to tell someone how their update looks cool, or to let everyone know your game is ready to be played?


oh and TMC

Code: Select all

get equip slot   # Would only return first slot. This is very similar to "equip where" but doesn't check hero 
So get equip slot would return the item id of the weapon the hero is holding?
Or.. what exactly is it returning?
I assume to get the hero's weapon you'd do

Code: Select all

Get hero equipment ([hero order ID], [equipment slot])
and it would return an item id
Last edited by Spoonweaver on Sun Jul 12, 2020 12:21 am, edited 3 times in total.
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

This thread has a point. It's about engine development, not game development.
I deleted the posts where Bena and Sword bicker about the thread title, because it was derailing the thread.
So get equip slot would return the item id of the weapon the hero is holding?
No, all the commands I listed are to read data from item definitions. But your confusion lends weight to the concern that the name is too confusing. So maybe they should be named:

Code: Select all

get item equip slot
get item equip stat bonus
get item equip elemental resist as int 
or

Code: Select all

get item stat bonus
get item elemental resist as int 
I can't decide.

BTW, the command to read a hero's equipment already exists, it's called "check equipment". Another example of an irregular name.
User avatar
Bob the Hamster
Lord of the Slimes
Posts: 7660
Joined: Tue Oct 16, 2007 2:34 pm
Location: Hamster Republic (Ontario Enclave)
Contact:

Post by Bob the Hamster »

I vote for

Code: Select all

get item stat bonus
get item elemental resist as int
I think it is a good balance between length and specificity
User avatar
Spoonweaver
Liquid Metal King Slime
Posts: 6466
Joined: Mon Dec 08, 2008 7:07 am
Contact:

Post by Spoonweaver »

yes I like item more as the keyword there
equip, to me anyways, means the item is equipped and on a hero
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

Sounds good. But what about the weapon commands? My suggestions:

Code: Select all

get weapon picture
get weapon palette
get weapon attack   # Alias to "get item attack as weapon"
get item attack as weapon
were inconsistent, I suppose those should be

Code: Select all

get item weapon picture
get item weapon palette
get item weapon attack 
A complication is that I'd like to allow items equipped in slots other than the Weapon slot to also add attacks directly to the hero battle menu. For example, "Shield bash" or some talisman that can be invoked for a spell. How you define that in the hero battle menu editor is a tricky detail, but I guess such pieces of equipment can still be called "weapons" even if they aren't in the "weapon" slot.
Last edited by TMC on Wed Jul 15, 2020 3:05 am, edited 1 time in total.
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

I'm adding alternative commands to "fade screen in" and "fade screen out" which don't pause the engine during the fade, and which don't require a "wait(1)" beforehand. There'll be a new "wait for fade" command too. I think it's better not to just add another argument to "fade screen in/out" because they will behave so completely different to the original commands that it would be unhelpful to conflate them, and lists of arguments aren't very readable/self-documenting.

But what to call them?

Code: Select all

fade in no wait
fade out no wait

fade in
fade out

start fade in
start fade out

start fade screen in
start fade screen out

fade to palette
fade to color
OK, I have some favourites. Didn't think of them until I wrote this up.
User avatar
Spoonweaver
Liquid Metal King Slime
Posts: 6466
Joined: Mon Dec 08, 2008 7:07 am
Contact:

Post by Spoonweaver »

Code: Select all

fade in no wait
fade out no wait
User avatar
Fenrir-Lunaris
Metal Slime
Posts: 768
Joined: Mon Oct 15, 2007 10:45 pm
Location: OHR Depot

Post by Fenrir-Lunaris »

The current command is "fade screen in". I propose a fadeless transition be called "fadeless screen in" and fadeless screen out"
User avatar
Bob the Hamster
Lord of the Slimes
Posts: 7660
Joined: Tue Oct 16, 2007 2:34 pm
Location: Hamster Republic (Ontario Enclave)
Contact:

Post by Bob the Hamster »

These are my favorites:

Code: Select all

fade to palette
fade to color
User avatar
SwordPlay
Chemical Slime
Posts: 966
Joined: Sun Jan 22, 2017 9:32 am
Location: London, England
Contact:

Post by SwordPlay »

Fenrir-Lunaris wrote:The current command is "fade screen in". I propose a fadeless transition be called "fadeless screen in" and fadeless screen out"
/

yes this. or possibly even screen in/out, or screen on/off or similar
"Imagination. Life is your creation."
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

Everyone has a different preference! Mine is "start fade in/out", because I think it makes the difference from "fade screen in/out" clear and lets you remember which is which, and IMO that's the most important thing. "fade screen in/out" is easily the most misunderstood script command; I see that even a lot of people who have been using the engine for decades don't realise that it pauses the game and happens immediately, and it's traumatised generations of users into sprinkling all their scripts with unnecessary waits.

"fadeless"? Well, it still fades. But I am thinking of adding another command ("set fade state"?) which immediately changes to a partial faded out state (e.g. 20% faded out to blue). Basically, it's like "tweak palette" except that it also affects any 24-bit color (nonpaletted) sprites. Or maybe I should instead double-purpose "tweak palette" to do that.
Last edited by TMC on Sat Jul 18, 2020 5:52 am, edited 1 time in total.
ArtimusBena
Slime Knight
Posts: 254
Joined: Thu Nov 16, 2017 5:22 am

Post by ArtimusBena »

Unless I'm not understanding something fundamental, I just thought a 'wait for fade screen' command would be appropriate, while removing the inherent/inconsistently placed wait. (Does this pertain to battles? If not, let's pace ourselves)
Last edited by ArtimusBena on Sat Jul 18, 2020 7:03 am, edited 2 times in total.
Post Reply