Option limit?

The place to post your WML questions and answers.

Moderator: Forum Moderators

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.
User avatar
LordAwsomeness
Posts: 203
Joined: August 12th, 2013, 2:20 pm
Location: U.S.A.

Option limit?

Post by LordAwsomeness »

Hello!
So I was just wondering if there is a limit to how many options ([option] tags) you can have in a message. Currently I have over 1000 from what im guessing and everytime I try and add another set of them, it doesn't allow me to do so.

each one of the macros below accounts for 16 [option] tags so its actually probably close to 200-300. so if theres a limit I would def need to know...

Code: Select all

#define LA_DISPLAY_WEAPONS


	{LA_OPTION_IMAGE "<span color='#808080' weight='bold'> Melee Weapons</span>" "icons/blank-icon.png" ()}
	
		
	{LA_DISPLAY_ITEM_OPTION "attacks/hammer-dwarven-runic.png" dwarf_magic_3 1 impact melee mace}
	{LA_DISPLAY_ITEM_OPTION "attacks/staff-elven.png" elf_magic_3 1 impact melee magestaff}
	{LA_DISPLAY_ITEM_OPTION "attacks/druidstaff.png" goblin_magic_3 1 impact melee magestaff}
	{LA_DISPLAY_ITEM_OPTION "attacks/staff-magic.png" human_magic_3 1 impact melee magestaff}
	{LA_DISPLAY_ITEM_OPTION "attacks/druidstaff.png" orc_magic_3 1 impact melee magestaff}
	{LA_DISPLAY_ITEM_OPTION "attacks/staff-green.png" saurian_magic_3 1 impact melee magestaff}
	{LA_DISPLAY_ITEM_OPTION "attacks/staff-ruby.png" troll_magic_3 1 impact melee magestaff}
	
	
	{LA_DISPLAY_ITEM_OPTION "attacks/axe.png" axe_1 1 blade melee axe}
	{LA_DISPLAY_ITEM_OPTION "attacks/axe.png" axe_2 1 blade melee axe}
	{LA_DISPLAY_ITEM_OPTION "attacks/axe.png" axe_3 1 blade melee axe}
	{LA_DISPLAY_ITEM_OPTION "attacks/axe.png" axe_4 1 blade melee axe}
	{LA_DISPLAY_ITEM_OPTION "attacks/axe.png" axe_5 1 blade melee axe}
	
	{LA_DISPLAY_ITEM_OPTION "attacks/battleaxe.png" battleaxe_1 1 blade melee axe}
	{LA_DISPLAY_ITEM_OPTION "attacks/battleaxe.png" battleaxe_2 1 blade melee axe}
	{LA_DISPLAY_ITEM_OPTION "attacks/battleaxe.png" battleaxe_3 1 blade melee axe}
	{LA_DISPLAY_ITEM_OPTION "attacks/battleaxe.png" battleaxe_4 1 blade melee axe}
	{LA_DISPLAY_ITEM_OPTION "attacks/battleaxe.png" battleaxe_5 1 blade melee axe}
	
	{LA_DISPLAY_ITEM_OPTION "attacks/club.png" club_1 1 impact melee mace}
	{LA_DISPLAY_ITEM_OPTION "attacks/club.png" club_2 1 impact melee mace}
	{LA_DISPLAY_ITEM_OPTION "attacks/club.png" club_3 1 impact melee mace}
	{LA_DISPLAY_ITEM_OPTION "attacks/club.png" club_4 1 impact melee mace}
	{LA_DISPLAY_ITEM_OPTION "attacks/club.png" club_5 1 impact melee mace}
		
	{LA_DISPLAY_ITEM_OPTION "attacks/dagger-human.png" dagger_1 1 blade melee dagger}
	{LA_DISPLAY_ITEM_OPTION "attacks/dagger-human.png" dagger_2 1 blade melee dagger}
	{LA_DISPLAY_ITEM_OPTION "attacks/dagger-human.png" dagger_3 1 blade melee dagger}
	{LA_DISPLAY_ITEM_OPTION "attacks/dagger-human.png" dagger_4 1 blade melee dagger}
	{LA_DISPLAY_ITEM_OPTION "attacks/dagger-human.png" dagger_5 1 blade melee dagger}
	
	{LA_DISPLAY_ITEM_OPTION "attacks/hammer.png" hammer_1 1 impact melee mace}
	{LA_DISPLAY_ITEM_OPTION "attacks/hammer.png" hammer_2 1 impact melee mace}
	{LA_DISPLAY_ITEM_OPTION "attacks/hammer.png" hammer_3 1 impact melee mace}
	{LA_DISPLAY_ITEM_OPTION "attacks/hammer.png" hammer_4 1 impact melee mace}
	{LA_DISPLAY_ITEM_OPTION "attacks/hammer.png" hammer_5 1 impact melee mace}
	
	{LA_DISPLAY_ITEM_OPTION "attacks/mace.png" mace_1 1 impact melee mace}
	{LA_DISPLAY_ITEM_OPTION "attacks/mace.png" mace_2 1 impact melee mace}
	{LA_DISPLAY_ITEM_OPTION "attacks/mace.png" mace_3 1 impact melee mace}
	{LA_DISPLAY_ITEM_OPTION "attacks/mace.png" mace_4 1 impact melee mace}
	{LA_DISPLAY_ITEM_OPTION "attacks/mace.png" mace_5 1 impact melee mace}
		
	{LA_DISPLAY_ITEM_OPTION "attacks/staff-magic.png" staff_1 1 impact melee magestaff}
	{LA_DISPLAY_ITEM_OPTION "attacks/staff-magic.png" staff_2 1 impact melee magestaff}
	{LA_DISPLAY_ITEM_OPTION "attacks/staff-magic.png" staff_3 1 impact melee magestaff}
	{LA_DISPLAY_ITEM_OPTION "attacks/staff-magic.png" staff_4 1 impact melee magestaff}
	{LA_DISPLAY_ITEM_OPTION "attacks/staff-magic.png" staff_5 1 impact melee magestaff}
	
	
	{LA_DISPLAY_ITEM_OPTION "attacks/spear.png" spear_1 1 pierce melee spear}
	{LA_DISPLAY_ITEM_OPTION "attacks/spear.png" spear_2 1 pierce melee spear}
	{LA_DISPLAY_ITEM_OPTION "attacks/spear.png" spear_3 1 pierce melee spear}
	{LA_DISPLAY_ITEM_OPTION "attacks/pike.png" spear_4 1 pierce melee spear}
	{LA_DISPLAY_ITEM_OPTION "attacks/halberd.png" spear_5 1 pierce melee spear}
	
