Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently October 5th, 2024, 4:26 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Ridiculousy Easy Script Not Working
PostPosted: November 23rd, 2010, 10:37 pm 
Offline

Joined: June 9th, 2008, 7:37 am
Posts: 79
Location: Kent, UK
Hi all, I'm tearing my hair out on this one, even got my missus to look at it.

I have a tiny script to make an image appear (named Prize) on the showing of another image (named C_Tick), so I fill a variable USER_WIN with the value from the IsShowing attribute, which should be true or false. I test for "true" and show the Prize image. But alas it fails to work.
I have dropped a text object and filled it with the USER_WIN variable, and it changes as the C_Tick image appears and disappears, but the expression does still not work.

It's as though the USER_WIN is showing me the value "true" but there's some white space I haven't accounted for.

Here is the uber simple script, I'm ashamed to ask for help on this one, I know it must be something simple.


USER_WIN = C_Tick.IsShowing()
if (USER_WIN == "true")
{
Prize.Show()
}


Many thanks, Buns.
PS I have tried double and single quotes.

_________________
Opus Pro 7.04
Windows XP SP3
2GB
Athlon II X2 1.6GHz
ATI RAdeon HD 3200


For this message 3buns has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: Ridiculousy Easy Script Not Working
PostPosted: November 23rd, 2010, 11:18 pm 
Offline
Godlike
Godlike

Joined: November 11th, 2004, 1:18 pm
Posts: 1213
Location: New York
Opus: Opus Pro 9.75
OS: Windows 10 Pro 64 bit
System: Core i7, 16G RAM, Nvidia 640GT (desktop), plus Windows 10 and Android tablets
Hi,

I tried a slightly different script, and it worked:

Code:
USER_WIN = C_Tick.IsShowing()
if (USER_WIN == true)
{
Prize.Show()
}


true is a reserved term and probably needs to be without quotes.

HTH

Kind Regards,

_________________
Stephen


For this message Stephen has been thanked by : mackavi, Peensetes


Top
 Profile  
 
 Post subject: Re: Ridiculousy Easy Script Not Working
PostPosted: November 23rd, 2010, 11:35 pm 
Offline

Joined: June 9th, 2008, 7:37 am
Posts: 79
Location: Kent, UK
Thanks Stephen, perfect. I knew it would be something simple.

Much appreciated.


Cheers, Buns.

_________________
Opus Pro 7.04
Windows XP SP3
2GB
Athlon II X2 1.6GHz
ATI RAdeon HD 3200


For this message 3buns has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: Ridiculousy Easy Script Not Working
PostPosted: November 24th, 2010, 9:06 am 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
To expand on the issue slightly, it fails because the variable type is wrong.

It's expecting a Boolean response IE true or false (1 or 0) but by enclosing true in quotes you're essentially treating the value as a string. Because it's a Boolean, the code can be refined slightly:

Code:
USER_WIN = C_Tick.IsShowing()
if (USER_WIN)
{
Prize.Show()
}


or if you require false:

Code:
USER_WIN = C_Tick.IsShowing()
if (!USER_WIN)
{
Prize.Show()
}


Mack

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject: Re: Ridiculousy Easy Script Not Working
PostPosted: November 24th, 2010, 10:05 am 
Offline

Joined: June 9th, 2008, 7:37 am
Posts: 79
Location: Kent, UK
Thanks Mack, I will refine my code. I must admit I hadn't up to this point needed a Boolean expression, and it had me foxed as a string appeared to be showing in the text box.

Thanks for your help.

Cheers, Kurt.

_________________
Opus Pro 7.04
Windows XP SP3
2GB
Athlon II X2 1.6GHz
ATI RAdeon HD 3200


For this message 3buns has been thanked by : mackavi


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group