Betonquest: Change int to VarableNumber in all Events, Objectives and Conditions

Created on 2 Dec 2017  路  12Comments  路  Source: BetonQuest/BetonQuest

Currently most conditions, events and objectives support the use of local variables instead of fixed integers but not all.
Just for example neededAmount in BlockObjective.java can't be a variable.
But there are way more then just this single one.

This is a inconsistency which limits players and makes it hard to understand the plugin if you don't look at the code directly.

So we should go through all the events, conditions and objectives one by one and fix it where it's needed.
This takes some large effort but I think it has to be done.


The following ones have to be changed:

Conditions:

  • [ ] DrunkCondition
  • [ ] DrunkQualityCondition
  • [ ] HasBrewCondition
  • [ ] LQAttributeCondition
  • [ ] LQKarmaCondition

Events:

  • [x] SudoEvent
  • [ ] GiveBrewEvent
  • [ ] TakeBrewEvent

Objectives:

  • [ ] BlockObjective
  • [ ] MobKillObjective
  • [ ] CraftingObjective
  • [ ] SmeltingObjective
  • [ ] TameObjective
  • [ ] DelayObjective
  • [ ] ExperienceObjective
  • [ ] FishObjective
  • [ ] EnchantObjective
  • [ ] ShearObjective
  • [ ] PotionObjective
  • [ ] KillPlayerObjective
  • [ ] BreedObjective
  • [ ] EntityInteractObjective
  • [ ] NPCKillObjective
  • [ ] MythicMobKillObjective
Feature Request

Most helpful comment

Thanks @joblo2213, it'll be helpful. Actually all objectives don't use variables because of some inconsistencies in how they store numeric data. Some of them count down to 0 from the required amount and complete when the counter reaches 0, some of them count up from 0 and complete when it reaches the required amount. The former would need to be converted to the latter format in order to allow variables after the objective has been started.

Then there's block, which is just bad design. I think I'll deprecate it and create break and place objectives instead.

All 12 comments

I just finished going throgh the code one by one and checking if something has to be changed.
I updated the top comment with a list of all things that we have to take a look into.

Thanks @joblo2213, it'll be helpful. Actually all objectives don't use variables because of some inconsistencies in how they store numeric data. Some of them count down to 0 from the required amount and complete when the counter reaches 0, some of them count up from 0 and complete when it reaches the required amount. The former would need to be converted to the latter format in order to allow variables after the objective has been started.

Then there's block, which is just bad design. I think I'll deprecate it and create break and place objectives instead.

Now happened the scond time that while scrolling down on my mobile i accidentally hit the close button.

So sorry for the spam.

Here is what I recently thought about this:
If we allow Variable Numbers for objectives and allow them to change while the objective is active this can be misused and results in objectives that never complete. This could cause some huge confusion and isn't investigable without looking at the database.

My solution would be to get the amount variable when the objective starts and set it to a fixed integer for the player, which is then decreased till it is 0.
If the variable is negative while starting the objective a QuestRuntimeException would be thrown.

@Co0sh what do you think about this?

that my point for posting, and even discovering, the issue in #814 is basically what you just said:

Should the amount that must be reached in a objective to complete it be changable while the objective is active or not? Allowing changes is easier to implement but could cause objectives that can never be completed if they were configured in a bad way. This would add a lot of confusion and many people wouldn't be able ton find and avoid such errors themselves. On the other point if we don't allow the variables to change after the objective we would limitn the things that could be achived that way.

THAT is what i'm really trying to do. I want to be able to set or change objective amounts (whether its a delay or a mobkill or block break... whatever) even while the objective is running.

I get that people could get confused and mess it up, but isnt that the case with everything? basic Beton is powerful enough to ruin a server before the owner knows it, if poorly used.

my argument would be that people would have to have some clue if they were even TRYING to do this sort of modification, that they would have to clearly read instructions before even getting to this point. Personally, whats the worst that could happen? they get an obective that never completes? or buggers up that quest in some way? that doesnt sound catastrophic or unrecoverable.

Can you add "MoneyEvent" in events list above.
i think, it's doesn't support the local variables

When i try this
ev_give_money: money +%point.reputation.amount% notify
i obtain this error
[BetonQuest] Error in 'default.ev_give_money' event (money): Could not parse money amount

I thought the problem came from there but obviously not :(

@titanium6 You just need to remove the +.

Look here https://betonquest.github.io/BetonQuest/versions/v1.11/10-Compatibility/#money-money_1
You confuse with money condition, i think.

@titanium6 Please join our discord to continue this discussion. discord.gg/rK6mfHq
EDIT: The issue was traced back to the + infront of the variable.

Merged into #1343

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Namnodorel picture Namnodorel  路  6Comments

PsychoLynx picture PsychoLynx  路  3Comments

MWFIAE picture MWFIAE  路  5Comments

digital-r picture digital-r  路  6Comments

HollishKid picture HollishKid  路  6Comments