#	{LA_DISPLAY_ITEM_OPTION "attacks/spear.png" pike_1 1 pierce melee spear}
#	{LA_DISPLAY_ITEM_OPTION "attacks/spear.png" pike_2 1 pierce melee spear}
#	{LA_DISPLAY_ITEM_OPTION "attacks/spear.png" pike_3 1 pierce melee spear}
#	{LA_DISPLAY_ITEM_OPTION "attacks/pike.png" pike_4 1 pierce melee spear}
#	{LA_DISPLAY_ITEM_OPTION "attacks/halberd.png" pike_5 1 pierce melee spear}
	
	{LA_DISPLAY_ITEM_OPTION "attacks/spear-orcish.png" small_spear_1 1 pierce melee spear}
	{LA_DISPLAY_ITEM_OPTION "attacks/spear-orcish.png" small_spear_2 1 pierce melee spear}
	{LA_DISPLAY_ITEM_OPTION "attacks/spear-orcish.png" small_spear_3 1 pierce melee spear}
	{LA_DISPLAY_ITEM_OPTION "attacks/spear-orcish.png" small_spear_4 1 pierce melee spear}
	{LA_DISPLAY_ITEM_OPTION "attacks/spear-orcish.png" small_spear_5 1 pierce melee spear}
	
	{LA_DISPLAY_ITEM_OPTION "attacks/sword-human.png" sword_1 1 blade melee sword}
	{LA_DISPLAY_ITEM_OPTION "attacks/sword-human.png" sword_2 1 blade melee sword}
	{LA_DISPLAY_ITEM_OPTION "attacks/sword-human.png" sword_3 1 blade melee sword}
	{LA_DISPLAY_ITEM_OPTION "attacks/sword-human.png" sword_4 1 blade melee sword}
	{LA_DISPLAY_ITEM_OPTION "attacks/sword-human.png" sword_5 1 blade melee sword}
	
	{LA_DISPLAY_ITEM_OPTION_RACE "attacks/warblade.png" warblade_1 1 blade melee warblade drake}
	{LA_DISPLAY_ITEM_OPTION_RACE "attacks/warblade.png" warblade_2 1 blade melee warblade drake}
	{LA_DISPLAY_ITEM_OPTION_RACE "attacks/warblade.png" warblade_3 1 blade melee warblade drake}
	{LA_DISPLAY_ITEM_OPTION_RACE "attacks/warblade.png" warblade_4 1 blade melee warblade drake}
	{LA_DISPLAY_ITEM_OPTION_RACE "attacks/warblade.png" warblade_5 1 blade melee warblade drake}
	
	{LA_DISPLAY_ITEM_OPTION "attacks/sword-elven.png" elf_sword_1 1 blade melee sword}
	{LA_DISPLAY_ITEM_OPTION "attacks/sword-elven.png" elf_sword_2 1 blade melee sword}
	{LA_DISPLAY_ITEM_OPTION "attacks/sword-elven.png" elf_sword_3 1 blade melee sword}
	{LA_DISPLAY_ITEM_OPTION "attacks/sword-elven.png" elf_sword_4 1 blade melee sword}
	{LA_DISPLAY_ITEM_OPTION "attacks/sword-elven.png" elf_sword_5 1 blade melee sword}
	
	{LA_DISPLAY_ITEM_OPTION "attacks/sword-orcish.png" orc_sword_1 1 blade melee sword}
	{LA_DISPLAY_ITEM_OPTION "attacks/sword-orcish.png" orc_sword_2 1 blade melee sword}
	{LA_DISPLAY_ITEM_OPTION "attacks/sword-orcish.png" orc_sword_3 1 blade melee sword}
	{LA_DISPLAY_ITEM_OPTION "attacks/sword-orcish.png" orc_sword_4 1 blade melee sword}
	{LA_DISPLAY_ITEM_OPTION "attacks/sword-orcish.png" orc_sword_5 1 blade melee sword}
	
	{LA_DISPLAY_ITEM_OPTION "attacks/torch.png" torch_1 1 fire melee staff}
	{LA_DISPLAY_ITEM_OPTION "attacks/torch.png" torch_2 1 fire melee staff}
	{LA_DISPLAY_ITEM_OPTION "attacks/torch.png" torch_3 1 fire melee staff}
	{LA_DISPLAY_ITEM_OPTION "attacks/torch.png" torch_4 1 fire melee staff}
	{LA_DISPLAY_ITEM_OPTION "attacks/torch.png" torch_5 1 fire melee staff}
	
	{LA_DISPLAY_ITEM_OPTION "attacks/sword-flaming.png" firesword_3 1 fire melee sword}
	{LA_DISPLAY_ITEM_OPTION "attacks/sword-flaming.png" firesword_4 1 fire melee sword}
	{LA_DISPLAY_ITEM_OPTION "attacks/sword-flaming.png" firesword_5 1 fire melee sword}
		
	{LA_DISPLAY_ITEM_OPTION "attacks/guinsoos-rageblade.png" guinsoos_4 1 fire melee sword}
		
	{LA_OPTION_IMAGE "<span color='#808080' weight='bold'> Ranged Weapons</span>" "icons/blank-icon.png" ()}

		
	{LA_DISPLAY_ITEM_OPTION "attacks/bow.png" bow_1 1 pierce ranged bow}
	{LA_DISPLAY_ITEM_OPTION "attacks/bow.png" bow_2 1 pierce ranged bow}
	{LA_DISPLAY_ITEM_OPTION "attacks/bow.png" bow_3 1 pierce ranged bow}
	{LA_DISPLAY_ITEM_OPTION "attacks/bow.png" bow_4 1 pierce ranged bow}
	{LA_DISPLAY_ITEM_OPTION "attacks/bow.png" bow_5 1 pierce ranged bow}
	
	{LA_DISPLAY_ITEM_OPTION "attacks/bow.png" short_bow_1 1 pierce ranged bow}
	{LA_DISPLAY_ITEM_OPTION "attacks/bow.png" short_bow_2 1 pierce ranged bow}
	{LA_DISPLAY_ITEM_OPTION "attacks/bow.png" short_bow_3 1 pierce ranged bow}
	{LA_DISPLAY_ITEM_OPTION "attacks/bow.png" short_bow_4 1 pierce ranged bow}
	{LA_DISPLAY_ITEM_OPTION "attacks/bow.png" short_bow_5 1 pierce ranged bow}
	
	{LA_DISPLAY_ITEM_OPTION "attacks/fire-blast.png" firebow_3 1 fire ranged bow}
	{LA_DISPLAY_ITEM_OPTION "attacks/fire-blast.png" firebow_4 1 fire ranged bow}
	{LA_DISPLAY_ITEM_OPTION "attacks/fire-blast.png" firebow_5 1 fire ranged bow}
	
