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

Math do not support writing var to item #72891

Closed
GuardianDll opened this issue Apr 7, 2024 · 3 comments
Closed

Math do not support writing var to item #72891

GuardianDll opened this issue Apr 7, 2024 · 3 comments
Labels
<Suggestion / Discussion> Talk it out before implementing

Comments

@GuardianDll
Copy link
Member

GuardianDll commented Apr 7, 2024

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

As title says, trying to write n_ value when beta talker is item, and then read the written value, result in returning null instead of the written value. It seems the functionality works only within u_add_var?

Solution you would like.

Being able to write val to item using math

Describe alternatives you have considered.

No response

Additional context

Gonna make an example eoc later

@GuardianDll GuardianDll added the <Suggestion / Discussion> Talk it out before implementing label Apr 7, 2024
@Ramza13
Copy link
Contributor

Ramza13 commented Apr 14, 2024

So my testing seems to show items can do vars. This json is what I used

{
    "id": "test",
    "type": "TOOL",
    "name": { "str": "test" },
    "description": "A generic inflatable abstract to use for specific items.",
    "weight": "3 kg",
    "volume": "5 L",
    "price": 5000,
    "material": [ "plastic" ],
    "symbol": "P",
    "color": "light_red",    
    "use_action": { "type": "cast_spell", "spell_id": "test", "no_fail": true, "level": 1 }
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_TEST",
    "condition": { "math": [ "n_test", "<", "2" ] },
    "effect": { "math": [ "n_test", "++" ] },
    "false_effect": {
      "npc_spawn_npc": "portal_person",
      "hallucination_count": 2,
      "min_radius": 3,
      "max_radius": 5,
      "lifespan": [ "1 minutes", "3 minutes" ],
      "spawn_message": "A person steps nearby from somewhere else.",
      "spawn_message_plural": "Several identical people walk nearby from nowhere."
    }
  },
  {
    "type": "SPELL",
    "id": "test",
    "name": { "str": "Base characteristics of portal spells" },
    "description": "Base portal stats.",
    "valid_targets": [ "ground" ],
    "max_level": 1,
    "base_casting_time": 75,
    "min_range": 1,
    "max_range": 1,
    "shape": "blast",
    "effect": "effect_on_condition",
    "effect_str": "EOC_TEST"
  },

If you have an example of it failing I'm happy to take another look.

@andrei8l
Copy link
Contributor

Needs an example where it fails. There's nothing special on math's side and the var-writing behaviour is handled by the talker implementation.

Are you perhaps trying to write a var with math and then access it in code, or the other way around? That will not work directly because dialogue variables are always pefixed by npctalk_var_, something that I intended to remove eventually.

@GuardianDll
Copy link
Member Author

apparently something was wrong with my previous setup - using this clearly shows that the value is stored and read properly

  {
    "id": "qwerty_test",
    "type": "TOOL",
    "name": { "str": "qwerty_test" },
    "description": "qwerty_test",
    "weight": "1 g",
    "volume": "1 ml",
    "symbol": "F",
    "use_action": [ { "type": "effect_on_conditions", "description": "Write value", "effect_on_conditions": [ "TEST_EOC_1" ] } ]
  },
  {
    "type": "effect_on_condition",
    "id": "TEST_EOC_1",
    "effect": [ { "math": [ "n_test_val", "=", "rand(100)" ] }, { "run_eocs": [ "TEST_EOC_2" ] } ]
  },
  {
    "type": "effect_on_condition",
    "id": "TEST_EOC_2",
    "effect": [ { "u_message": "Random value: <npc_val:test_val>", "type": "good" } ]
  }

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