huderlem / poryscript

High-level scripting language for gen 3 pokemon decompilation projects
https://www.huderlem.com/poryscript-playground/
MIT License
198 stars 22 forks source link

[enhancement] Support pokemart products list #32

Closed nielsmittertreiner closed 2 years ago

nielsmittertreiner commented 3 years ago

When creating a pokemart, you need to enter a destination to the product list. Normally a product list looks something like this:

SootopolisCity_Mart_Pokemart:
  .2byte ITEM_ULTRA_BALL
  .2byte ITEM_HYPER_POTION
  .2byte ITEM_MAX_POTION
  .2byte ITEM_FULL_HEAL
  .2byte ITEM_REVIVE
  .2byte ITEM_MAX_REPEL
  .2byte ITEM_X_ATTACK
  .2byte ITEM_X_DEFEND
  .2byte ITEM_SHADOW_MAIL
  .2byte ITEM_NONE
  release
  end

I don't see a way of using .2byte in Poryscript yet, so perhaps a new statement could be used for pokemarts, e.g. mart or products. This could also remove the need to use the raw statement, .2byte and the release and end macros for this,

An example could be:

mart SootopolisCity_Mart_Pokemart {
  ITEM_ULTRA_BALL,
  ITEM_HYPER_POTION, 
  ITEM_MAX_POTION, 
  ITEM_FULL_HEAL,
  ITEM_REVIVE,
  ITEM_MAX_REPEL,
  ITEM_X_ATTACK,
  ITEM_X_DEFEND,
  ITEM_SHADOW_MAIL,
}

or for the products variant

products SootopolisCity_Mart_Pokemart {
  ITEM_ULTRA_BALL,
  ITEM_HYPER_POTION, 
  ITEM_MAX_POTION, 
  ITEM_FULL_HEAL,
  ITEM_REVIVE,
  ITEM_MAX_REPEL,
  ITEM_X_ATTACK,
  ITEM_X_DEFEND,
  ITEM_SHADOW_MAIL,
}

This would simplify the process quite a bit, but that's my opinion :D

huderlem commented 3 years ago

Thanks for the suggestion, however I don't believe this is worth adding. The main focus of Poryscript is the scripting and control-flow aspect, not data. I could potentially see something more general being useful, like:

2byte MyData {
    ITEM_ULTRA_BALL,
    ITEM_HYPER_POTION,
    ...
}

4byte MyData {
    Foo,
    Bar,
    ...
}

However, I think there is little benefit of that, if any, over using raw.

nielsmittertreiner commented 3 years ago

I agree, a more general would probably work better in this case. I just thought of this idea when I came across this while I was working on creating a new pokemart.

I personally think it would be a good addition to make 2byte and 4byte statements as it removes some need of raw, I think Poryscript would be very good when you wouldn't have to use raw at all.

ExcmoJack commented 3 years ago

I personally think it would be a good addition to make 2byte and 4byte statements as it removes some need of raw, I think Poryscript would be very good when you wouldn't have to use raw at all.

What about creating an alias to 2byte and 4byte as mart or whatever? I mean, once included the statements 2byte and 4byte, make the equivalence for mart or anything that fits.

huderlem commented 2 years ago

The mart statement is now in master.