#	{LA_DISPLAY_ITEM_OPTION "attacks/bolas.png" bolas_1 1 impact ranged lob}
#	{LA_DISPLAY_ITEM_OPTION "attacks/bolas.png" bolas_2 1 impact ranged lob}
#	{LA_DISPLAY_ITEM_OPTION "attacks/bolas.png" bolas_3 1 impact ranged lob}
#	{LA_DISPLAY_ITEM_OPTION "attacks/bolas.png" bolas_4 1 impact ranged lob}
#	{LA_DISPLAY_ITEM_OPTION "attacks/bolas.png" bolas_5 1 impact ranged lob}

#	{LA_DISPLAY_ITEM_OPTION "attacks/net.png" bola_1 1 impact ranged lob}
#	{LA_DISPLAY_ITEM_OPTION "attacks/net.png" bola_2 1 impact ranged lob}
#	{LA_DISPLAY_ITEM_OPTION "attacks/net.png" bola_3 1 impact ranged lob}
#	{LA_DISPLAY_ITEM_OPTION "attacks/net.png" bola_4 1 impact ranged lob}
# 	{LA_DISPLAY_ITEM_OPTION "attacks/net.png" bola_5 1 impact ranged lob}
	
#	{LA_DISPLAY_ITEM_OPTION "attacks/net.png" chakram_1 1 blade ranged lob}
	
	{LA_DISPLAY_ITEM_OPTION "attacks/net.png" net_1 1 impact ranged lob}
	{LA_DISPLAY_ITEM_OPTION "attacks/net.png" net_2 1 impact ranged lob}
	{LA_DISPLAY_ITEM_OPTION "attacks/net.png" net_3 1 impact ranged lob}
	{LA_DISPLAY_ITEM_OPTION "attacks/net.png" net_4 1 impact ranged lob}
	{LA_DISPLAY_ITEM_OPTION "attacks/net.png" net_5 1 impact ranged lob}

	{LA_DISPLAY_ITEM_OPTION "attacks/crossbow-iron.png" crossbow_1 1 pierce ranged crossbow}
	{LA_DISPLAY_ITEM_OPTION "attacks/crossbow-iron.png" crossbow_2 1 pierce ranged crossbow}
	{LA_DISPLAY_ITEM_OPTION "attacks/crossbow-iron.png" crossbow_3 1 pierce ranged crossbow}
	{LA_DISPLAY_ITEM_OPTION "attacks/crossbow-iron.png" crossbow_4 1 pierce ranged crossbow}
	{LA_DISPLAY_ITEM_OPTION "attacks/crossbow-iron.png" crossbow_5 1 pierce ranged crossbow}
	
	{LA_DISPLAY_ITEM_OPTION "attacks/slingshot.png" sling_1 1 impact ranged lob}
	{LA_DISPLAY_ITEM_OPTION "attacks/slingshot.png" sling_2 1 impact ranged lob}
	{LA_DISPLAY_ITEM_OPTION "attacks/slingshot.png" sling_3 1 impact ranged lob}
	{LA_DISPLAY_ITEM_OPTION "attacks/slingshot.png" sling_4 1 impact ranged lob}
	{LA_DISPLAY_ITEM_OPTION "attacks/slingshot.png" sling_5 1 impact ranged lob}
	
	{LA_DISPLAY_ITEM_OPTION "attacks/sling.png" heavy_sling_1 1 impact ranged lob}
	{LA_DISPLAY_ITEM_OPTION "attacks/sling.png" heavy_sling_2 1 impact ranged lob}
	{LA_DISPLAY_ITEM_OPTION "attacks/sling.png" heavy_sling_3 1 impact ranged lob}
	{LA_DISPLAY_ITEM_OPTION "attacks/sling.png" heavy_sling_4 1 impact ranged lob}
	{LA_DISPLAY_ITEM_OPTION "attacks/sling.png" heavy_sling_5 1 impact ranged lob}

	{LA_DISPLAY_ITEM_OPTION "attacks/dagger-thrown-human.png" throwing_knives_1 1 blade ranged thrown-light-blade}	
	{LA_DISPLAY_ITEM_OPTION "attacks/dagger-thrown-human.png" throwing_knives_2 1 blade ranged thrown-light-blade}
	{LA_DISPLAY_ITEM_OPTION "attacks/dagger-thrown-human.png" throwing_knives_3 1 blade ranged thrown-light-blade}
	{LA_DISPLAY_ITEM_OPTION "attacks/dagger-thrown-human.png" throwing_knives_4 1 blade ranged thrown-light-blade}
	{LA_DISPLAY_ITEM_OPTION "attacks/dagger-thrown-human.png" throwing_knives_5 1 blade ranged thrown-light-blade}
	
	{LA_DISPLAY_ITEM_OPTION "attacks/hatchet.png" throwing_hatchet_1 1 blade ranged thrown-light-blade}	
	{LA_DISPLAY_ITEM_OPTION "attacks/hatchet.png" throwing_hatchet_2 1 blade ranged thrown-light-blade}
	{LA_DISPLAY_ITEM_OPTION "attacks/hatchet.png" throwing_hatchet_3 1 blade ranged thrown-light-blade}
	{LA_DISPLAY_ITEM_OPTION "attacks/hatchet.png" throwing_hatchet_4 1 blade ranged thrown-light-blade}
	{LA_DISPLAY_ITEM_OPTION "attacks/hatchet.png" throwing_hatchet_5 1 blade ranged thrown-light-blade}

	{LA_DISPLAY_ITEM_OPTION "attacks/thunderstick.png" thunderstick_1 1 pierce ranged thunderstick}
	{LA_DISPLAY_ITEM_OPTION "attacks/thunderstick.png" thunderstick_2 1 pierce ranged thunderstick}
	{LA_DISPLAY_ITEM_OPTION "attacks/thunderstick.png" thunderstick_3 1 pierce ranged thunderstick}
	{LA_DISPLAY_ITEM_OPTION "attacks/dragonstaff.png" thunderstick_4 1 pierce ranged thunderstick}
	{LA_DISPLAY_ITEM_OPTION "attacks/dragonstaff.png" thunderstick_5 1 pierce ranged thunderstick}
	
	{LA_DISPLAY_ITEM_OPTION "attacks/repeater.png" repeater_1 1 pierce ranged thunderstick}
	{LA_DISPLAY_ITEM_OPTION "attacks/repeater.png" repeater_2 1 pierce ranged thunderstick}
	{LA_DISPLAY_ITEM_OPTION "attacks/repeater.png" repeater_3 1 pierce ranged thunderstick}
	{LA_DISPLAY_ITEM_OPTION "attacks/repeater.png" repeater_4 1 pierce ranged thunderstick}
	{LA_DISPLAY_ITEM_OPTION "attacks/repeater.png" repeater_5 1 pierce ranged thunderstick}
		
