ご存知でしたボットのリブレー無料主催 フォーラム のためにお客様ご自身のウェブサイトまたはモバイルアプリのか?
Self, AIML, and scripting : script logic

RE: script logic

による dpiaggesi 掲載 Sep 9 2016, 12:17

mmm the <pre> tag didn't work.... i try to paste the code as normal text

 

state GeoNames {
case input goto sentenceState for each #word of sentence;

state sentenceState {
case "can" goto sentenceState;
case "you" goto sentenceState;
case "translate" goto tState;

var numeral {
meaning : number;
}

function g1() {
res = Http.requestXML("http://api.geonames.org/postalCodeSearch?username=botlibre&maxRows=1&postalcode=" + numeral);
if (res.totalResultsCount == "0") {
return "i know no place with that code";
}
if (res.totalResultsCount != "1") {
return "there are more than one result, specify a country";
}
return res.code.name;
}

state tState {
case #the goto tState;
case "post" goto tPCState;
case "postal" goto tPCState;
case "postcode" goto tPCState;
}

state tPCState {
case "code" goto tPCState;
case numeral goto tPCState;
case "in" goto tPCWCState;

answer g1();
}

state tPCWCState {
case "*" goto tPCWCState;

answer "I AM HERE";
}
}
}


Id: 13960488
掲載: Sep 9 2016, 12:17
回答: 0
眺望: 1895, 今日の: 1, 週間: 1, 月: 37
0 0 0.0/5