Larian Banner
Previous Thread
Next Thread
Print Thread
Convert to String for output? #637511
20/11/17 01:17 PM
20/11/17 01:17 PM
Joined: Nov 2017
Posts: 24
S
Simzzz Offline OP
stranger
Simzzz  Offline OP
stranger
S

Joined: Nov 2017
Posts: 24
Anyone know how I would convert a non-string value to a string for output?

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


Re: Convert to String for output? [Re: Simzzz] #637518
20/11/17 02:59 PM
20/11/17 02:59 PM
Joined: Oct 2017
Posts: 78
United Kingdom
Branvex Offline
journeyman
Branvex  Offline
journeyman

Joined: Oct 2017
Posts: 78
United Kingdom
Can convert integer to string with the IntegertoString query

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

Re: Convert to String for output? [Re: Branvex] #637546
21/11/17 12:40 AM
21/11/17 12:40 AM
Joined: Nov 2017
Posts: 24
S
Simzzz Offline OP
stranger
Simzzz  Offline OP
stranger
S

Joined: Nov 2017
Posts: 24
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


Re: Convert to String for output? [Re: Simzzz] #637549
21/11/17 02:05 AM
21/11/17 02:05 AM
Joined: Nov 2017
Posts: 24
S
Simzzz Offline OP
stranger
Simzzz  Offline OP
stranger
S

Joined: Nov 2017
Posts: 24
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.
Re: Convert to String for output? [Re: Simzzz] #637556
21/11/17 03:27 AM
21/11/17 03:27 AM
Joined: Nov 2017
Posts: 24
S
Simzzz Offline OP
stranger
Simzzz  Offline OP
stranger
S

Joined: Nov 2017
Posts: 24
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

Re: Convert to String for output? [Re: Simzzz] #638855
12/12/17 05:00 PM
12/12/17 05:00 PM
Joined: Jun 2013
Posts: 655
Cromcrom Offline
addict
Cromcrom  Offline
addict

Joined: Jun 2013
Posts: 655
Did you try Set instead of Cast ?


Un chemin de 1000 lieues commence par un premier pas.

Project:
Steam workshop Frontiere
Re: Convert to String for output? [Re: Cromcrom] #638883
13/12/17 08:35 AM
13/12/17 08:35 AM
Joined: Jun 2013
Posts: 655
Cromcrom Offline
addict
Cromcrom  Offline
addict

Joined: Jun 2013
Posts: 655
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
Re: Convert to String for output? [Re: Simzzz] #638925
14/12/17 08:56 AM
14/12/17 08:56 AM
Joined: Oct 2017
Posts: 77
BlueFeuer Offline
journeyman
BlueFeuer  Offline
journeyman

Joined: Oct 2017
Posts: 77
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 

Powered by UBB.threads™ PHP Forum Software 7.6.2