How can I work with if statement with multiple conditions?

My topic is not good enough to state my problem :frowning: so i state it clear here:

well I want to create some story-like effect like those AVG game …that is when you press the text area the dialogue keep going and when the dialogue reach some certain point the character (or the background) change.

I think I have done it in a stupid way, as I am really new to programming.

I have so far finished by defining the index of the table of the dialogue text (which is another lua file called chatText.lua), and I have set  a function like…when pressed, i=i+1 and chattext.text = chatText.a1[i]  (a1 is the chattext subtable). so when i is increasing, the text appeared keep changing.

I hope it is clear enough =-= if not, i will post those code on here.

after that, I set a function called changechar(), what it does is to change the character on the screen by trasition.to the alpha of the original character and display a new one with a new characterindex.

say…

local characterindex = 1

local i = 0

function changetext()    

        if i<#chatcontent.a1 then 

            i = i + 1            

            print(chatcontent.a1[i])        

            chat.text = chatcontent.a1[i]        

        else

            chat.text = chatcontent.a1[i]        

        end

if i == 2, then

  characterindex=2

  changechar()

elseif i==3, then

  characterindex=1

  changechar()

it also work fines…so far. but it just doesn’t work when i put “or” on the condition.

e.g.

if i==2 or 5 then

   characterindex=2

  changechar()

elseif i==3, then

  characterindex=1

  changechar()

It just doesn’t work. How can I do it if I want characterindex =2 when both i == 2 or 5? should I just write out all the condition one by one??

if i == 2 or i == 5 then characterindex=2 changechar() elseif i==3, then characterindex=1 changechar() 

should be okay now :slight_smile:

Thanks gman2 @@ I finally know that what stupid mistake i have made =-=

if i == 2 or i == 5 then characterindex=2 changechar() elseif i==3, then characterindex=1 changechar() 

should be okay now :slight_smile:

Thanks gman2 @@ I finally know that what stupid mistake i have made =-=