Larian Banner: Baldur's Gate Patch 9
Previous Thread
Next Thread
Print Thread
#628772 09/10/17 03:02 PM
Joined: Sep 2017
Koun Offline OP
stranger
OP Offline
stranger
Joined: Sep 2017
Hey there!

Quick question:
Is there any way to output the contents of a float variable using StatusText or any of the other text calls, inside a characterScript?
Seems like they all take a FixedString.

Everything I've tried so far ends with it either failing silently or giving me a "0xbaadf00d".

Joined: Sep 2017
R
apprentice
Offline
apprentice
R
Joined: Sep 2017
Yes. Create 2 local variables in addition to your FLOAT variable:

FLOAT: _myFloat
STRING: _output
FIXEDSTRING: _fixedStringOutput

Then do:

Print(_output, "My float has value [1]", _myFloat)
Cast(_fixedStringOutput, _output)

Now you can display _fixedStringOutput with DisplayText() or StatusText().

Joined: Sep 2017
Koun Offline OP
stranger
OP Offline
stranger
Joined: Sep 2017
You're my hero, thanks! delight

Joined: Sep 2017
Koun Offline OP
stranger
OP Offline
stranger
Joined: Sep 2017
Unfortunately it seems like this fails silently as well for some unknown reason.
Neither DisplayText nor StatusText will produce any output with this, for me frown

I must be missing something here but i literally tried the example provided with the variable names changed to mine.

Joined: Aug 2016
apprentice
Offline
apprentice
Joined: Aug 2016
Originally Posted by Koun
Unfortunately it seems like this fails silently as well for some unknown reason.
Neither DisplayText nor StatusText will produce any output with this, for me frown

I must be missing something here but i literally tried the example provided with the variable names changed to mine.


Have you tried if you have the same problems with .itemScripts?

For example:

Code
EVENTS

EVENT Float_Test
VARS
	ITEM: _item
	CHARACTER: _char
	FLOAT: _myFloat
	STRING: _output
	FIXEDSTRING: _fixedStringOutput
ON
	OnTriggerEnter(_, _item, "FloatTest")
ACTIONS
	Set(_myFloat, 3.1415)
	Print(_output, "My float has value [1]", _myFloat)
	Cast(_fixedStringOutput, _output)
	DisplayText(_item, _fixedStringOutput, 3)


Works with Floats as well as Float3 etc
- https://i.imgur.com/zgdBJMB.png
- https://i.imgur.com/6ja8crG.png

What doesn't seem to work for me though is the function DebugText, which would save one from the need to cast stuff:

Code
EVENTS

EVENT Float_Test
VARS
	ITEM: _item
	CHARACTER: _char
	FLOAT: _myFloat
	STRING: _output
	FIXEDSTRING: _fixedStringOutput
ON
	OnTriggerEnter(_, _item, "FloatTest")
ACTIONS
	Set(_myFloat, 3.1415)
	DebugText(_item, "My float has value [1]", _myFloat)


frown

Joined: Sep 2017
Koun Offline OP
stranger
OP Offline
stranger
Joined: Sep 2017
After some further testing i think i sorta figured out what was going on here. (In my case at least)

It seems like some (or all?) changes to scripts are not properly loaded into existing GM Mode scenes.
The text worked fine in the editor but wouldn't show up in a GM mode scene that had been around for a while.
After creating a new scene in the same GM mode project, it worked as expected.

Maybe that's by design and i just missed the note on it, maybe not.
Problem solved either way smile


Moderated by  Larian_KVN 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.5