Remove object bug

The place to post your WML questions and answers.

Moderators: Forum Moderators, Developers

Forum rules
  • Please use [code] BBCode tags in your posts for embedding WML snippets.
  • To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
Post Reply
User avatar
LordAwsomeness
Posts: 96
Joined: August 12th, 2013, 2:20 pm
Location: U.S.A.

Remove object bug

Post by LordAwsomeness » October 6th, 2019, 5:04 pm

Hey I dont know if this is a bug or if it was intended to work like this but when I try to remove an object by the name such as a created item then it does not remove the object. However it is weird because when I use the not syntax as a filter it recognizes the names of the weapons that I dont want it to remove. Can somebody please explain this to me? the EffectWML wiki says that I should be able to use the name of the object as a filter.

TLDR: I want to remove custom objects by their name and it is not working however it works when I tell the remove object not to remove an object with a specific name.
- Been playing Wesnoth since 2004 and the 1.0.x versions.
- Creator of Undead Invasion MP Scenario Pack.
- Creator of Valeria MP Adventure

User avatar
WhiteWolf
Forum Regular
Posts: 560
Joined: September 22nd, 2009, 7:48 pm
Location: Hungary

Re: Remove object bug

Post by WhiteWolf » October 7th, 2019, 6:50 pm

That's strange. Are you sure are using the syntax right? I'm asking because it's a little bit confusing:
Inside [object], the "name" is supposed to be the id key, but inside [remove_object], you must refer to it as object_id! That's because id here means the id in standard unit filter, and that is why your [not]'s find all your units that don't have what you put in there (and remove all their objects).
If this is not the problem, then you should include some code fragments, otherwise it would be hard to help.
Author of the Underness Series, consisting of V parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
Standalone works: The Ravagers - now for 1.14, with new bugs!

User avatar
LordAwsomeness
Posts: 96
Joined: August 12th, 2013, 2:20 pm
Location: U.S.A.

Re: Remove object bug

Post by LordAwsomeness » October 8th, 2019, 2:51 am

WhiteWolf wrote:
October 7th, 2019, 6:50 pm
That's strange. Are you sure are using the syntax right? I'm asking because it's a little bit confusing:
Inside [object], the "name" is supposed to be the id key, but inside [remove_object], you must refer to it as object_id! That's because id here means the id in standard unit filter, and that is why your [not]'s find all your units that don't have what you put in there (and remove all their objects).
If this is not the problem, then you should include some code fragments, otherwise it would be hard to help.
Turns out im just a klutz....

I know how to use the syntax properly and I tried several different variations to try and get to my endgoal but after Hours and hours of digging in the code and finally giving up, I found out what the issue was. Like 7 hours after I had moved onto other code, I realized that I didn't have the name of the variable set properly so the name of the attacks were being created off of a different part of the macro :doh:

this is what I did wrong over a year ago when I first created this code...

Code: Select all

#define LA_DISPLAY_ITEM_OPTION IMAGE ITEM_VARIABLE MINIMUM_ITEM_COUNT TYPE RANGE VARIATION

#first: has and can equip
#todo: make the item show up differently if it is already equipped
#{IMAGE}

{LA_OPTION_IMAGE_SHOW_IF $la_weapons.{ITEM_VARIABLE}.image "($la_inventory[$side_number].{ITEM_VARIABLE})     <span color='#00FF00' weight='bold'>$la_weapons.{ITEM_VARIABLE}.name $la_weapons.{ITEM_VARIABLE}.damage_base-$la_weapons.{ITEM_VARIABLE}.strikes_base (Adjusted: $la_weapons[$side_number].{ITEM_VARIABLE}.damage-$la_weapons[$side_number].{ITEM_VARIABLE}.strikes) ($la_weapons.{ITEM_VARIABLE}.skill1.des-$la_weapons.{ITEM_VARIABLE}.skill2.des)</span>
<span color='#808080' size='xx-small'>DEFTNESS: $la_hero[$side_number].deft.level/$la_weapons.{ITEM_VARIABLE}.deft </span>
<span color='#808080' size='xx-small'>DEXTERITY: $la_hero[$side_number].dexterity.level/$la_weapons.{ITEM_VARIABLE}.dexterity </span>
<span color='#808080' size='xx-small'>MAGIC: $la_hero[$side_number].magic.level/$la_weapons.{ITEM_VARIABLE}.magic </span>
<span color='#808080' size='xx-small'>STRENGTH: $la_hero[$side_number].strength.level/$la_weapons.{ITEM_VARIABLE}.strength </span>" (
[not]
{VARIABLE_CONDITIONAL la_inventory[$side_number].equipped_{RANGE} equals {ITEM_VARIABLE}}
[/not]
{VARIABLE_CONDITIONAL la_inventory[$side_number].{ITEM_VARIABLE} greater_than_equal_to {MINIMUM_ITEM_COUNT}}
{VARIABLE_CONDITIONAL la_hero[$side_number].deft.level greater_than_equal_to $la_weapons.{ITEM_VARIABLE}.deft}
{VARIABLE_CONDITIONAL la_hero[$side_number].dexterity.level greater_than_equal_to $la_weapons.{ITEM_VARIABLE}.dexterity}
{VARIABLE_CONDITIONAL la_hero[$side_number].magic.level greater_than_equal_to $la_weapons.{ITEM_VARIABLE}.magic}
{VARIABLE_CONDITIONAL la_hero[$side_number].strength.level greater_than_equal_to $la_weapons.{ITEM_VARIABLE}.strength}
) ({LA_WEAPON_MATH {ITEM_VARIABLE} $la_weapons.{ITEM_VARIABLE}.skill1 la_weapons.{ITEM_VARIABLE}.skill2}
{VARIABLE la_inventory[$side_number].equipped_{RANGE} {ITEM_VARIABLE}}
{LA_EQUIP_ITEM {VARIATION} ($la_weapons.{ITEM_VARIABLE}.name) ($la_weapons.{ITEM_VARIABLE}.image) {TYPE} {RANGE} $la_weapons[$side_number].{ITEM_VARIABLE}.damage $la_weapons[$side_number].{ITEM_VARIABLE}.strikes {VARIATION}}
)}
and this is what I was supposed to have put in....

