AI Zone Admin Forum Add your forum

NEWS: survey on 3000 US and UK consumers shows it is time for chatbot integration in customer service!read more..

“macro ^harry already defined” error in first step of ChatScript tutorial

Apologies.  Newbie here.

I downloaded the latest version of ChatScript 6.3a running on Ubuntu and managed to successfully get Harry running using ~/chatscript/BINARIES/LinuxChatScript64 local

I’m following the tutorial provided in the DOCUMENTATION/ChatScript Tutorial.pdf but seem to have fallen at the first hurdle and would appreciate any help.

I have a ~/chatscript/RAWDATA/files2.txt containing:

/TEST/ # tutorial bot data 

and a ~/chatscript/RAWDATA/ file containing:

topic: ~introductions []
: ^keep() [Hello] [Hi] [Hey][talk] [speak] [say something] to me

When I execute

>:build 2 

  I get the error

ray: > :build 2
ChatScript Version 6.3a  compiled Apr 16 2016 18

----Reading file
Reading outputmacro
: ^harry
*** Errorline 2 of
in at 2outputmacroharry()  # you get harry by default
MACRO-3 macro ^harry already definedReading table tbl:defaultbot
Reading topic 
Reading topic 

----Reading file
Reading topic 
*** Warning-  Undefined set or topic ~main_control line 13 in
*** Warning-  Undefined set or topic ~tallyraw line 50 in
*** Warning-  Undefined set or topic ~tallybase line 51 in
*** Warning-  Undefined set or topic ~tallybasepos line 52 in
*** Warning-  Undefined set or topic ~sentiment line 53 in
*** Warningline 0 of missingLabel.txtAt least one duplicate topic namei.e., ~controlwhich may intended if bot restrictions differ.

line 2 of simplecontrol.topMACRO-3 macro ^harry already defined
1 errors 
press Enter to quitThen fix and try again


The first lines of ~chatscript/RAWDATA/HARRY/ and the ones it seems to complain about are :

# this function is executed once for every new user chatting with harry^M
outputmacroharry()  # you get harry by default^M

  [ # 1 ]

Just rename files2.txt to filesABC.txt then :build ABC


  [ # 2 ]

i had the same problem
renaming the file worked for me
can you please explain how renaming solves the problem


  [ # 3 ]

What is the version of the chatscript that you downloaded?


  [ # 4 ]

I am trying this out too. I can see this error in the latest Chatscript Ver6.7.
But can’t figure out why too?
Hope the gurus in this forum can help enlighten newbie(like me) about this.

Many thanks.


  [ # 5 ]

I’m a newbie too. But I know that the files0.txt has the path with the files that are less changed in chatscript.

files1.txt or files2.txt has the path with the files that are more changed (like top files). But normally, we rename files1.txt or files2.txt (if it exist) to filesNameOfYourBot.txt

I suppose that you may have copied the Harry bot to build your bot and forget to change the name of the bot. So, when you run files2.txt it showed a error message.



  [ # 6 ]

ChatScript loads things in layers.  The layer number is the last digit in the filename (excluding suffix) if a digit exists.

Hence :build 0   builds the files0.txt file
:build Harry   builds harry.txt as layer 1
Naming your file “2.txt” means layer 2 building (which you didnt want).  You still have layer 1 built into the TOPIC folder, which has Harry.


  [ # 7 ]

Long time ago, when someone wrote that tutorial, layer 2 didnt exist.  Nowadays it can. So merely name your file by its botname so you can say :build mybotname   which refers to filesmybotname.txt .  I have edited the tutorial for future releases.


  [ # 8 ]

Thanks Oberdan and Bruce for your insightful reply!

hi Bruce, since you are editing doc for future release, I read in the <<Chatscript Advanced user manual>>Page 32:
“Note- If you make something likes files2.txt and do a :build 2, this does not add another
layer on top of level 1. It replaces level 1. There are only 2 levels. So if your file does not
define a bot and his topics and control script, you wipe out Harry, for example, and are
left with nothing.”

From your answers above, seems like this paragraph is no longer accurate. How many levels can chatscript build now…if there is still an upper limit?


  [ # 9 ]

fixed. thanks


  login or register to react