Kaka
Kaka

Reputation: 395

Wont work as i want

Right now they both get executed. What am I doing wrong?

if ismsg("talk", msg) then
Say("I do not want to talk about it.")
topic = 1
end

if ismsg("talk", msg) and topic == 1 then
Say("Ok. Get lost!")
idle()
end

I only want the second if condition to be triggered if talk is sent a second time.

Upvotes: -1

Views: 68

Answers (1)

Kara
Kara

Reputation: 6226

The second if statement is always being triggered because you are setting topic to 1 in the first if statement.

Try this:

if ismsg("talk", msg) and topic == 1 then
    Say("Ok. Get lost!")
    idle()
elseif ismsg("talk", msg) then
    Say("I do not want to talk about it.")
    topic = 1
end

Upvotes: 2

Related Questions