Larian Studios
Posted By: Simzzz Convert to String for output? - 20/11/17 01:17 PM
Anyone know how I would convert a non-string value to a string for output?

DisplayText(__Me, _SomeFloat)
//change 'SomeFloat' to a string

Posted By: Branvex Re: Convert to String for output? - 20/11/17 02:59 PM
Can convert integer to string with the IntegertoString query

Code
<something that gets "_IntegerName">
...
AND
IntegertoString(_IntegerName, _StringResult) 
THEN
DisplayText(__Me, __StringResult);
Posted By: Simzzz Re: Convert to String for output? - 21/11/17 12:40 AM
Originally Posted by Branvex
Can convert integer to string with the IntegertoString query

Code
<something that gets "_IntegerName">
...
AND
IntegertoString(_IntegerName, _StringResult) 
THEN
DisplayText(__Me, __StringResult);


Is this only available in the story scripting? I'm not able to find it in my charScript using ctrl+space.

I don't see it listed here either https://docs.larian.game/Character_and_Item_Script_Triggers,_Calls,_and_Queries

Posted By: Simzzz Re: Convert to String for output? - 21/11/17 02:05 AM
Here is what I'm trying to do:

INIT
CHARACTER:__Me

EVENTS
EVENT OnPickupItem_Me
VARS
ITEM:_item
ON
OnPickupItem(__Me, _item)
ACTIONS
IF "c1"
ItemGetStat(_val,_item, Value) //OUT FLOAT:statValue, ITEM:item, ITEMSTAT:statType
THEN
DisplayText(__Me,_val)
ENDIF


basically just output a stat of an item above the character's head (I've tried several variations of this with no luck - tried "Value" with and without quotes, tried declaring the output variable, etc).

I have a feeling either I need to convert the float to a string, or I'm passing statType the wrong way to the function.
Posted By: Simzzz Re: Convert to String for output? - 21/11/17 03:27 AM
Almost had it...

EVENTS
EVENT OnPickupItem_Me
VARS
ITEM:_item
FLOAT:_val
FIXEDSTRING:_str
ON
OnPickupItem(__Me, _item)
ACTIONS
IF "c1&c2"
ItemGetStat(_val,_item,Value)
Cast(_str,_val)
THEN
DisplayText(__Me,_str)
ENDIF



but not quite... https://s33.postimg.org/k7z04vcbz/Capture.jpg
Posted By: Cromcrom Re: Convert to String for output? - 12/12/17 05:00 PM
Did you try Set instead of Cast ?
Posted By: Cromcrom Re: Convert to String for output? - 13/12/17 08:35 AM
Actually, I don't know if this is feasible under scripting alone.

Or if you really really want this output, you could store it as a global variable, and transform it under osiris.

The display of informations has been one of the big turnover in my modding attempts.
Posted By: BlueFeuer Re: Convert to String for output? - 14/12/17 08:56 AM
EVENT DamageTimer
VARS
STRING:_Str
FIXEDSTRING:_Text
FLOAT:_TextFloat
ON
OnInit()
ACTIONS
Set(_TextFloat, 10)
Print(_Str, "[1]", _TextFloat)
Cast(_Text, _Str)
DisplayCombatInfoText(__Me, _Text, 1.0)


This will convert a Float (In this case, 10) to a String and then cast it to a FixedString, where it can be used as such.
© Larian Studios forums