Announcement: Remember: you are giving away your fantastic ideas for free, and somebody else might even make money from them (or appear to). That's just how the world works! If you're worried about it, maybe you shouldn't post your ideas here.


Caravel Forum : DROD Boards : Feature Requests : Arrays for DRODscript (But non-continuous and also backwards)
New Topic New Poll Post Reply
Poster Message
hyperme
Level: Smitemaster
Avatar
Rank Points: 1261
Registered: 06-23-2006
IP: Logged
icon Arrays for DRODscript (+3)  
Arrays: they let you do stuff that's difficult or awkward with single variables. If you have an array, you can also have a stack, a queue or even a graph. With access to arrays or an array-like structure, some cool stuff could be done in DRODscript.

(In technical terms, they'd be more like maps, supporting negative indexes, and not requiring them to be continuous. But DROD already has a map :P)

Array variables would be defined like normal variables, but with a special character at the start, like . for local variables. I'm partial to @, but other options are available.

Reading an array is simple enough - write it out, followed by the index you want to access between square brackets. As with other things that take a number, you can put in whatever equations you want, allowing for dynamic reading. So you can say "@Var[0]" or "@Var[_MyX]" or even "@Var[(_O % 3) + (_O / 3)]" and you'll get a result.

Writing will require a new command. You choose an array variable, the index to write to, and what value or equation you want to write in. It should be possible to support something to allow writing to multiple indexes in one command. All the various numerical operators should be available for advanced manipulation.

Local arrays should also be possible, and can reuse most of the internal infrastructure. Plus they don't need to be persistant which is great.

For internal simplicity, arrays probably can't support strings.

____________________________
[Insert witty comment here]
Qzvlkx?
04-26-2024 at 07:43 PM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
Someone Else
Level: Smitemaster
Avatar
Rank Points: 2358
Registered: 06-14-2005
IP: Logged
icon Re: Arrays for DRODscript (+1)  
# might be a better indicator for arrays (it's a visual hint).
04-26-2024 at 09:49 PM
View Profile Send Private Message to User Send Email to User Show all user's posts High Scores This architect's holds Quote Reply
New Topic New Poll Post Reply
Caravel Forum : DROD Boards : Feature Requests : Arrays for DRODscript (But non-continuous and also backwards)
Surf To:


Forum Rules:
Can I post a new topic? No
Can I reply? No
Can I read? Yes
HTML Enabled? No
UBBC Enabled? Yes
Words Filter Enable? No

Contact Us | CaravelGames.com

Powered by: tForum tForumHacks Edition b0.98.9
Originally created by Toan Huynh (Copyright © 2000)
Enhanced by the tForumHacks team and the Caravel team.