Writing code that writes code (for long Nyx teases)

Post all technical issues and questions here. We'll gladly help you wherever we can.
Post Reply
eteased
Explorer At Heart
Explorer At Heart
Posts: 171
Joined: Sat May 26, 2007 4:09 pm
Contact:

Writing code that writes code (for long Nyx teases)

Post by eteased »

Writing code that writes code (a geeky yet effective way to write long Nyx scripts)

For awhile now I've been playing around with a way to make my Nyx script-writing time more efficient. I don't know about others, but I've found that:
  • Working with the Nyx Visual interface is OK, but it's slow and is missing key functionality (like sounds and randomness)
    Writing scripts directly in the script editor is very error-prone, and also very very slow when you have a long script (100+ pages)
    Writing scripts offline (in some sort of text editor) is OK, but it's also fairly mistake-prone. Typos are likely and can take awhile to debug.
Due to the above, I came up with my own little solution to make the script-writing process more pleasant... I use Excel. (That may sound odd at first, until you realize that Excel is like the greatest, most versatile software ever.

Here's how it works: I have a workbook with 2 worksheets. The first is called INPUT, and this is where I define the tease. It's set up so that you enter one row of info per page of the tease. Each column contains specific data about the page. For example, column A is for the page name (e.g, start#), column C is for the name of the picture for that page (e.g., myPic.jpg), and so on.

Then I run a macro (which I wrote, obviously) that reads the INPUT and writes the script for me on the OUTPUT worksheet. I have to say, the process has made my tease-writing life a lot easier. If you're interested in this approach, feel free to contact me and I can send you a copy of the Excel file with an example script in it. I'll also post it in my Yahoo group (http://groups.yahoo.com/group/eTeased/files/ and look for scriptmaker v7.xls).

A few points to note:
  • It uses a macro, so obviously you have to be OK with that. (Microsoft likes to give you some security warnings about running macros)
    This approach can handle a lot of Nyx functionality, but not everything is possible. Certainly any Nyx functionality that I don't understand or know about isn't supported. :-)
    I made it in Excel 2007. Seems like it should work in Excel 2003 as well, but I haven't actually tried that.
Anyway, hopefully someone will find it useful. I know I personally would never have created my Rock Paper Scissors or Blackjack teases without this technique.
eteased
Explorer At Heart
Explorer At Heart
Posts: 171
Joined: Sat May 26, 2007 4:09 pm
Contact:

Re: Writing code that writes code (for long Nyx teases)

Post by eteased »

yep, I pretty much always save-as .xls. (And yes, by default Excel 2007 will save new files in a new .xlsx format.)
User avatar
cumhardy
Experimentor
Experimentor
Posts: 1139
Joined: Wed May 28, 2008 10:54 pm
Gender: Male
I am a: None of the above
Location: UK

Re: Writing code that writes code (for long Nyx teases)

Post by cumhardy »

I only have excel 2002, do you think it would work in thaT?
eteased
Explorer At Heart
Explorer At Heart
Posts: 171
Joined: Sat May 26, 2007 4:09 pm
Contact:

Re: Writing code that writes code (for long Nyx teases)

Post by eteased »

cumhardy wrote:I only have excel 2002, do you think it would work in thaT?

I don't know of any reason why it wouldn't work. You should be able to test it fairly quickly by following these steps:

1. Download the file and open it up
2. Delete everything on the OUTPUT sheet. Leave the INPUT sheet as-is
3. Click the button on the Instructions sheet -> The macros should run and create a script on the OUTPUT sheet
4. Login to the Nyx editor, create a new tease and go to the Script tab
5. Copy the script from the OUTPUT sheet in Excel (select everything in column A) and paste it into the script tab of the Nyx editor
6. In Nyx, click Save and then Preview -> The sample tease should run

Of course there won't be any pictures or sounds (since you didn't upload any), but the pages / buttons / timers / navigation should all work.

Give it a try and let us know if it works
Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests