if ( getActiveMenuMode == 1003 ) let tempFloat := getMenuFloatValue "stat_layout\stat_background\stat_p1\ObXP_level_marker\_value_scrolled_to" 1003 if ( tempFloat > 0 ) set pgold to (player.getlevel + 1) * (player.getlevel + 1) * 25 if player.getitemcount gold001 >= pgold player.removeitem gold001 pgold setMenuFloatValue "stat_layout\stat_background\stat_p1\ObXP_layout\_levelprogress" 1003 10 let ObXPSettings.showLevelUp := 1 CloseAllMenus else messagebox "You need %.0f gold to level up!", pgold ; here I tried several things to make the messagebox appear only once and still keep the level up button intact endif endifendif
If the player has enough gold everything works fine. The gold is removed and the level up menu appears. But if he doesn't have enough gold the script doesn't work as expected. No matter what I do, either the messagebox gets stuck in a loop (if you press 'ok' it immediately pops up again) or the level up button ceases to work another time once the message box came up, which means you can't level up anymore. I tried the following:
1. set tempFloat to 0 after the messagebox. Doesn't work, it seems there is a variable set inside the xml file when you click on the button and when the script runs the next time tempFloat is immediately set to > 0.
so I thought I could maybe add this after the messagebox instead...
2. setMenuFloatValue "stat_layout\stat_background\stat_p1\ObXP_level_marker\_value_scrolled_to" 1003 0
That gets rid of the messagebox problem (it comes up once only), but afterwards clicking on the level up button does nothing. I think this is the correct approach (setting a variable in the xml file to the correct value), but I have no idea which variable\value is the correct one.
So I downloaded an xml editor and opened the xml file. I found the parts that the script points to, but I can't see any variables there or anything that makes sense to me. I also looked through the xml file and scripts to find the trigger for the level up button, but no luck. Here is the part of the xml file that the script utilizes:
&generic; &false; 1 1 0 0 <_value_scrolled_to>1 99 1 100 0 1 3
Does anyone have an idea how to keep the button intact and still have the messagebox pop up once only each time you click on the button.?