Script question
All  1-10  11-15

Previous
Next
 From:  Michael Gibson
12047.11 In reply to 12047.10 
Hi Frederick,

re:
> Why does a lower case name result in the toggling whereas an upper case name does not?
>
> It is clearly recognizing "front" because trying "xront" yields an error.

The error when using 'xront' is reported as an invalid function argument in the call to vp.reverseView().

I think the problem is something like one part of the script (the == operator) requires an exact case match with what is returned from viewpanel.mode while the parameter in the function call to reverseView() can tolerate different cases.

Do the scripts at https://moi3d.com/forum/index.php?webtag=MOI&msg=3808.2 do what you wanted?

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  fcwilt
12047.12 In reply to 12047.11 
Hi Michael

Yes all is good.

The problem was my use of all lower case names instead of having the first letter a capital.

Perhaps a code fix is in order so the case of the names doesn't matter so the scripts in all cases work as intended.

Thanks.

Frederick
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
12047.13 In reply to 12047.12 
Hi Frederick,

re:
> Perhaps a code fix is in order so the case of the names doesn't matter so the
> scripts in all cases work as intended.

That's something that would need to be fixed in the script.

Where your script is calling if ( a == b ) that's going to be a case sensitive comparison, that's how the Javascript == operator works with strings.

If you want it to be case insensitive you could do something like if ( a.toLowerCase() == b.toLowerCase() ) instead.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  fcwilt
12047.14 In reply to 12047.13 
Hi Michael,

Understood about the behavior of ==.

But I was referring to this:

"while the parameter in the function call to reverseView() can tolerate different cases"

Why is it desirable that that function isn't case sensitive.

Not a big deal, just curious.

Frederick
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
 From:  Michael Gibson
12047.15 In reply to 12047.14 
Hi Frederick,

re:
> Why is it desirable that that function isn't case sensitive.

It's a general design goal for the script API to try to do something with what it is given if it can reasonably figure it out.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All

 

 
 
Show messages: All  1-10  11-15