Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EoC effect to terminate execution of EoC #76547

Open
GuardianDll opened this issue Sep 19, 2024 · 5 comments
Open

EoC effect to terminate execution of EoC #76547

GuardianDll opened this issue Sep 19, 2024 · 5 comments
Labels
<Suggestion / Discussion> Talk it out before implementing

Comments

@GuardianDll
Copy link
Member

GuardianDll commented Sep 19, 2024

Is your feature request related to a problem? Please describe.

  {
    "type": "effect_on_condition",
    "id": "item_talks_to_you",
    "effect": [
      {
        "if": { "math": [ "n_hp('ALL')", "<", "n_hp_max('bp_null')" ] },
        "then": { "u_message": "Your <npc_name> says \"<schizo_weapon_talk_damaged>\"" },
        "else": {
          "if": { "math": [ "(u_hp('ALL') * 1.4)", "<", "u_hp_max('bp_null')" ] },
          "//": "Weapon will be concerned for you if you're significantly injured.",
          "then": { "u_message": "Your <npc_name> says \"<schizo_weapon_talk_bleeding>\"" },
          "else": {
            "if": { "and": [ "u_can_see", { "math": [ "u_monsters_nearby('radius': 10)", ">=", "1" ] } ] },
            "then": { "u_message": "Your <npc_name> says \"<schizo_weapon_talk_monster>\"" },
            "else": { "u_message": "Your <npc_name> says \"<schizo_weapon_talk_misc>\"" }
          }
        }
      }
    ]
  },

Solution you would like.

  {
    "type": "effect_on_condition",
    "id": "item_talks_to_you",
    "effect": [
      {
        "if": { "math": [ "n_hp('ALL')", "<", "n_hp_max('bp_null')" ] },
        "then": [ { "u_message": "Your <npc_name> says \"<schizo_weapon_talk_damaged>\"" }, "terminate" ]
      },
      {
        "if": { "math": [ "(u_hp('ALL') * 1.4)", "<", "u_hp_max('bp_null')" ] },
        "//": "Weapon will be concerned for you if you're significantly injured.",
        "then": [ { "u_message": "Your <npc_name> says \"<schizo_weapon_talk_bleeding>\"" }, "terminate" ]
      },
      {
        "if": { "and": [ "u_can_see", { "math": [ "u_monsters_nearby('radius': 10)", ">=", "1" ] } ] },
        "then": { "u_message": "Your <npc_name> says \"<schizo_weapon_talk_monster>\"" },
        "else": { "run_eocs": { "id": "normal_talk", "effect": { "u_message": "Your <npc_name> says \"<schizo_weapon_talk_misc>\"" } } }
      }
    ]
  },

Describe alternatives you have considered.

--

Additional context

Yes, i just want a bit of c++ in my json

@GuardianDll GuardianDll added the <Suggestion / Discussion> Talk it out before implementing label Sep 19, 2024
@PatrikLundell
Copy link
Contributor

Until someone tries to use it to terminate the EOC (so it won't be repeated), only to find it skips the processing of the rest of the section instead.

@GuardianDll
Copy link
Member Author

i should've clarified i wanted something similar to return;

@PatrikLundell
Copy link
Contributor

"return" is a better name, although there's probably a better name than that out there (I can't find it in my mind, though).

@GuardianDll
Copy link
Member Author

Return assumes it would return some value, and in c++ it does, it's just for void it simply end the function, effectively terminating it. Maybe "end" gonna fit it better

@Hyperseeker
Copy link
Contributor

JS uses break to finish its loops and switch statements prematurely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Suggestion / Discussion> Talk it out before implementing
Projects
None yet
Development

No branches or pull requests

3 participants