Jump to content

Question: Combining multiple MCM Menus


Recommended Posts

Hey,

 

I'm pretty new to Papyrus Scripting and I would like to make my first mcm menu.

Since my script with the amount of features I want to implement, is getting quite crowded,

(the mod would probably fit in one script, but that would be thousands of lines of code, so I would rather split it into about 2000 lines of code per page)

my idea was to make one script per mcm page, now my questions are:

How do I do that? Has anyone tried that before? Is it even possible?

I'm running out of options, so I'm asking you guys here on the forum, in the hope you can help me :3

 

Regards qotsafan

Link to comment
Share on other sites

I know that you cannot have multiple scripts with the same events, that just makes two whole mod entries rather than controlling separate pages.

 

You might be able to put some stuff into functions on a second or third script and shorten the amount of code in the main script, but that all depends on how you write it up I suppose.

Link to comment
Share on other sites

Thanks for the quick response :3

 

Hmm yeah, I figured as much, so I stopped the project for now (it was a bit insane anyway) and scaled it down a bit, so I do not need to make multiple scripts.

I would have continued it, if it were possible though.

 

I also made a script that contains functions declared as "global", didn't find another way that doesn't give me headaches ^^, but it's only a small part of the main script.

I'm also not quite sure how to handle multiple scripts, adding them to the scripts tab or alias tab or make a whole new quest (which I guess is wrong :3)

Didn't find a good tutorial about that :3

 

Despite all that, my scripts seem to work, so I'm not complaining, thanks for the help anyway.

If anyone cares, I can post the scripts once I'm done :3

 

Regards qotsafan

Link to comment
Share on other sites

I literally just tested this.

You can have multiple MCM menus.

Each needs to be uniquely named and contained in it's own quest.

Link to comment
Share on other sites

Multiple MCM menus yes, but not individual pages controlled by separate scripts. I understood the OP as wanting all options on Page 1 to be controlled by one script, all options on Page 2 to be controlled by another script, etc. etc...

Link to comment
Share on other sites

Exactly, since I read somewhere, that there is a limit to how many mcm menus you can load.

I could make multiple mcm menus, but that would be counter-productive :3

 

Oh and btw, does one of you two (or anyone else) know how I can get the name of an object in a FormList?

The SKSE function GetName() doesn't seem to work, I always get back a null String.

 

Example:

 

String[] function SetOutfitMenu()
String[] Menu = new String[128]
Menu[0] = "$No Option"
int i = 0
while (i < 127)
Menu[(i+1)] = (OutfitFormList.GetAt(i).GetName() as String)
i += 1
endwhile
return Menu
endFunction

That doesn't seem to work (you may call me lazy, but I'm not fond of making hand-made String Arrays of the size of 128 entries ^^).

 

Regards qotsafan

Link to comment
Share on other sites

I've done similar.

Here is my function block so you can see what is happening

 

 

Function GetStoredBolts()
	Int ALsize = AmmoListBolt.GetSize()
	Int X = 0
	Int Z = 1
	While X < 128 && Z <= 127
		If X < ALsize
			Ammo Entry = AmmoListBolt.GetAt(X) as Ammo
			Int Num = ArrowQuiver.GetItemCount(Entry)
			Int Num2 = PlayerRef.GetItemcount(Entry)
			Num = Num + Num2
			String EntryName = Entry.GetName()+" <"+Num+">"
			BoltOrder[Z] = "$Ammo{"+EntryName+"}"
		Else
			BoltOrder[Z] = "NONE"
		EndIf
		X += 1
		Z += 1
	EndWhile
EndFunction
 

The matching translation file entry

$Ammo{}	{} 

End Result for example:

Dwarven Bolt <10>

Steel Bolt <200>

 

 

Link to comment
Share on other sites

Hmm, when I think about it, that seems to work for "ammunition", since it actually has a "Full Name" entry, which an "outfit" doesn't and it seems it can't "Get" the EditorID, just my luck :3

There also seems to be no GetBaseOutfit function for NPCs (while GetDefaultSleepOutfit, which is called GetOutfit, exists...), which is unfortunate too :3

Link to comment
Share on other sites

GetOutfit will return the default outfit or the sleep outfit

 

GetOutfit(true) is used for getting the sleep outfit

GetOutfit(false) is used for getting the default outfit

GetOutfit() can also be used for getting the default outfit

 

Note, I've not used the function before. That is just what I understand from reading the documentation.

Link to comment
Share on other sites

Oh... I seem to not have read the "or" thanks lol, I will try it out an tell the results :3

 

Edit: Yes, it works perfectly, thank you so much ^^

 

My test example (it's only a part of the functions):

 

 

function SetTargetActor()
	if CrosshairRef != none
		TargetRef = CrosshairRef
		TargetOutfit = TargetRef.GetActorBase().GetOutfit() as Outfit
	endif
endFunction

function SetTargetOutfit(Actor akTargetActor, Outfit akOutfit)
    if (akTargetActor != none)
        akTargetActor.SetOutfit(akOutfit)
        akTargetActor.GetActorBase().SetOutfit(akOutfit)
    endif
    return
endFunction

event OnOptionSelect(int option)
    if (option == OIDTargetOutfit)
        if TargetOutfitBool
            TargetOutfitBool = False
        else
            SetTargetOutfit(TargetRef, TargetOutfit)
            TargetOutfitBool = True
        endif
        ForcePageReset()
    endif
endEvent

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

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