#enddef
- Been playing Wesnoth since 2004 and the 1.0.x versions.
- Creator of Undead Invasion MP Scenario Pack.
- Creator of Valeria MP Adventure
- Creator of LA_RPG ERA
User avatar
octalot
General Code Maintainer
Posts: 786
Joined: July 17th, 2010, 7:40 pm
Location: Austria

Re: Option limit?

Post by octalot »

Without checking the code, I'd guess the limit is when the rich-text area for the message reaches 65535 pixels high (and hits the 16-bit limits of Pango's interface). If they're all displayed at the same time, that's probably beyond the player's patience to scroll through too.

However, if they're not all meant to be displayed at the same time, redesigning this is probably the key to your optimization problems - macros get expanded by the preprocessor, so the engine is going to see 1000 separate copies of the same logic. Splitting it in to submenus* would help both the engine and the player cope with the number of options. Redesigning it to use a single copy of the code with a [for] or [foreach] and [insert_tag] would probably solve a lot of your optimisation problems.

* this submenus trick is how SXC currently works, although that code itself could do with refactoring
User avatar
LordAwsomeness
Posts: 203
Joined: August 12th, 2013, 2:20 pm
Location: U.S.A.

Re: Option limit?

Post by LordAwsomeness »

octalot wrote: March 1st, 2020, 8:29 am Without checking the code, I'd guess the limit is when the rich-text area for the message reaches 65535 pixels high (and hits the 16-bit limits of Pango's interface). If they're all displayed at the same time, that's probably beyond the player's patience to scroll through too.
Dont worry it only shows 1 of the 16 at a time. the only reason there is 16 is because there are 3 criteria that must be met in order for a weapon to be able equipped: the weapon must not currently be equipped, the weapon must meet all of the stat requirements to equip the weapon (Strength, Dexterity, Deftness, Magic), and finally the character must not have another weapon of the same range equipped. if one of the criteria (or a combination) are not met, then the exact option will pop up to show you in red text exactly what criteria the player is missing so that they can easily go and fix it if they have the means to do so. I did this in order to make the game more noob friendly since the add-on as a whole can get a bit complicated.
octalot wrote: March 1st, 2020, 8:29 am However, if they're not all meant to be displayed at the same time, redesigning this is probably the key to your optimization problems - macros get expanded by the preprocessor, so the engine is going to see 1000 separate copies of the same logic. Splitting it in to submenus* would help both the engine and the player cope with the number of options. Redesigning it to use a single copy of the code with a [for] or [foreach] and [insert_tag] would probably solve a lot of your optimisation problems.