Code: Select all

#define LA_DISPLAY_ITEM_OPTION IMAGE ITEM_VARIABLE MINIMUM_ITEM_COUNT TYPE RANGE VARIATION

#first: has and can equip
#todo: make the item show up differently if it is already equipped
#{IMAGE}

{LA_OPTION_IMAGE_SHOW_IF $la_weapons.{ITEM_VARIABLE}.image "($la_inventory[$side_number].{ITEM_VARIABLE})     <span color='#00FF00' weight='bold'>$la_weapons.{ITEM_VARIABLE}.name $la_weapons.{ITEM_VARIABLE}.damage_base-$la_weapons.{ITEM_VARIABLE}.strikes_base (Adjusted: $la_weapons[$side_number].{ITEM_VARIABLE}.damage-$la_weapons[$side_number].{ITEM_VARIABLE}.strikes) ($la_weapons.{ITEM_VARIABLE}.skill1.des-$la_weapons.{ITEM_VARIABLE}.skill2.des)</span>
<span color='#808080' size='xx-small'>DEFTNESS: $la_hero[$side_number].deft.level/$la_weapons.{ITEM_VARIABLE}.deft </span>
<span color='#808080' size='xx-small'>DEXTERITY: $la_hero[$side_number].dexterity.level/$la_weapons.{ITEM_VARIABLE}.dexterity </span>
<span color='#808080' size='xx-small'>MAGIC: $la_hero[$side_number].magic.level/$la_weapons.{ITEM_VARIABLE}.magic </span>
<span color='#808080' size='xx-small'>STRENGTH: $la_hero[$side_number].strength.level/$la_weapons.{ITEM_VARIABLE}.strength </span>" (
[not]
{VARIABLE_CONDITIONAL la_inventory[$side_number].equipped_{RANGE} equals {ITEM_VARIABLE}}
[/not]
{VARIABLE_CONDITIONAL la_inventory[$side_number].{ITEM_VARIABLE} greater_than_equal_to {MINIMUM_ITEM_COUNT}}
{VARIABLE_CONDITIONAL la_hero[$side_number].deft.level greater_than_equal_to $la_weapons.{ITEM_VARIABLE}.deft}
{VARIABLE_CONDITIONAL la_hero[$side_number].dexterity.level greater_than_equal_to $la_weapons.{ITEM_VARIABLE}.dexterity}
{VARIABLE_CONDITIONAL la_hero[$side_number].magic.level greater_than_equal_to $la_weapons.{ITEM_VARIABLE}.magic}
{VARIABLE_CONDITIONAL la_hero[$side_number].strength.level greater_than_equal_to $la_weapons.{ITEM_VARIABLE}.strength}
) ({LA_WEAPON_MATH {ITEM_VARIABLE} $la_weapons.{ITEM_VARIABLE}.skill1 la_weapons.{ITEM_VARIABLE}.skill2}
{VARIABLE la_inventory[$side_number].equipped_{RANGE} {ITEM_VARIABLE}}
{LA_EQUIP_ITEM $la_weapons.{ITEM_VARIABLE}.id ($la_weapons.{ITEM_VARIABLE}.name) ($la_weapons.{ITEM_VARIABLE}.image) {TYPE} {RANGE} $la_weapons[$side_number].{ITEM_VARIABLE}.damage $la_weapons[$side_number].{ITEM_VARIABLE}.strikes {VARIATION}}
)}
can you see the difference?
neither could I! from june of 2018 to today that code has been messed up and I never realized it until I tried to implement some quality of life changes as well as vastly improve much of the old code...

essentially on the

Code: Select all

{LA_EQUIP_ITEM $la_weapons.{ITEM_VARIABLE}.id ($la_weapons.{ITEM_VARIABLE}.name) ($la_weapons.{ITEM_VARIABLE}.image) {TYPE} {RANGE} $la_weapons[$side_number].{ITEM_VARIABLE}.damage $la_weapons[$side_number].{ITEM_VARIABLE}.strikes {VARIATION}}
)}
I put

Code: Select all

{VARIATION}
instead of

Code: Select all

 $la_weapons.{ITEM_VARIABLE}.id

Thank you for your response! I appreciate you trying to help!
- Been playing Wesnoth since 2004 and the 1.0.x versions.
- Creator of Undead Invasion MP Scenario Pack.
- Creator of Valeria MP Adventure

Post Reply