Hi guys, I’m struggling with that tiny piece of lolicode and i can’t figure out why it isn’t working, i must confess that i’m still a little bit confused about the new variables system.
What i want to do is to go through an if statement if a specific cookie equalto a specific string.
Here is my example:
IF data.COOKIES["cookie_name"] EqualTo "Rurimustbehandsome"
// Doing some stuffs
END
It’s prolly due to a dumb reason but i’ve tried anything that came to my mind (like puttin an @ before data, etc…)
Thanks all !
Oh and the error is “[IDLE] CompilationErrorException: (11,38): error CS1026: ) expected”
IF STRINGKEY @data.COOKIES["cookie_name"] EqualTo "Rurimustbehandsome"
// Doing some stuffs
END
You were missing the STRINGKEY keyword. It’s important to tell OB2 which type of key it is, so it can know if it has to cast the left side as a string, or integer or something else!
Note that this will throw an exception if cookie_name is not in the data.COOKIES dictionary, so you should also check that there is a key like that.
IF DICTKEY @data.COOKIES HasKey "cookie_name"
IF STRINGKEY @data.COOKIES["cookie_name"] EqualTo "Rurimustbehandsome"
// Do something
END
END
Because the @ identifies that what comes next is to be interpreted as a variable in lolicode, you can find documentation in the program itself by going to the /docs.