* this submenus trick is how SXC currently works, although that code itself could do with refactoring
Im currently experimenting with splitting the menu in half by turning them into 2 submenus: one for all melee weapons, one for all ranged weapons.
I dont understand how the foreach would work. ive never seen the code for that so I wouldn't know how to make it myself. ive learned wml over the last decade and a half from checking add-ons or campaigns ive played and seeing how it works and replicating it and adding my own spin to it. so I would have to see how it works with somebody else's add-on to figure it out.

I think that's why ive never learned lua; just not enough code or add-ons that I myself have played that incorporates it. I would love to learn it however because I recognize the infinite possibilities it brings to the table; I just need to figure it out still...
- Been playing Wesnoth since 2004 and the 1.0.x versions.
- Creator of Undead Invasion MP Scenario Pack.
- Creator of Valeria MP Adventure
- Creator of LA_RPG ERA
User avatar
Ravana
Forum Moderator
Posts: 3000
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Option limit?

Post by Ravana »

https://github.com/ProditorMagnus/Hide_ ... fg#L41-L61 is most basic case of [insert_tag] I can show.

[set_variables] creates array containing key "message" - display for option. Then loop adds [command][set_variable] with "name" and "value" as what happens if the option is selected, and then message is created with insert_tag.
User avatar
LordAwsomeness
Posts: 203
Joined: August 12th, 2013, 2:20 pm
Location: U.S.A.

