multiple conditionals

Discuss authoring naninovel scenario scripts.
Post Reply
mizura
Posts: 6
Joined: 17 Mar 2021 00:57

multiple conditionals

Post by mizura »

Hello!

Is there a way to use multiple conditionals in one line?
For example "If BLAH + BLAH2", then goto (instead of just "If BLAH")
or for multiple conditionals do we need to add an extra if and there's no actual if(BLAH + BLAH2) kind of ++ option?

If BLAH
If BLAH2
goto
endif
endif

I figured I could work around it by using text variables but then ended up having to double-if anyway, lol..

Thanks-

idaot
Posts: 24
Joined: 01 Aug 2020 08:25

Re: multiple conditionals

Post by idaot »

Hi, it is possible to inline commands without any generic text. I don't think it's the most ideal way to execute commands but I've yet to find anything wrong with it. Below is an example, check the guide for inlined commands here: https://naninovel.com/guide/naninovel-s ... text-lines

[if score>3][camera offset:4,10][else][camera offset:-6,10][endif]

Alternatively, consider using @gosub to relocate the conditional statements elsewhere in case you want free up clutter in your script: https://naninovel.com/api/#gosub

mizura
Posts: 6
Joined: 17 Mar 2021 00:57

Re: multiple conditionals

Post by mizura »

Hello!
Just to double check, is there a way to plug two ifs into that? Like if score>3 AND if score<15 or would it still have to be [if score>3][if score<15][this][endif][endif]

User avatar
Elringus
Admin
Posts: 258
Joined: 11 May 2020 18:03

Re: multiple conditionals

Post by Elringus »

Sure, you can chain conditionals, eg: @goto Script if:score>3&score<15. Find more examples in the docs: https://naninovel.com/guide/naninovel-s ... -execution

mizura
Posts: 6
Joined: 17 Mar 2021 00:57

Re: multiple conditionals

Post by mizura »

Thank you!
Do those all have to end up to a goto command if it's more than one line of text?

I'm trying to make this type of script cleaner:
@if AIsInParty="true"
@if BIsInParty="true"
Both of these people are in your party
Hurray
@else
Just A is in your party
Sadface
@endif
@endif

Would I need to put something like :

@goto Bothhere if:"(!AIsInParty && !BIsInParty)"

#Bothhere
Both of these people are in your party :)
Hurray

Or can this be cleaned up better?

[On a similar note, I thought I saw somewhere how to add in more than one character at a time but I can't seem to find that either.. To insert multiple characters is it Wait:false ? I tried to just put a comma after @char and it errored, hah.]

idaot
Posts: 24
Joined: 01 Aug 2020 08:25

Re: multiple conditionals

Post by idaot »

Yes, that's one way of doing it in a clean manner. If you feel like the clutter is overwhelming then I recommend working with the IDE extension which has syntax highlighting as well as the possibility to collapse chained commands by hovering the cursor inbetween the line number and first command. https://naninovel.com/guide/ide-extensi ... -extension

Image

In regards to characters appearing synchronously, there are a couple of ways (such as @show in which you can list the characters separated by a comma). It isn't possible to control multiple characters with @char command, instead you should add a wait:false to the first @char if modifying two characters simultaneously.

So for example:
@char Kohaku wait:false
@char Yuko

Post Reply