Jump to content

Replacing Icon MenuQue


Recommended Posts

I have been trying to set this up for a day now and I just can't seem to get it running. I tried several variations some of which don't replace the icon at all and the others only replaced the icon once but refused to do it again when loading another savegame. I have a mod in the works right now and I am about 80% done but this "easy" task has consumed 30% of my time already and it even puts my whole project at risk. I just don't understand whats wrong? Here is my code:

scn aaManagerScript

string_var locked
string_var popupico1

begin gamemode

	if ( getgamerestarted )
		insertxml "aachievements\dashboard.xml" 1002
		let locked := "menus\aachievements\icon_locked_ach.dds"
		let popupico1 := "menus\icons\quest\icon_amulet_of_king.dds"
	endif
	
	if ( getstagedone MQ01 90 && getmenustringvalue "dashach1\filename|%z" locked 1002 )
		setmenustringvalue "dashach1\filename|%z" popupico1
	endif
	if ( getstage MQ01 < 90 && getmenustringvalue "dashach1\filename|%z" popupico1 1002 )
		setmenustringvalue "dashach1\filename|%z" locked
	endif

end

 

 

Link to comment
Share on other sites

I used MenuQue functions only once, but peeking at documentation of version 16b which I have, there is no "GetMenuStringValue" and "SetMenuStringValue" functions even mentioned. I was only able to locate "tile_GetString" and "tile_SetString" functions.

Edited by RomanR
Link to comment
Share on other sites

I used MenuQue functions only once, but peeking at documentation of version 16b which I have, there is no "GetMenuStringValue" and "SetMenuStringValue" functions even mentioned. I was only able to locate "tile_GetString" and "tile_SetString" functions.

Thank you for your reply. Those functions are actually OBSE commands I only mentioned MenuQue because I am doing some XML work and it's an OBSE plugin anyways.

Link to comment
Share on other sites

Your GetMenuStringValue conditions are wrong. If I'm understanding right what you're trying to do it should be:

(GetMenuStringValue "dashach1\filename" 1002 ) == locked

IIRC, you also need to use eval to compare strings, so your final condition should be something like

if GetStageDone MQ90 90
  if eval (GetMenuStringValue "dashach1\filename" 1002) == locked
    *do stuff*
  endif
endif

 

Link to comment
Share on other sites

Your GetMenuStringValue conditions are wrong. If I'm understanding right what you're trying to do it should be:

(GetMenuStringValue "dashach1\filename" 1002 ) == locked

IIRC, you also need to use eval to compare strings, so your final condition should be something like

if GetStageDone MQ90 90
  if eval (GetMenuStringValue "dashach1\filename" 1002) == locked
    *do stuff*
  endif
endif

Thanks for the info but I tried it without eval and it only worked when using "setmenustringvalue "dashach1\filename" popupico1 1002" that's why I went with it. Your version seems to work aswell ( maybe it's better to do it your way ) but the problem really seems to be the "setmenustringvalue". It just sets the icon once but upon loading a save it just stays the same, although the condition changed.

 

Edited by cookiedoughnexus
Link to comment
Share on other sites

That sounds more like a logic error in your script conditions, rather than a problem with function. Can you post the full script that you're currently using and also tell which saves you're loading (which stage of the quest they are on)?

Link to comment
Share on other sites

That sounds more like a logic error in your script conditions, rather than a problem with function. Can you post the full script that you're currently using and also tell which saves you're loading (which stage of the quest they are on)?

Just to make sure nothing comes in the way I created a new project with this script attached to a quest:

scn UIPInitQuestScript

string_var ico1
string_var ico2

begin gamemode
    if ( getgamerestarted )
        insertxml "UIP\Playground1.xml" 1002
        let ico1 := "Menus\Icons\Quest\icon_miscellaneous.dds"
        let ico2 := "Menus\Icons\Quest\icon_amulet_of_king.dds"
    endif

    if ( getstagedone MQ01 90 )
        if eval (GetMenuStringValue "test1\filename" 1002) == ico2
            message "Trophy"
            setmenustringvalue "test1\filename|%z", ico1, 1002
        endif
    endif
    if ( getstage MQ01 < 90 )
        if eval (GetMenuStringValue "test1\filename" 1002) == ico1
            message "Amulet"
            setmenustringvalue "test1\filename|%z", ico2, 1002
        endif
    endif
end

This is my XML file:

	<image name="test1">
			<locus> &true; </locus>
			<target> &true; </target>
			<visible>&true;</visible>
			<filename>Menus\Icons\Quest\icon_amulet_of_king.dds</filename>
			<zoom> 100 </zoom>
			<depth> 110 </depth>
			<width> 64 </width>
			<height> 64 </height>
			<x> 400 </x>
			<y> 350 </y>
			
	</image>

I have a savegame with 300 hours of gameplay and the main quest done, which I load first. The game sets the icon to the trophy just as expected but once I load my savegame, inside the catacombs following the Emperor, it won't set it to the Amulet of Kings.

Edited by cookiedoughnexus
Link to comment
Share on other sites

I think I see where the problem is. Your string variables are set in GetGameRestarted block, which only runs once per game session. Once you load a different save (one where script hasn't initialized before) variables would be 0 and both conditions would not be true.
Link to comment
Share on other sites

I think I see where the problem is. Your string variables are set in GetGameRestarted block, which only runs once per game session. Once you load a different save (one where script hasn't initialized before) variables would be 0 and both conditions would not be true.

That's it! I knew it would be painfully obvious :laugh: Thank you so much! Saved the project and my sanity.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...