How to count points in a nyx flash tease
Posted: Tue Jul 24, 2018 5:06 pm
I was asked recently if you can script something that counts points in a flash tease. So by visiting a specific page or pressing a button you can gather points, or maybe loose some. The final page(s) should be chosen according to the amount of points you gathered.
Well in flash it is certainly possible, but I wasn't sure about the Nyx 'script language', if you want to call it that. I tried for hours and hours and - actually I found a way. Since this might be useful for other people, I thought I should write a small howto.
This is the testing ground: https://milovana.com/webteases/showtease.php?id=38132
So first things first, here comes the sample code I came up with:
Remember that if you want to try this example, you need to reload the Nyx Editor after every run. If you don't, you won't get the correct results. This could actually be solved in the code using additional instructions, but I wanted to have this example as simple as possible.
The explanation for this code is in the next post.
Well in flash it is certainly possible, but I wasn't sure about the Nyx 'script language', if you want to call it that. I tried for hours and hours and - actually I found a way. Since this might be useful for other people, I thought I should write a small howto.
This is the testing ground: https://milovana.com/webteases/showtease.php?id=38132
So first things first, here comes the sample code I came up with:
Code: Select all
mustnot(702#,1001#);
mustnot(703#,1002#);
mustnot(704#,1003#);
repeatdel(20,1001#);
repeatdel(40,1002#);
repeatdel(60,1003#);
start#page('Test counting points.',
action:mult(
go(2#)
)
);
2#page('Page 2. Choose',pic("*.jpg"),
buttons(5#,"plus 10",6#,"plus 20",7#,"minus 10",30#,"results")
);
5#page(
'Added 10',
action:mult(
repeatadd(10,1001#),
repeatadd(10,1002#),
repeatadd(10,1003#),
go(2#)
)
);
6#page(
'Added 20',
action:mult(
repeatadd(20,1001#),
repeatadd(20,1002#),
repeatadd(20,1003#),
go(2#)
)
);
7#page(
'Minus 10. Sorry!',
action:mult(
repeatdel(10,1001#),
repeatdel(10,1002#),
repeatdel(10,1003#),
go(2#)
)
);
30#page('results will come up right away...',
action:mult(
goto(701#)
)
);
701#page('Page 701. Result is ...19',
action:mult(
go(start#),
goto(range(702,702))
));
702#page('Page 702. Result is 20...39',
action:mult(
go(start#),
goto(range(703,703))
));
703#page('Page 703. Result is 40...59',
action:mult(
go(start#),
goto(range(704,704))
));
704#page('Page 704. Result is 60...',action:go(start#));
1001#page('1001 counter',go(start#));
1002#page('1002 counter',go(start#));
1003#page('1003 counter',go(start#));The explanation for this code is in the next post.