Re: Option limit?

Post by LordAwsomeness »

Ravana wrote: March 1st, 2020, 5:17 pm https://github.com/ProditorMagnus/Hide_ ... fg#L41-L61 is most basic case of [insert_tag] I can show.

[set_variables] creates array containing key "message" - display for option. Then loop adds [command][set_variable] with "name" and "value" as what happens if the option is selected, and then message is created with insert_tag.
im definitely going to try and figure this out. however I think theres an even bigger issue for my add-on until I figure that out... im actually starting to wonder if there's a hard limit to how many macros or [option](s) that are able to be used in a scenario because everytime I create a new [option] I get a bug or wesnoth crashes when loading into the multiplayer lobby...

EDIT: yea I dont really understand that. I think I have a basic idea of what it's trying to do, but how to I limit what options show up such as with [show_if] and then give commands [command]?

SECOND EDIT: is there perhaps a chance that the engine will only read so much data from one file? the file where im having the most issues is obscenely large and filled with so much text. would it possibly work if I split the file? I have no idea why it would work like that considering wesnoth loads better if its all stored in one file though, but it's a shot in the dark. currently im desperate to fix this issue because without a fix, I cannot even add new weapons to my add-on and im limited to the 35ish that are currently coded in...
- Been playing Wesnoth since 2004 and the 1.0.x versions.
- Creator of Undead Invasion MP Scenario Pack.
- Creator of Valeria MP Adventure
- Creator of LA_RPG ERA
User avatar
Ravana
Forum Moderator
Posts: 3000
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Option limit?

Post by Ravana »

For show_if you can check the condition inside loop, to decide if such option should be added. For simple commands like one set_variable in my example you can set each key this way, for larger commands I think it is possible to add it as another [set_variables] block.

20MB wml file works correctly at least.
User avatar
LordAwsomeness
Posts: 203
Joined: August 12th, 2013, 2:20 pm
Location: U.S.A.

Re: Option limit?

Post by LordAwsomeness »

Ok some weird stuff is going on... I do a little something to test and see if stuff is working; ill make one very small change and see if it fixes the crash. then ill go onto the next minor change and see how the game reacts. its a very long and tedious process of going to the cfg, making such a small change, going to the main menu, pressing f5, going to the multiplayer lobby and making sure that it doesn't crash. you get the picture.
However something weird is going on. I will be doing that, cause a crash from code that should be working without the shadow of a doubt and then it will crash the game. ill add a space to the file at a designated spot and f5 it so that the wesnoth engine knows there's a change and that it can reload the add-on and yet the second time where I didn't even affect any of the code whatsoever will end up working. then for good measure I will remove that space or add a new one, refresh it, and then go to the multiplayer lobby again to see if there's any issues and yet again without affecting any of the code it will decide to either crash or tell me there's a bug even though I didn't even affect any of the code! I dont understand what the issue is however I dont ever remember this happening around 1.14.8ish. I dont know if it's something different with the engine or how it reads stuff with the last couple of updates but recently ive been having this issue. one workaround ive found is closing wesnoth altogether, adding a space somewhere so that the engine knows there's been a change so that it knows to try and load my add-on again, and then it will usually work.

As I said this never happened before 1.14.8 to my recollection. Do you have any idea whats going on with that?

EDIT: Also my current dilemma is so strange; I will try and add images to an [option] and it will crash the game. so I will remove the images from the [option] and it works. so ill try to add the image again and it crashes wesnoth once again. this is crazy because ive used the same macro 100s of times and never had an issue. here's the code:

Code: Select all

#define LA_MENU_WEAPONS
#	{LA_WEAPON_LIST}
	{LA_WEAPONS_CALCULATIONS2}
	{VARIABLE finished.weapons no}
	[while]
	{VARIABLE_CONDITIONAL finished.weapons equals no}
	[do]
	[message]
	speaker=narrator
	message= _ {LA_HERO_INVENTORY_STATS_MESSAGE}
	{LA_OPTION_IMAGE "Back" "icons/check.png" ({VARIABLE finished.weapons yes})}
	{LA_OPTION_IMAGE "Melee Weapons" "#####THE IMAGE WOULD GO HERE#####" (
	{VARIABLE finished.weapons.melee no}
	[while]
	{VARIABLE_CONDITIONAL finished.weapons.melee equals no}
	[do]
	[message]
	speaker=narrator
	message= _ {LA_HERO_INVENTORY_STATS_MESSAGE}
	{LA_OPTION_IMAGE "Back" "icons/check.png" ({VARIABLE finished.weapons.melee yes})}
	{LA_DISPLAY_WEAPONS_MELEE}
	[/message]
	[/do]
	[/while]
	)}
	
	{LA_OPTION_IMAGE "Ranged Weapons" "#####THE IMAGE WOULD GO HERE#####" (
	{VARIABLE finished.weapons.ranged no}
	[while]
	{VARIABLE_CONDITIONAL finished.weapons.ranged equals no}
	[do]
	[message]
	speaker=narrator
	message= _ {LA_HERO_INVENTORY_STATS_MESSAGE}
	{LA_OPTION_IMAGE "Back" "icons/check.png" ({VARIABLE finished.weapons.ranged yes})}
	{LA_DISPLAY_WEAPONS_RANGED}
	[/message]
	[/do]
	[/while]
	)}
#	{LA_DISPLAY_WEAPONS} 
	
	[/message]
	[/do]
	[/while]
#enddef
the locations in the code are marked with all caps "THE IMAGE WOULD GO HERE". its the same macro working with an image several times in this macro but both of those instances that im trying to use it again it crashes the game. I genuinely dont understand
Last edited by LordAwsomeness on March 1st, 2020, 6:12 pm, edited 2 times in total.
- Been playing Wesnoth since 2004 and the 1.0.x versions.
- Creator of Undead Invasion MP Scenario Pack.
- Creator of Valeria MP Adventure
- Creator of LA_RPG ERA
User avatar
Pentarctagon
Project Manager
Posts: 5564
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Option limit?

Post by Pentarctagon »

Does the error occur if you clear the cache between each attempt?
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
User avatar
LordAwsomeness
Posts: 203
Joined: August 12th, 2013, 2:20 pm
Location: U.S.A.

Re: Option limit?

Post by LordAwsomeness »

Pentarctagon wrote: March 1st, 2020, 6:08 pm Does the error occur if you clear the cache between each attempt?
yes and no. that's the weird thing. sometimes it does and some times it doesn't. sometimes it will let me get all of the way into the game and then one of my menus just wont work. that's why Im so desperate to fix it because that specific menu is a core part of the game.
also please review the edit I made to the previous post while I was doing more testing and waiting for you to respond.

EDIT: It just did it a again!! I just edited the images, it crashed. removed them it worked. added them again and it worked this time. I dont understand. even if I put the wrong images in, it wouldn't cause the game to crash, it would simply show the image is missing icon or just not show any image there. I am so confused...
Last edited by LordAwsomeness on March 1st, 2020, 6:14 pm, edited 1 time in total.
- Been playing Wesnoth since 2004 and the 1.0.x versions.
- Creator of Undead Invasion MP Scenario Pack.
- Creator of Valeria MP Adventure
- Creator of LA_RPG ERA
User avatar
Pentarctagon
Project Manager
Posts: 5564
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Option limit?

Post by Pentarctagon »

Could you upload your add-on somewhere? I can see if it will crash for me as well.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
User avatar
LordAwsomeness
Posts: 203
Joined: August 12th, 2013, 2:20 pm
Location: U.S.A.

Re: Option limit?

Post by LordAwsomeness »

Pentarctagon wrote: March 1st, 2020, 6:14 pm Could you upload your add-on somewhere? I can see if it will crash for me as well.
https://drive.google.com/file/d/1oxlREG ... sp=sharing

