ADRIFT Forum


The place to discuss the ADRIFT Interactive Fiction toolkit

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.

using the advanced expression funtion

Postby Albaniua » Sun Nov 25, 2012 5:22 am

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
Albaniua
 
Posts: 87
Joined: Tue Sep 30, 2008 8:55 pm
Location: Las Vegas, NV

Re: using the advanced expression funtion

Postby Campbell » Sun Nov 25, 2012 10:55 am

Have you tried setting A to expression %B% * %C%?
ADRIFT Developer developer.
User avatar
Campbell
Site Admin
 
Posts: 4570
Joined: Sun Jun 23, 2002 11:05 am
Location: Edinburgh, Scotland

Re: using the advanced expression funtion

Postby Albaniua » Mon Nov 26, 2012 4:21 pm

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
Albaniua
 
Posts: 87
Joined: Tue Sep 30, 2008 8:55 pm
Location: Las Vegas, NV

Re: using the advanced expression funtion

Postby Campbell » Mon Nov 26, 2012 5:03 pm

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
Campbell
Site Admin
 
Posts: 4570
Joined: Sun Jun 23, 2002 11:05 am
Location: Edinburgh, Scotland

Re: using the advanced expression funtion

Postby Albaniua » Tue Nov 27, 2012 1:41 am

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
Albaniua
 
Posts: 87
Joined: Tue Sep 30, 2008 8:55 pm
Location: Las Vegas, NV

Re: using the advanced expression funtion

Postby Campbell » Tue Nov 27, 2012 1:50 am

I just tried, and it worked fine for me:

v4expressions.jpg
v4expressions.jpg (29.68 KiB) Viewed 2338 times
ADRIFT Developer developer.
User avatar
Campbell
Site Admin
 
Posts: 4570
Joined: Sun Jun 23, 2002 11:05 am
Location: Edinburgh, Scotland

Re: using the advanced expression funtion

Postby Albaniua » Tue Nov 27, 2012 6:24 am

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
Albaniua
 
Posts: 87
Joined: Tue Sep 30, 2008 8:55 pm
Location: Las Vegas, NV

Re: using the advanced expression funtion

Postby Campbell » Tue Nov 27, 2012 8:43 am

Glad you figured it out. :)
ADRIFT Developer developer.
User avatar
Campbell
Site Admin
 
Posts: 4570
Joined: Sun Jun 23, 2002 11:05 am
Location: Edinburgh, Scotland


Return to ADRIFT 3.9 and 4.0

Who is online

Users browsing this forum: No registered users and 11 guests

cron