Hi,
I paste here the code for a dialog like the previous diagram
( not exactly
the same ).
The add method is a typical FSM.
actual_state, trigger, condition ---> next_state, reply,
action
Regards,
Miguel
--
Behaviours.addGreeting(this);
Behaviours.addJob(this,"I am the
librarian.");
Behaviours.addHelp(this,"Read!.");
add(1,"book",new ChatCondition()
{
public boolean fire(Player player, SpeakerNPC npc)
{
return
player.isQuestCompleted("ceryl_book");
}
},
1,"I already got the book. Thank
you!",null);
add(1,"book",new ChatCondition()
{
public boolean fire(Player player, SpeakerNPC npc)
{
return player.hasQuest("ceryl_book")
&&
player.getQuest("ceryl_book").equals("jyan
ath");
}
},
1,null,new ChatAction()
{
public void fire(Player player, String text,
SpeakerNPC engine)
{
say("Thanks!");
player.addXP(100);
player.setQuest("ceryl_book","done")
;
player.removeQuest("ceryl_book");
}
});
add(1,"book",new ChatCondition()
{
public boolean fire(Player player, SpeakerNPC npc)
{
return player.hasQuest("ceryl_book")
&&
player.getQuest("ceryl_book").equals("star
t");
}
},
1,"I really need that book now!. Go to
talk with
Jyanath.",null);
add(1,"book",new ChatCondition()
{
public boolean fire(Player player, SpeakerNPC npc)
{
return
!player.hasQuest("ceryl_book");
}
},
60,"Could you ask Jyanath for a #book that
I am looking?",null);
add(60,"yes",null,
1,null,new ChatAction()
{
public void fire(Player player, String text,
SpeakerNPC engine)
{
say("Great!. Start the quest now!");
player.setQuest("ceryl_book","start"
);
}
});
add(60,"no",null,1,"Oh! Ok
:(",null);
Behaviours.addGoodbye(this);
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep
through log files
for problems? Stop! Download the new AJAX search engine
that makes
searching your log files as easy as surfing the web.
DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/
sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Arianne-devel mailing list
Arianne-devel lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/arianne-d
evel
|