its in a zip file for you. I think it will still allow you to download it

EDIT: im starting to think every time I make a change to files that I need to just close wesnoth and open it again because every change I make bugs or crashes the game when I try to f5 reload it. however when I restart wesnoth altogether it works fine.
Also I have a little example of what exactly you can change in the files really quick just so you can see what it does to me. cause I loaded it, it worked perfectly fine. I made a couple of small changes, it crashed. I added a space, started up wesnoth again and it works perfectly again.

SECOND EDIT: Also I was testing some changes I made to the scenario and I kept reloading a save from turn 1, but on the 4th or 5th reload it said there was a bug and it sent me back to the main menu. Idk why it loaded fine the first 4-5 times and then it was broken
- Been playing Wesnoth since 2004 and the 1.0.x versions.
- Creator of Undead Invasion MP Scenario Pack.
- Creator of Valeria MP Adventure
- Creator of LA_RPG ERA
User avatar
Pentarctagon
Project Manager
Posts: 5564
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Option limit?

Post by Pentarctagon »

So, a few things:
1) Any and every issue you have with save file size, loading times, etc is because the preprocessed output of your add-on creates a cache entry that (when decompressed) is over 68 MBs of just text. There isn't any sort of absolute limit on how big that can end up being, but that's still pretty huge.
2) What are the specific steps you do to reproduce this? Just keep repeating making some small modification > reload > go to the MP lobby?
3) What is the text of the error messages you see?
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
User avatar
Ravana
Forum Moderator
Posts: 3000
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Option limit?

Post by Ravana »

I tried to load this addon, and got "Ran out of memory. Aborted."

What I did see already was several cases of

Code: Select all

20200301 20:53:19 warning preprocessor: Redefining macro UNIT_SPAWN_GUARD without explicit #undef at ~add-ons/LA_MP_Pack/macros/misc.cfg:57
    included from ~add-ons/LA_MP_Pack/utils/paths.cfg:2
    included from ~add-ons/LA_MP_Pack/LA_RPG_Era.cfg:77
    included from LA_MP_Pack/_main.cfg:9
    included from ~add-ons/LA_MP_Pack/LA_RPG_Era.cfg:79
    included from LA_MP_Pack/_main.cfg:9
previously defined at ~add-ons/LA_MP_Pack/macros/misc.cfg:18
    included from ~add-ons/LA_MP_Pack/utils/paths.cfg:2
    included from ~add-ons/LA_MP_Pack/LA_RPG_Era.cfg:77
    included from LA_MP_Pack/_main.cfg:9
    included from ~add-ons/LA_MP_Pack/LA_RPG_Era.cfg:79
    included from LA_MP_Pack/_main.cfg:9
User avatar
LordAwsomeness
Posts: 203
Joined: August 12th, 2013, 2:20 pm
Location: U.S.A.

Re: Option limit?

Post by LordAwsomeness »

Ravana wrote: March 1st, 2020, 6:59 pm I tried to load this addon, and got "Ran out of memory. Aborted."

What I did see already was several cases of

Code: Select all

20200301 20:53:19 warning preprocessor: Redefining macro UNIT_SPAWN_GUARD without explicit #undef at ~add-ons/LA_MP_Pack/macros/misc.cfg:57
    included from ~add-ons/LA_MP_Pack/utils/paths.cfg:2
    included from ~add-ons/LA_MP_Pack/LA_RPG_Era.cfg:77
    included from LA_MP_Pack/_main.cfg:9
    included from ~add-ons/LA_MP_Pack/LA_RPG_Era.cfg:79
    included from LA_MP_Pack/_main.cfg:9
previously defined at ~add-ons/LA_MP_Pack/macros/misc.cfg:18
    included from ~add-ons/LA_MP_Pack/utils/paths.cfg:2
    included from ~add-ons/LA_MP_Pack/LA_RPG_Era.cfg:77
    included from LA_MP_Pack/_main.cfg:9
    included from ~add-ons/LA_MP_Pack/LA_RPG_Era.cfg:79
    included from LA_MP_Pack/_main.cfg:9
hmm what are you thoughts on what I should do? As well as what do you think is causing this?
- Been playing Wesnoth since 2004 and the 1.0.x versions.
- Creator of Undead Invasion MP Scenario Pack.
- Creator of Valeria MP Adventure
- Creator of LA_RPG ERA
User avatar
Ravana
Forum Moderator
Posts: 3000
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Option limit?

Post by Ravana »

Too many too large too nested macros.

When you have the 68MB file you can check what parts take most space there, and then try to optimize/rewrite that part.
Post Reply