Condition Using Compound Variables

Tips and questions about scripting your Verbot®.

Moderator: Staff

Condition Using Compound Variables

Postby eyegrokit » Sat Sep 20, 2008 12:49 pm

Am building an A.I. construct that can save people email and phone number. It is assigned in a routene as follows: Input

[owner]'s (email) is [[owner]_Email].

When recalling the information, the following is the input

What is [owner]'s (email)?

But the construct should be smart enough to remark if an email has or has not been assigned to the owner. The condition for those remarks are

vars["[owner]_Email"] != null (if has been assigned)

vars["[owner]_Email"] == null (if not)

But the process currently always processes not. (Conditions were removed (for testing) to assure that the correct variable could be recalled).

So what is the correct syntax to use conditions with compound variables?
eyegrokit
NewBot
NewBot
 
Posts: 1
Joined: Mon Dec 31, 2007 2:11 pm

Postby leseur sylvain » Mon Sep 22, 2008 12:01 pm

You must use :

Test this
<?csharp
vars[vars["owner"] + "_Email"] = "1";
?>
To give a value to the var.

Then condition like:

vars[vars["owner"]+"_Email"] != "1"
vars[vars["owner"]+"_Email"] == "1"

Friendly
Sylvain
leseur sylvain
OmnipotentBot
OmnipotentBot
 
Posts: 1677
Joined: Mon Nov 08, 2004 4:53 pm
Location: Suburb of Paris France

Postby JonC » Wed Dec 10, 2008 8:32 pm

Following on (slightly sideways) from the last post:

If you don't like c#, then why not initially set it up so that [[owner]_Email] contains a string such as "no email address provided".
That way you wouldn't even need to test for the presence of an email address or not - the answer would always make sense.
You can assign a default value to a string using [[owner]_Email:no email supplied]
This will contain the default string 'no email supplied' until a value is defined.
Thus, once the email has been input the 'default' value is ignored and the call will return the email address.

(See Verbot editor help file: variables, where this function is documented)
JonC
SupremeBot
SupremeBot
 
Posts: 665
Joined: Wed Apr 02, 2008 6:34 am
Location: Leicestershire, Great Britain


Return to Scripting

Who is online

Users browsing this forum: No registered users and 0 guests