Page 1 of 2

Articy Script field conversion

Posted: Mon Aug 15, 2016 8:27 am
by irve
I am building instructions which run only once. Dialogue System seems to convert Articy strings in functions into variables, discarding quotes:

modify_once("category.variable", 2) gets converted into:
modify_once("Variable["category.variable"]", 2)

I think we'd like the strings to remain, as I see ourselves using set_name("some name") or similar at some point. For variables, now, it is possible to work around it and make a function which returns a number to add only once and then 0, but the syntax will confuse the writers a lot.

category.variable = category.variable + once(1) is the possible workaround

Re: Articy Script field conversion

Posted: Mon Aug 15, 2016 10:04 am
by Tony Li
As a rule, should the converter leave the contents of strings untouched? If so, I'll go ahead and make that change.

Re: Articy Script field conversion

Posted: Mon Aug 15, 2016 10:21 am
by irve
When thinking of Articy "dialect" of scripting, the converter should probably be able to convert ShowMessage("asd") and ShowMessage("quote \" quote") if we get lucky :)

Re: Articy Script field conversion

Posted: Mon Aug 15, 2016 10:52 am
by Tony Li
That's certainly do-able, too. So the converter will leave the content of strings untouched, except it will handle nested quotes properly.

Re: Articy Script field conversion

Posted: Thu Aug 18, 2016 8:49 am
by irve
It would help our cause to have this improvement in conversion.

Re: Articy Script field conversion

Posted: Thu Aug 18, 2016 9:18 am
by Tony Li
I'll try to have a patch ready for you by next Monday morning if not sooner.

Re: Articy Script field conversion

Posted: Tue Aug 23, 2016 10:30 pm
by Tony Li
Sorry for the delay in releasing this patch. It's now available on the customer download site.

Re: Articy Script field conversion

Posted: Fri Aug 26, 2016 6:05 am
by jghesquiere
Hello,

I have a question about Articy conversion too, so i post it here. (tell me if i have to make a new thread)

In Articy, i create a dialogue fragment that play a sequence with a picture. Here is the script :

Code: Select all

using UnityEngine;
using System.Collections;
using PixelCrushers.DialogueSystem;
using UnityEngine.UI;

namespace PixelCrushers.DialogueSystem.SequencerCommands {

	public class SequencerCommandShowImage : SequencerCommand {
		GameObject imgPanel;

		public void Start() {
			var currentEntry = DialogueManager.CurrentConversationState.subtitle.dialogueEntry;
			var imageName = Field.LookupValue(currentEntry.fields, "Image");
			Debug.Log(imageName);

			// A changer
			imgPanel = GameObject.Find("Image Panel UI");
			imgPanel.GetComponent<Image>().sprite = Resources.Load<Sprite>("Images/" + imageName);

			StartCoroutine(FadeUp());
		}

		public void Update() {
			if (Input.GetMouseButtonDown(0)) {
				StartCoroutine(FadeDown());
			}
		}

		public void OnDestroy() {
			imgPanel.GetComponent<Image>().color = new Color(1, 1, 1, 0);
		}


		#region Lerp Alpha
		IEnumerator FadeUp() {
			for (float time = 0; time < 100; time++) {
				imgPanel.GetComponent<Image>().color = new Color(1, 1, 1, time / 100);
				yield return new WaitForSeconds(0.001f);
			}
		}

		IEnumerator FadeDown() {
			for (float time = 100; time > 0; time--) {
				imgPanel.GetComponent<Image>().color = new Color(1, 1, 1, time / 100);
				yield return new WaitForSeconds(0.001f);
			}
			Stop();
		}
		#endregion
	}


}

With this script, I get the name of the picture (string) then I load the correct picture from the folder.
But when I try to set the "Dropdown as" field to Ints in the Articy Convert windows, it change my picture string to something weird as : 0x01000000000007E5
It works with Strings.

I need to set the "Dropdown as" to Ints because is use it for the others sequences.

How can I do ?

Thank you

Image

Re: Articy Script field conversion

Posted: Fri Aug 26, 2016 10:02 am
by Tony Li
Hmm, I'll take a look at the dropdown conversion rule and reply back on that later today. The "0x01000000000007E5" is an articy:draft internal ID.

However, the bigger issue is that it sounds like you want to convert some dropdowns as strings and others as ints. Currently the converter handles all dropdowns the same way.

What about including the image name in the sequencer command, such as: ShowImage(Dossier Obstetrical).

If that won't work for your needs, I could add an option to the converter to let you specify how to handle each dropdown. Let me know if you'll need this option.

Re: Articy Script field conversion

Posted: Fri Aug 26, 2016 10:51 am
by jghesquiere
Maybe it could be a great idea to implement this feature. :)
Are "Slots" in Articy works like dropdown ?
Because I use slots in Articy to drag n drop the correct picture.