Non-threaded

Forums » Advanced Editor Forum » Read Thread

Get help from the experts on variables, scripts, items, and other scary things.

Recursive blocks of code...

8 years ago

I think I already know the answer, but I thought I should ask anyway in case I missed it somewhere.

Is there a way to repeat lines of script other than the tedious process of repetition?  I'm trying to make a shuffle type sequence and it is getting quite cumbersome.

Recursive blocks of code...

8 years ago
No. You simply cannot get recursive codes from simple if statements. You would need functions to do that, and the simple CYS script editor does not offer that. Unless you're not talking about the CYS script editor? If so, you can use JavaScript to make that possible. If you know JavaScript, that is.

Recursive blocks of code...

8 years ago

That's what I thought.  Sooooo, another stupid question:  Is it even possible to set game variables using JavaScript?

Recursive blocks of code...

8 years ago
Never tried it before, but I would think so. I think Bradin offers many examples of doing so in his storygames.

Recursive blocks of code...

8 years ago

@BradinDvorak ?

Recursive blocks of code...

8 years ago
Also. Remember the snail guy? I think he made a basic code editor that made it easier to do stuff like that.

Recursive blocks of code...

8 years ago

Yeah, Excuse_Me's code was just to put the whole game on one page, though.  I don't think it really interacted with CYS script.

Recursive blocks of code...

8 years ago

I've thought of ways to do that, but the best I can come up with is filling a page with various variable-changing links and using JavaScript to determine which one to follow. It's difficult to integrate the two languages in that way, because JavaScript runs in realtime, whereas CYS code runs only when a page is loaded.

Recursive blocks of code...

8 years ago

If you have a couple dozen or so different variables containing unique values and you wanted to shuffle (randomize) them ... it would lead to more possible combinations (links) than I'd care to create.

Recursive blocks of code...

8 years ago
I made up another program to write out a shuffle script. The script ended up being around 430 pages in Microsoft Word, to shuffle 48 cards, lol.

Recursive blocks of code...

8 years ago

Daaaang!  My simple script so far would be equivalent to "cutting cards" in various ways depending on a random seed and it is almost 400 lines long already.  I'm doing all the coding by hand and it's causing me loads of frustration.  I might have to abandon my project, but at least it's good practice.

Recursive blocks of code...

8 years ago
The program i wrote to do the writing was less than 50 lines, so its mich easier to do it that way.

Recursive blocks of code...

8 years ago

I might try to come up with something like that (unless you're willing to share?), but I'm really rusty.  I haven't programmed anything in well over a decade, I believe.

Recursive blocks of code...

8 years ago
You'd have to share th details of what you're trying to do for me to help with that lol.

Recursive blocks of code...

8 years ago

Geez!  I just did a quick calculation of a simpler method than the one I was aspiring to and it would be 2700 lines of script.  The one I was working on would be at least five times that!  XD

I may have to figure out an easier solution...

Recursive blocks of code...

8 years ago
With while loops and functions it'll take less a page.