using the advanced expression funtion

This forum is the place to discuss the older ADRIFT versions 3.9 and 4.0.

Please refer to the ADRIFT 4 Manual for more information.
Post Reply
User avatar
Albaniua
Posts: 87
Joined: Tue Sep 30, 2008 9:55 pm
Points: 10
Location: Las Vegas, NV

using the advanced expression funtion

Post by Albaniua »

I don't even know how to say things right.
First, anywhere I could go to learn how to "set a variable to a value using an advanced expression?"

Up to now, I have been changing the value of a variable when a task is done TO a specific number or BY a specific number.
Can I change the value of a variable to the result of two other variables being multiplied?

So:
Variables
A=1
B=2
C=3

When the task is completed change the value of A (1) to 6 (multiplying B*C)

ideas?
Honk if you've played Escape from Rungistan.
User avatar
Campbell
Site Admin
Posts: 4732
Joined: Sun Jun 23, 2002 12:05 pm
Points: 0
Location: Edinburgh, Scotland
Contact:

Re: using the advanced expression funtion

Post by Campbell »

Have you tried setting A to expression %B% * %C%?
ADRIFT Developer developer.
User avatar
Albaniua
Posts: 87
Joined: Tue Sep 30, 2008 9:55 pm
Points: 10
Location: Las Vegas, NV

Re: using the advanced expression funtion

Post by Albaniua »

yes, although in reality my variables are A_in, B_in, and C_in

A_in to expression %B_in% * %C_in%

do the spaces in the expression matter?

can I use the variable itself in an expression? like

set A_in to expression %A_in% * %B_in%

i'm away from the computer with the program, I'll write later what kind of error i'm getting.
Honk if you've played Escape from Rungistan.
User avatar
Campbell
Site Admin
Posts: 4732
Joined: Sun Jun 23, 2002 12:05 pm
Points: 0
Location: Edinburgh, Scotland
Contact:

Re: using the advanced expression funtion

Post by Campbell »

Spaces are ignored, but makes the expression more readable. And yes, you can refer to the variable itself in the expression.
ADRIFT Developer developer.
User avatar
Albaniua
Posts: 87
Joined: Tue Sep 30, 2008 9:55 pm
Points: 10
Location: Las Vegas, NV

Re: using the advanced expression funtion

Post by Albaniua »

ok, this is what I put in:

Type of action: Change variable

Change a_in to expression %A_in% * %B_in%

A_in starts out 1
and
B_in starts out as 3

The error that I get is:

"[bad Expr iable]Op Expr "


the error occurs when I "update" the window "edit a resultant action"
Honk if you've played Escape from Rungistan.
User avatar
Campbell
Site Admin
Posts: 4732
Joined: Sun Jun 23, 2002 12:05 pm
Points: 0
Location: Edinburgh, Scotland
Contact:

Re: using the advanced expression funtion

Post by Campbell »

I just tried, and it worked fine for me:
v4expressions.jpg
v4expressions.jpg (29.68 KiB) Viewed 5795 times
ADRIFT Developer developer.
User avatar
Albaniua
Posts: 87
Joined: Tue Sep 30, 2008 9:55 pm
Points: 10
Location: Las Vegas, NV

Re: using the advanced expression funtion

Post by Albaniua »

ok......
I think I know why it wasn't (please notice the past term use of the verb!) working. What I did was start everything from scratch, put in the barest essentials, and of course, it worked. The problem is that the stuff that I had written before LOOKED exactly the same, but it wasn't reacting the same.

To get it to work, I went back to the variables window, deleted "A_in" and just rewrote it. I put a space between the underscore and "in", A_ in, which was very hard to see. Lately I've been writing the code/descriptions in word and then cutting and pasting. I'm pretty sure the error was written in Word, and when I transferred the info I didn't catch the error. Thanks Campbell for looking into it.
Honk if you've played Escape from Rungistan.
User avatar
Campbell
Site Admin
Posts: 4732
Joined: Sun Jun 23, 2002 12:05 pm
Points: 0
Location: Edinburgh, Scotland
Contact:

Re: using the advanced expression funtion

Post by Campbell »

Glad you figured it out. :)
ADRIFT Developer developer.
Post Reply