Jump to content

Show - Message any way to input a string variable?


MadRabbitX

Recommended Posts

I followed your link and dug through the wiki. Have you actually created a message box that shows more than one button? That would be useful if possible.

 

Okay, i will assume that you are writing this because of my bad English. I will rephrase my original post for you, just to make it clear.

I know how to create a message box, i have like 6 buttons in it, i'm using this buttons inside my script, i can change numbers inside my message box to show some stats or settings. What i cannot do, and need help with, is changing actual text inside this message box, using only my script (that means using string variables). You can do that with MessageBox(string asMessageBoxText), but i need to create a menu, that means i have to use Show function. But show function don't have a string input, that's my problem.

Let's say, just for example, that i want to have a message box with more then 1 button, that will show names of the player and his companion. So i create a message box in CK, with this text:

 

"Your name is <Token.Name=PlayerNameText> and your companion is <Token.Name=CompanionNameText>"

 

I want my script to change <Token.Name=PlayerNameText> and <Token.Name=CompanionNameText> on a text inside my string variables, and they are inside my script. Reneer helped me with that, and gave me a link to this function - AddTextReplacementData. This function will do what i need, but right now i have a problem, i can't compile a script that use this function.

 

 

 

 

Do you have any expamples of this function in work? Because i can't even compile script with it. Even in ReferenceAlias or Quest script type (despite the fact that wiki tells us it should work, especially in ReferenceAlias, since AddTextReplacementData is ObjectReference script). Error is "AddTextReplacementData is not a function or does not exist", so i'm really confused here.

 

 

This is a problem that i have right now. I hope this is clear enough for you.

 

 

Link to comment
Share on other sites

I believe Skyrim's text replacement page provides a /bit/ more info, if it helps. http://www.creationkit.com/index.php?title=Text_Replacement

 

Regarding AddTextReplacementData not compiling, it's an objectreference script object so you'd need to make sure you're applying it to an objectreference.

 

Also, I can't say it'd be terribly efficient or that it'll even work (This is just a theory), but if you're working with a very limited amount of strings, you could potentially create dummy forms, such as dummyMessageStringYes and dummyMessageStringNo with the names set to "Yes" or "No", then use AddTextReplacementData("YesNo", dummyMessageStringYes) to switch it to say "Yes". If you needed multiple YesNo states, you could do something like

AddTextReplacementData("AliveYesNo", dummyMessageStringYes)

AddTextReplacementData("HungryYesNo", dummyMessageStringNo)

 

Then in your message box, do <Token.Name=AliveYesNo> <Token.Name=HungryYesNo>

 

You'd also probably want to do blank placeholders for when you wouldn't print anything. Keep in mind this will not work for message buttons, that's a limitation of the game, you'd have to use predefined buttons or list the index for the options and have the buttons be numbered instead.

 

Also, the Total Hack (turret hacking, etc) holotapes use quite a bit of text replacement if you could use some examples, though nothing like what I described, but maybe enough to get you started.

 

Edit: Apparently the Total Hack holotapes do exactly as I described the "terminalTurretStatus" objects are messages with names set to strings, you can look them up in the CK.

 

hackerHolotapeTurretSCRIPT.psc

Event OnHolotapePlay( ObjectReference akTerminalRef )

	; store the terminal we are being played on.
	myTerminalref = akTerminalRef

	debug.trace("HOLOTAPE: set up globals for turret info")
	objectReference[] linkedRefChain = akTerminalRef.getLinkedRefChain(LinkTerminalTurret)
	int i = 0
	while i < akTerminalRef.countLinkedRefChain(LinkTerminalTurret)
		i += 1
	endWhile
	gNativeTermTurretsConnected.setValue(i)
	akTerminalRef.addtextreplacementData("Connected", gNativeTermTurretsConnected)

	; Add text replacement Data for frenzy status.
	if ((akTerminalRef.getLinkedRef(linkTerminalTurret) as actor).getValue(Aggression) == 3)
		gNativeTermTurretsFrenzied.setValue(1)
	endif
	akTerminalRef.addtextreplacementData("Frenzied", gNativeTermTurretsFrenzied)

	if ((akTerminalRef.getLinkedRef(linkTerminalTurret) as actor).hasMagicEffect(hackerTurretSabotageEffect))
		gNativeTermTurretsFrenzied.setValue(1)
	endif
	akTerminalRef.addtextreplacementData("Sabotaged", gNativeTermTurretsSabotaged)	
	
	; set up text.repl. for Faction owner of ref of first linked turret.
	akTerminalRef.addtextreplacementData("Faction", (akTerminalRef.getLinkedRef(linkTerminalTurret)).getFactionOwner())

	if (akTerminalRef.getLinkedref(linkTerminalTurret) as actor).getCombatState() == 0
		akTerminalRef.addTextReplacementData("AIstatus", terminalTurretStatusNonCombat)
	elseif (akTerminalRef.getLinkedref(linkTerminalTurret) as actor).getCombatState() == 1
		akTerminalRef.addTextReplacementData("AIstatus", terminalTurretStatusCombat)
	else
		akTerminalRef.addTextReplacementData("AIstatus", terminalTurretStatusSearching)
	endif

	if (akTerminalRef.getLinkedref(linkTerminalTurret) as actor).isDead()
		akTerminalRef.addtextReplacementData("OnStatus", terminalTurretStatusDead)
		akTerminalRef.addtextReplacementData("AIstatus", terminalTurretStatusDead)
		else
		if ((akTerminalRef.getLinkedref(linkTerminalTurret) as actor).isUnconscious())
			akTerminalRef.addtextreplacementData("OnStatus", terminalTurretStatusOnline)
		else
			akTerminalRef.addtextreplacementData("OnStatus", terminalTurretStatusOffline)
		endif
	endif

	debug.trace("HOLOTAPE: gNativeTermTurretsConnected = "+gNativeTermTurretsConnected.getValue())
	debug.trace("HOLOTAPE: Faction = "+(akTerminalRef.getLinkedRef(linkTerminalTurret)).getFactionOwner())

