How to use Text Replacement for Papyrus Values

Post » Wed Jun 20, 2012 9:48 pm

To elaborate more... I need to make a message box with multiple options so debug.messagebox cannot be used... I need to make a message object..
However I need some values obtainable via Papyrus to be specific, actor values... message objects can only get these values via text replacement from aliases..
So the question is how do I assign the actor values to the aliases and use it to replace text in the message object?

Thanks :)
User avatar
Julie Serebrekoff
 
Posts: 3359
Joined: Sun Dec 24, 2006 4:41 am

Post » Wed Jun 20, 2012 8:55 pm

Message Text:
Level: %.0fHealth: %.0f/%.0fMagicka %.0f/%.0fStamina: %.0f/%.0fInventory: %.0f/%.0f

Code snippet:
Function ShowMain()	int choice = Main.Show(Target.GetLevel(), Target.GetActorValue("Health"), Target.GetBaseActorValue("Health"), Target.GetActorValue("Magicka"), Target.GetBaseActorValue("Magicka"), Target.GetActorValue("Stamina"), Target.GetBaseActorValue("Stamina"), Target.GetActorValue("InventoryWeight"), Target.GetActorValue("CarryWeight"))	if (choice == 0)		ShowAIData()	elseif (choice == 1)		ShowCombat()	elseif (choice == 2)		ShowStealth()	elseif (choice == 3)		ShowMagic()	elseif (choice == 4)		ShowResistances()	endifEndFunction
User avatar
April
 
Posts: 3479
Joined: Tue Jun 20, 2006 1:33 am

Post » Wed Jun 20, 2012 3:53 pm

I mean like this

sample Message Text:
Level: 

if that is possible
User avatar
Miragel Ginza
 
Posts: 3502
Joined: Thu Dec 21, 2006 6:19 am

Post » Wed Jun 20, 2012 5:07 pm

I'm not sure that is possible. The wiki's http://www.creationkit.com/Text_Replacement page doesn't show anything for actor values. Mostly just names and pronouns.
User avatar
Miguel
 
Posts: 3364
Joined: Sat Jul 14, 2007 9:32 am

Post » Wed Jun 20, 2012 6:39 pm

If i understand what you want to do correctly, you have to make each actorvalue a global variable, and then update that value whenever it changes, and use the correct syntax in the message.
In addition, you must setup a quest and the globals need to be available to the message by adding them to the "text display" on the Quest data tab. Also, you also have to create a referencealias to the messagebox object with the "stores text" and "uses stored text" boxes checked.
It's a ridiculously tedious process.

for example:

somewhere in your script:
make globalvariable: Globalvariable Property avOnehanded auto
actor player = Game.GetPlayer()
float x = player.getAV("onehanded")
set value of global: avOnehanded.SetValue(x)
update the global: UpdateCurrentInstanceGlobal(avOnehanded)

In the message box:
YourTextHere
User avatar
jeremey wisor
 
Posts: 3458
Joined: Mon Oct 22, 2007 5:30 pm

Post » Wed Jun 20, 2012 7:16 pm

You can pass arguments to message boxes if they're values, just not strings.

int Function Show(float afArg1 = 0.0, float afArg2 = 0.0, float afArg3 = 0.0, float afArg4 = 0.0, float afArg5 = 0.0,    float afArg6 = 0.0, float afArg7 = 0.0, float afArg8 = 0.0, float afArg9 = 0.0) native

http://www.creationkit.com/Show_-_Message

Just pass Actor.GetLevel() as your argument. It may need to be cast as a float but it should work fine.

-MM
User avatar
Matthew Warren
 
Posts: 3463
Joined: Fri Oct 19, 2007 11:37 pm


Return to V - Skyrim