Page 1 of 2

Tasks Run regardless of conditions?

Posted: Mon May 21, 2018 9:38 pm
by Kamer
I'm having an issue where tasks are run immediately. Even when I put up certain conditions for tasks to run they are ignored and everything is read in one straight go. I had a working quest last night but it randomly started running all tasks immediately, and being fed up I restarted from scratch. The fact if it works or not seems to be completely random. What am I doing wrong? I'm guessing it has something to do with how I'm spacing.

Code: Select all

Quest: TEST
-- Message panels
QRC:

QuestorOffer:  [1000]
<ce>

RefuseQuest:  [1001]
<ce>           

AcceptQuest:  [1002]
<ce>           

QuestFail:  [1003]
<ce>                     

QuestComplete:  [1004]
<ce>                     

Message:  1011
<ce> Quest Start

Message: 1012
<ce> You feel a strange presence

Message: 1013
<ce> Quest End

QBN:

Foe _warrior_ is Warrior

clock _time_ 0.0:45
clock _attack_ 0.0:25

--	Quest start-up:
	say 1011
	
_attack_ task:
	say 1012
	create foe _warrior_ every 1 minutes 1 times with 100% success
		
_time_ task:
	say 1013
	end quest

Re: Tasks Run regardless of conditions?

Posted: Mon May 21, 2018 10:33 pm
by Interkarma
Actions should only run once something triggers them (such as your clock timer). I'm not aware of any problems that will cause this occur, but if your test quest is a good way to reproduce, I'll have a look at this in more detail later.

Re: Tasks Run regardless of conditions?

Posted: Mon May 21, 2018 11:54 pm
by Jay_H
I have rarely seen this in the past. I haven't wanted to report it since I couldn't see a reliable reproduction method. But I can say it's been around since September.

In my case it was with a Prompt action that insisted on happening out of turn.

Re: Tasks Run regardless of conditions?

Posted: Tue May 22, 2018 1:48 am
by Kamer
I wouldn't call it rare. I can't seem to create a single quest without it breaking and wanting to run everything at once.

Re: Tasks Run regardless of conditions?

Posted: Tue May 22, 2018 2:05 am
by Interkarma
Looking at your quest above to reproduce, what you've found is a parsing bug. :)

There are some extra tabs underneath each task that cause each task to become linked to the task before it. Basically the tabs cause each task header to be dropped and become joined to previous task - in this case all the way back startup task. Here's a screenshot showing the tabs under each task block.

I'll work on a fix for this now. If you remove the tabs under each task block it executes OK (tested).

Jay, I hazard this is the same problem you had but you managed to clean up formatting without realising it was part of problem.

extra-tabs.png
extra-tabs.png (7 KiB) Viewed 3139 times

Re: Tasks Run regardless of conditions?

Posted: Tue May 22, 2018 2:54 am
by Interkarma
I've fixed whitespace handling between task blocks now. It can handle your repro quest above without any problems. This will be in next round of builds.

Thanks for testing and feedback. :)

Re: Tasks Run regardless of conditions?

Posted: Tue May 22, 2018 3:18 am
by Kamer
I knew it had something to do with that. Thanks a bunch! Now I can get back to work.

Re: Tasks Run regardless of conditions?

Posted: Tue May 22, 2018 4:04 am
by Kamer

Code: Select all

Quest: TEST
-- Message panels
QRC:

QuestorOffer:  [1000]
<ce>

RefuseQuest:  [1001]
<ce>           

AcceptQuest:  [1002]
<ce>           

QuestFail:  [1003]
<ce>                     

QuestComplete:  [1004]
<ce>                     

Message:  1011
<ce> Quest Start

Message: 1012
<ce> You feel a strange presence

Message: 1013
<ce> Quest End

QBN:

Clock _time_ 00.00:10
Clock _attack_ 0.00:03

--	Quest start-up:
	say 1011

_attack_ task:
	say 1012

_time_ task:
	say 1013
	end quest
It's definitely working but now I'm having an issue that the clocks won't work. What I'm doing wrong now?

Re: Tasks Run regardless of conditions?

Posted: Tue May 22, 2018 4:07 am
by Interkarma
Don't forget to call:

Code: Select all

start timer _clockName_
You can also pause a clock with:

Code: Select all

stop timer _clockName_
You can chain timers together as well, e.g. start clock A at startup then start clock B from clock A task. Jay is an expert at this stuff and will be able to help more.

When looking at a timer in the quest debugger: grey=not started, green=running, red=finished.

Re: Tasks Run regardless of conditions?

Posted: Tue May 22, 2018 4:13 am
by Kamer
Where do I find the Quest Debugger?