Author Topic: @if@ statements in custom commands not working as usual?  (Read 2749 times)

0 Members and 1 Guest are viewing this topic.

Ryswick

  • Youngling
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
  • Twitch Name: Ryswick
@if@ statements in custom commands not working as usual?
« on: March 16, 2016, 04:32:07 AM »
Before the latest patch I've had a command with an @if@ statement that compared two values which both were nested @calc@ statements.

We're talking nested at least 4-5 times.

This command no longer works since I've patched Deepbot, is this intentional? It seems to only work if I compare simple numbers together, no calculations allowed.

MercurY3rd

  • Councilor
  • *****
  • Posts: 652
  • Karma: +26/-1
    • View Profile
  • Twitch Name: mercury3rd
Re: @if@ statements in custom commands not working as usual?
« Reply #1 on: March 17, 2016, 12:24:00 AM »
can you post your command so we can help you better.
Hier steht nichts Sinnvolles, dennoch freundliche Grüße. MercurY

Ryswick

  • Youngling
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
  • Twitch Name: Ryswick
Re: @if@ statements in custom commands not working as usual?
« Reply #2 on: March 17, 2016, 05:01:17 AM »
All right, so this might get a bit confusing because the command is huge, and it's connected to other commands, but I'll try my best to explain it...

This here was the original command, it worked for a couple weeks before the latest patch:

@if@[>=||@calc@[+|@if@[@readfile@[@user@armor.txt]||||0||@readfile@[@user@armor.txt]]|@calc@[+|@if@[@readfile@[@user@weapon.txt]||||0||@readfile@[@user@weapon.txt]]|@calc@[+|@rand@[0|@target@[1]]|@calc@[+|@points@|@calc@[+|@calc@[/|@if@[@readfile@[@user@prof.txt]||||0||@readfile@[@user@prof.txt]]|5]|@calc@[*|@streamrank@|@streamrank@]]]]]]||@target@[2]||@user@ has defeated the @target@[6]! @if@[>=||@points@||@target@[3]||||@exec@[0,!battleRewards @target@[4] @target@[7]]]||The @target@[6] has slain @user@!@editpoints@[@user@|@target@[5]]]

So this is the 'combat' system of an RPG mini-game I've been working on. Basically it adds a bunch of things together to get your combat rating such as level, armor, weapon, battleproficiency, and rank. It compares this to Target[2] which is the number you need to beat to kill the enemy. Target[1] is a random number attached to make sure you don't always lose/win every fight against that enemy. Target[3] is the level at which you stop gaining rewards from fighting that enemy. Target[4] is how many levels you gain for winning. Target[5] is how many levels you lose when you're defeated by the enemy. Target[6] is the enemy's name, and Target[7] is how much gold you earn.

I started stripping the command down piece by piece to see what was causing the problem, and I eventually got it to work like this:

@if@[>||@points@||@target@[2]||@user@ has defeated the @target@[6]! @if@[>=||@points@||99999||||@exec@[0,!battleRewards @target@[4] @target@[7]]]||The @target@[6] has slain @user@!@editpoints@[@user@|@target@[5]]]

But it only works when the player's overall combat level is simply @points@, no adding weapon power, armor power, ranking, battleproficiency, etc to it. It only works if it's simply @points@ compared to Target[2].

Ryswick

  • Youngling
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
  • Twitch Name: Ryswick
Re: @if@ statements in custom commands not working as usual?
« Reply #3 on: March 17, 2016, 03:03:25 PM »
I've been messing around with it more and I've come to the conclusion that I have no idea what's wrong with it.

It will work with calculations within the @if@ statements on some occasions, but not others. It just simply doesn't work like it used to. I might just try to do some weird work-around for the time being.

Stoutman_PR

  • Youngling
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
  • Twitch Name: Stoutman_PR
Re: @if@ statements in custom commands not working as usual?
« Reply #4 on: March 28, 2016, 07:38:35 AM »
I have many nested @if@ commands which are not working most of the time. Sometimes they work, but most times they do not. I think this started with the past patch.

I have made sure java is up to date.

Sometimes they work, most tries they do not.

No errors are being logged. Is there a way to log failed commands?

Please advise when this will be corrected as it is causing a lot of my users to wonder why their usual commands are not working. Not to mention the hours of my time trying to figure out what is wrong...

Thanks!

ExpertsOnline

  • Creator
  • Councilor
  • *****
  • Posts: 2656
  • Karma: +289/-24
    • View Profile
  • Twitch Name: expertsonline
Re: @if@ statements in custom commands not working as usual?
« Reply #5 on: March 28, 2016, 08:02:12 PM »
Please let me know if the latest update fixes this. Nesting @if@ is a bit tricky, cause you can't execute the outcome, but need to execute the conditions.
I hope the new @if@ module helps.

Stoutman_PR

  • Youngling
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
  • Twitch Name: Stoutman_PR
Re: @if@ statements in custom commands not working as usual?
« Reply #6 on: April 05, 2016, 01:56:36 AM »
The latest update seems to of fixed the issue I was experiencing :)