Page 1 of 1

A way to start Designer Script from Code?

Posted: Sat Mar 14, 2020 7:09 pm
by Bugala
I am making a keyboard for Designer currentlly, idea is that it is like a code snippet that anyone could use and customize it for their own needs.
For this reason I try to avoid doing things through code if it can be done through designer, since by default the user who would use this keyboard, would not know how to program with Hollywood.

I am right now thinking of a solution to a problem which has to do with "Enter"-button.

I am currently having this numpad system where you can push number puttons and it displays them.

What I am trying to achieve right now is that when Enter button is pushed, it will go to this IF-ELSEIF-ELSE part, where you can put for example:

Code: Select all

IF input="1234" 
	reveal LAYER 1
ELSEIF input = "23144"
	Reveal LAYER 2
ELSE
	Show an Error
ENDIF
Idea would be for that "Show an Error" that it would for example display "Wrong Code" on display, play an error sample and then after 5 second go back to normal display.

I could easily do this through coding, but since this is meant for Designer users to use and customize, I would need some way to make in such way that users would have control for it through Designer.

What comes to my mind is that as Designer normally uses these Scripts (as in Scripts and Layers tab), would it be possible to jump to some specific script line through code?

That what I am hoping is that user could make separate place for script tab which would be that error sequence, where he could decide to show a text layer, play a sample, wait 1000 and then remove the text layer and display another - as example.

And then the code would hopefully be simply:

Code: Select all

ELSE
	JumpToScriptLocation "wrong code"
ENDIF
Is there any way to do this, or do you have some other suggestion how I could do this in such way that I could give control for the Designer user to fix the error or right code sequence through designer?

Re: A way to start Designer Script from Code?

Posted: Sat Mar 14, 2020 11:46 pm
by Bugala
As I was checking, looks like Action Object could be solution to my problem, but is there a way to start action object from code?

Re: A way to start Designer Script from Code?

Posted: Tue Mar 17, 2020 12:30 am
by airsoftsoftwair
Bugala wrote: Sat Mar 14, 2020 11:46 pm As I was checking, looks like Action Object could be solution to my problem, but is there a way to start action object from code?
Actually not, but could be worth an addition...

Re: A way to start Designer Script from Code?

Posted: Tue Mar 17, 2020 9:56 am
by Bugala
Yeah, was thinking the same, would open whole load of possibilities for non-coders.

As example I am thinking of that code part, if there would be way to start action objects, I could make basecode:

Code: Select all

IF code = "1234"
	StartActionObject("ActionObject1")
ELSEIF code = "1111"
	StartActionObject("ActionObject2")
ELSEIF code = "2222"
	StartActionObject("ActionObject3")
ELSE
	StartActionObject("WrongCodeActionObject")
ENDIF
This would make it very easy for regular users without coding experience to modify new codes and happenings, and those happenings can be all kinds of things.

Right now I am facing with problem that I am thinking it would be good if in case of Wrong Code it would for example display text "Wrong Code" for 5 seconds and then remove it.

This would be very easy to do with Action Object and would be easy for regular non-coder to customise, but right now I can see any other way but do it through code, and that means it isnt really customisable anymore, especially if they want to do some other animation than display "Wrong code" for example, basically only way for them to do it, would be to make another copy of the page and tell it to jump to that other page, but this is loads of trouble.

So yeah, possibility to start ActionObjects through code would make a big difference here.

Re: A way to start Designer Script from Code?

Posted: Wed Mar 18, 2020 12:20 am
by airsoftsoftwair

Code: Select all

- New: Added special code sequences to start and stop action events from user code; to start an
  action object, use %(OBJECTID; to stop it, use %)OBJECTID

Re: A way to start Designer Script from Code?

Posted: Wed Mar 18, 2020 9:28 am
by Bugala
ah, good point, didnt even think of possibility to stop then too, but yeah, that brings loads of possibilities, like action object timer that keeps counting second, push a paused button and stop the time action object and timer stays still until restarted again.

Re: A way to start Designer Script from Code?

Posted: Thu Apr 02, 2020 11:54 am
by Clyde
So, refering to Bugala's code, an call would look like this?:

Code: Select all

IF code = "1234"
	%("ActionObject1"
ENDIF
This looks very strange to me, especially the single opening bracket. Or did I misunderstand how to use it?

Re: A way to start Designer Script from Code?

Posted: Thu Apr 02, 2020 5:18 pm
by airsoftsoftwair
No, it's looks like this:

Code: Select all

%(ACTIONOBJECT1
i.e. without the quotes. Yes, it looks strange but it is consistent with other special phrases in Designer code like %>, %! and %@.