The CreatorCon Call for Content is officially open! Get started here.

Script - how to set a constant value for a var script? also some equation questions too.

alberttagle
Tera Contributor

Hi,

I'm not entirely sure where to look on why this script is not working.  I have very limited knowledge on scripting, but will get some education very soon, yet I have a deadline coming up for this.  Hope someone can help.

find_real_file.png

RED BOX: I'm trying to set a constant value for each VAR I created.  Is this done correctly? or it needs some other scripting?

GREEN BOX: The value which will be input manually in a single text field, will always be divided by 1024, so I'm trying to come up with a VAR for it. Can I script it like this?

BLUE BOX: here, I placed the "equation" in the script, so the output will be in the 'price' variable.

Maybe I'm doing the entire script too simple, and apparently wrong.

Please help.

 

Thanks!

19 REPLIES 19

Ashutosh Munot1
Kilo Patron
Kilo Patron

HI,


YOu have used setvalue and getvalue, Please use getValue and setValue and give it a try.


Thanks,

Ashutosh

 

Please mark answer as correct or helpful

Hi, Ashutosh.

Thanks, but it still does not work.

Hi,

For getValue you have to take that value in one variable first then divide it.

 

g_form.getvalue('sizeforcomputation'/1024) should be either

1) var a = g_form.getValue('sizeforcomputation')/1024; OR

2) var a = g_form.getValue('sizeforcomputation');  

var b = a/1024;

 

THanks,

Ashutosh Munot

Hi, Ashutosh.

Yes, I have tried the 2nd method while trying to figure out what's wrong by myself.  but it still doesn't work.

find_real_file.png

 

Will the one highlighted in BLUE (in my first post) work? I've been thinking that it's the one that is not working.