How to print a string value ?

Discuss authoring naninovel scenario scripts.
Post Reply
dxxds
Posts: 9
Joined: 27 Jan 2021 04:17

How to print a string value ?

Post by dxxds »

Here is a script which was not working


#Start
@goto .Word_selection
@stop

#Word_selection
@printer Wide

@print "choice a word"
@choice "AAA" goto:.choice_AAA
@choice "BBB" goto:.choice_BBB
@stop

#choice_AAA
@set t_str1="AAA"
@goto .word_selected

#choice_BBB
@set t_str1="BBB"
@goto .word_selected

#word_selected
@print it is {t_str1}
@stop


it can't print the value of "t_str1".
i have added the "t_str1" into Custom Variables and setted the value as ""

error info

NullReferenceException: Object reference not set to an instance of an object
Naninovel.ScriptPlaylist+<>cDisplayClass9_0.<GetCommandAfterLine>b0 (Naninovel.Commands.Command a) (at Assets/Naninovel/Runtime/ScriptPlayer/ScriptPlaylist.cs:104)

Last edited by dxxds on 30 Jan 2021 06:05, edited 1 time in total.
dxxds
Posts: 9
Joined: 27 Jan 2021 04:17

Re: How to print a string value ?

Post by dxxds »

I think maybe it is a bug, after i change the name of variable into "tstr" , the code work fine.

if it named with t_str / t_str1 / t_str2, error occured

Elringus
admin
Posts: 521
Joined: 11 May 2020 18:03

Re: How to print a string value ?

Post by Elringus »

That's by design, as t_ are recognized as references to managed text records: https://naninovel.com/guide/managed-tex ... cript-text

Post Reply