Unexpected Token '{'

Hello guys,

I tryed out some coding with the nightbot. But iam struggle at the moment because I have no idea how to solve it.

I breakdown this script to this short test code:
The command looks like:
!setnumber usernum
For example:
!setnumber 2

And i wanna trigger test2 but he calls me unexpected token ‘{’

$(eval var usernum = “$(1)”;
If (usernum == “1”) {“test1”}
Else if (usernum == “2”) {test2}
Else if (usernum == “3”) {test3}
Else {Error})

I try something different but there is the same error. What do iam wrong?

(I also try for $(1) this $(query) but nothing changed. And it’s important for me to do $(1) because I want to add there later more input variables for $(2) $(3) and so on.

This should work:

$(eval N=`$(1)`;if(N==`1`){`test1`}else if(N==`2`){`test2`}else if(N==`3`){`test3`}else{`Error`})

This works fine, Thank you very much =)

Hey iam struggle now at the last point of integration. I think about the creation of this command with a command in chat. Is this the way to get this working? Or I forgot something?

$(eval N=$(1);if(N==1){'edit !multilink Aktueller Multi-Stream Link: http://multitwitch.tv/$(channel)/$(2)}else if(N==2){edit !multilink Aktueller Multi-Stream Link: http://multitwitch.tv/$(channel)/$(2)/$(3)}else if(N==3){edit !multilink Aktueller Multi-Stream Link: http://multitwitch.tv/$(channel)/$(2)/$(3)/$(4)}else{Error`})

If I try the command he says me this:

Invalid parameter specified. Possible parameters: add/delete/edit

I think there is no link between the edit parameter and the !commands.
But !commands is listed in alias

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.

Apologies for the delay in response. Unfortunately you cannot trigger eval before aliases. Data passed in the “message” field is passed as arguments to the alias.

In other words:

  • You have a command !test with !testalias as the alias and some data as the message.
  • You use the command !test
  • !testalias is called internally as !testalias some data