Larian Banner
Previous Thread
Next Thread
Print Thread
Joined: Nov 2017
S
Simzzz Offline OP
stranger
OP Offline
stranger
S
Joined: Nov 2017
Anyone know how I would convert a non-string value to a string for output?

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


Joined: Oct 2017
Location: United Kingdom
journeyman
Offline
journeyman
Joined: Oct 2017
Location: United Kingdom
Can convert integer to string with the IntegertoString query

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

Joined: Nov 2017
S
Simzzz Offline OP
stranger
OP Offline
stranger
S
Joined: Nov 2017
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


Joined: Nov 2017
S
Simzzz Offline OP
stranger
OP Offline
stranger
S
Joined: Nov 2017
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.

Last edited by Simzzz; 21/11/17 02:27 AM.
Joined: Nov 2017
S
Simzzz Offline OP
stranger
OP Offline
stranger
S
Joined: Nov 2017
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

Joined: Jun 2013
addict
Offline
addict
Joined: Jun 2013
Did you try Set instead of Cast ?


Un chemin de 1000 lieues commence par un premier pas.

Project:
Steam workshop Frontiere
Joined: Jun 2013
addict
Offline
addict
Joined: Jun 2013
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.


Un chemin de 1000 lieues commence par un premier pas.

Project:
Steam workshop Frontiere
Joined: Oct 2017
journeyman
Offline
journeyman
Joined: Oct 2017
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.


Moderated by  Larian_Koala 

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