EndEvent
Edited by Maduin81
Link to comment
Share on other sites

 

I believe Skyrim's text replacement page provides a /bit/ more info, if it helps. http://www.creationkit.com/index.php?title=Text_Replacement

 

Regarding AddTextReplacementData not compiling, it's an objectreference script object so you'd need to make sure you're applying it to an objectreference.

 

Also, I can't say it'd be terribly efficient or that it'll even work (This is just a theory), but if you're working with a very limited amount of strings, you could potentially create dummy forms, such as dummyMessageStringYes and dummyMessageStringNo with the names set to "Yes" or "No", then use AddTextReplacementData("YesNo", dummyMessageStringYes) to switch it to say "Yes". If you needed multiple YesNo states, you could do something like

AddTextReplacementData("AliveYesNo", dummyMessageStringYes)

AddTextReplacementData("HungryYesNo", dummyMessageStringNo)

 

Then in your message box, do <Token.Name=AliveYesNo> <Token.Name=HungryYesNo>

 

You'd also probably want to do blank placeholders for when you wouldn't print anything. Keep in mind this will not work for message buttons, that's a limitation of the game, you'd have to use predefined buttons or list the index for the options and have the buttons be numbered instead.

 

Also, the Total Hack (turret hacking, etc) holotapes use quite a bit of text replacement if you could use some examples, though nothing like what I described, but maybe enough to get you started.

 

Edit: Apparently the Total Hack holotapes do exactly as I described the "terminalTurretStatus" objects are messages with names set to strings, you can look them up in the CK.

 

Thank you so much! It would be very useful.

Edited by MadRabbitX
Link to comment
Share on other sites

  • 1 year later...

I understood how to do text replacement in terminals, but, is it possible to do that in someMessage.show()?

I tried

msgConnectSuccess.AddTextReplacementData("LocationStart", firstWs.myLocation)
    msgConnectSuccess.AddTextReplacementData("LocationEnd", secondWs.myLocation)
    msgConnectSuccess.show()

before noticing that message parameters passed to scripts aren't ObjectReferences.

 

 

Edit: figured it out. If you have the same problem, look at the quest "Followers". Especially how FollowersCompanionDismissMessage is being shown together with DismissMessageLocation.

Edited by pra
Link to comment
Share on other sites

  • 1 month later...

This is good info thanks.

 

I'm rather confused though. I wanted to make a holotape menu, but I seen a post saying that the Pipboy is not an object reference therefore cannot apply any of this AddTextReplacement to it. As we know, message box can only deal in floats/ints for parameters but I'd like to show custom texts in place of these and also bools if possible. Such as Yes No On Off etc. So at this stage I'm leaning back towards using the message boxes instead if terminal.

 

I will have to have a look at the mentioned example scripts here too.

 

Edit: looks like messagebox menu with 1s and 0s is the road to sanity...

Link to comment
Share on other sites

  • 3 weeks later...

I was going to necro this thread with new info but you beat me to it. Now that I've been working with menus more, there is a way to do what OP asked but it is very clunky and tedious af.

 

Let's say you want revolving companion names in a button. Create a global variable that assigns values to each name. Piper = 1. Codsworth = 2. Deacon = 3.

 

Then you can have conditional buttons in the menu that will only display the button you specify by the value of that global.

 

If global == 1, shows Piper button.

If global == 2, shows Codsworth button.

If global == 3, shows Deacon button.

 

In the screenshot, I do this with Start/Stop Developer Messages. There is only one button and the text alternates based on the value of the global. Like I said... tedious.

 

But maybe that will be helpful for OP or anyone who stumbles in.

 

DNsCZ6dX0AA4uzy.jpg

Link to comment
Share on other sites

I haven't seen anything that solves part 2 of OP's request (text in message/menu body), ie:

 

MyMenu.Show(MyString)

Welcome to my menu, %string

 

If Beth actually fixes that, they should let us show form names in debug notifications too. Hell, even in the old MUD days we had: this_object()->query_short()

Link to comment
Share on other sites

  • Recently Browsing   0 members

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