Sorry about that. I'm still not entirely familiar with the system that this site uses. I often have to manually cut out the parts of a reply that I am not referring to when I quote someone because I don't know how to use do it otherwise. Where exactly do I click to use that plain text editor you mention, for example?
The top-left button; looks like a toggle switch, above 'Bold' and to the left of 'Remove Format', toggles modes.
That's a very nice and easy to understand example on running a script from an item. Thankfully, I've gotten far enough in my understanding of Zscript to know what this all means now.
An example of nested loops, including while, and do-while. If you want examples of nested for loops, alert me. In terms of common use, to me in ZScript, it's in the order of for, while, do. To accomplish most of the magic that I need, with the smallest footprint, for loops are my dolly.
Can you provide some example code of how to use that DrawScreenToLayer function you're referring to? Keep in mind that I still have some trouble with getting Screen->DrawTile to work properly. And how exactly would the cursor you're referring to be controlled? Also, what library is it in?
Indeed, but you'll need the function itself too. Do you use Skype? It would be easier, and less cluttering, to discuss this with you directly. I'd PM you, but I'm running quite low on mailbox space here, and I need to go through, archive, and remove discussions.
Here's the function though, and one usage example:
void DrawScreenToLayer(int sourceMap, int sourceScreen, int layerMin, int layerMax, int drawOpacity, int destLayer){ for (int i = layerMin; i < layerMax; i++){ Screen->DrawLayer(destLayer, sourceMap, sourceScreen, i, 0, 0, 0, drawOpacity); } }
There is also a variation on this, with the destLayer arg, that draws hardcoded to layer 0, but most people will want layer control.
You'll see the power of the for loop though: One instruction, that carries out layer drawing multiple times, to the layer range specified.
Example:
DrawScreenToLayer( 1, 30, 0, 6, 100, 5 ); //Draws screen 30 of MAP 1 (note, MAP, not DMAP); layers 0 to 6, at 100% opacity, to the present screen, on layer 5.
At present, these are in TeleportMatrix2.1.zs , not in RPG.zh. I'll be moving the drawing functions over to the header presently.
Note also, that this draws for one frame. If you want it to draw perpetually, you need to call that in a while loop; and if you want it to draw for a specific duration (timed) you call the function from a for loop. Effects of drawing functions, are by their nature, extant for one frame, so that they can be continually updated.
This code is a vast improvement over what I created. Of course, the idea of making a while loop that just did nothing was something that I only recently began to understand. I could post my own coding attempt, which contains no instructions on how to use the songs once they've played. (And doesn't work.)
Indeed. The eccentricities of ZScript take a good while to comprehend. Again, post it, if you want us to point out where its problems lay, so that you can see what others may've done, and learn from any errors.
As the end product, I was thinking that there would be one item which would check for the acquisition of other items (for the songs) and when you used it, Link's appearance would change while it was being used (via whatever method would work best) and you could then select only the songs you had learnt
Well, the item itself, no-matter what you want it to do, needs to either run an FFC, or set a global boolean that permits your main active script to execute a codeblock tied to it. I wouldn't let the item script make any 'decisions', as that limits what you are able to do, given that whatever the item script does runs only for one frame, and then exits.
As for the songs themselves, one would be a warping around the world; one would trigger special warp points (like I have in another script that already works) and the third would warp you no matter where you were. Sort of a cross between the ocarina and magic mirror from LTTP. I've seen a script that could do the magic mirror and I have a script that does the warping at special warp spots, but not one that does both and warps you around to certain areas.
I've written both a mirror item (for another user here), and various teleportation items. If you want to try out how those work, the Teleport Matrix is a default item in LoE. If you have trouble working this out, I'd be willing to assist you.
My idea for using this is one of those things that hasn't been used (to my knowledge) in a game yet. I'll probably explain it better in my next list of suggested scripts.
Fair enough.
Really? I was thinking it would harder. Truth be told, I only suggested this because years ago I made a very basic Final Fantasy-esque battle system using nothing more than a graphing calculator and a coding language two steps removed from Basic. It is on the basis of what I learned then that I've studied Zscript over the past few months. I'm leaps and bounds ahead of where I was when I started but nowhere near proficient enough to do something like this. It isn't that much of a priority. My system can't run the sort of advanced RPG creation games that exist, so if I want to make a game I'm pretty much stuck using Zelda Classic.
Truth be told, without using Tango, making that work would be a gigantic, painful, mess. With Tango, if you know how to use it, it's rather straightforward. It's primarily menu dialogues... The combat dynamics of selecting a player, defining hit chances, and enemy-size random actions, are all rather elementary. If people want this in RPG.zh, I'll eventually include it, with an example quest.
I could probably even tie the enemy editor into that kind of engine, to define enemy HP, and other variables; despite never directly placing enemies in a game of that sort.
Arrays are one of those things I've always had trouble with. My ideas for events are really much, much simpler. For example, one game I made in RPG Maker 3 on PlayStation 2 had a series of events (read ffcs for Zelda Classic) that would never activate unless you went up to them and examined them. If you did, it would increment an in-game counter. If you get to a certain point in the game and the counter was a above a certain level, you'd go one way. If not, another.
Think of an array as a table of variables, all sharing the same type.
int MyVars[10]={0,0,0,0,0,0,0,0,0,0};
Here, you have an array, 'MyVars'. Instead of making ten game variables, you can instead tie anything you would normally associate to an int variable, to one index of MyVars.
Thus, instead of:
int day = 1; int week; void adjustWeek(){ if ( day > 7 ) { day = 1; week++; } }
...you do this:
const int DAY = 0; //Assigns the constant 'DAY" to 0, so that we can use it to point to index '0' of MyVars. const int WEEK = 1; //Assigns the constant 'WEEK" to 1, so that we can use it to point to index '1' of MyVars. int MyVars[10]={1,0,0,0,0,0,0,0,0,0}; //The array declaration states a size of 10. This means that you have ten indices, from '0' to '9'. //All user-defined arrays start at '0'. //We're going to track days, and weeks with the first two indices, and at the start of the game, we'll be on day 1. //Thus we initialise the first index with a value of '1' and the rest with '0'. We can immediately use the first two, for days and weeks, and the rest later. //We can expand the size of this array if needed. void adjustWeek(){ if ( MyVars[DAY] > 7 ) { //Checks index 0 of the array MyVars to see if it is greater than 7. MyVars[DAY] = 1; //If so, it changes [i]the value stored in [/i]that index back to '1'. MyVars[WEEK]++; //and adds +1 to the [u]value[/u] stored in index '1' of MyVars. } }
That's the general idea. There are also faster, and easier ways to read them, and to make evaluations based on array contents, without needing to continually type out the array name, and index position. You can make shortcut functions, and as long as you assign constants to all index positions, you could tuck every single variable in a game into one large array, and read them with about the same ease as you would by using ordinary var names.
In Zelda Classic, you could have secrets triggered that led to one set of one-time events if you went one way and another set for the other. The player would never know that the other events existed unless the counter and associated ffcs were reset to their original status. Or you could have it where all the triggered events were only available through one-time events and if you didn't trigger them, secrets wouldn't be activated on another screen that led to more one-time events.
I could go on about how I set up events, but the simple explanation is that I have global conditions that look for specific triggers (that can be any condition, or combination of conditions, from a combo type on a screen, to a time value in my custom game clock, to defeating an enemy, or collecting an item, or whatever that I desire).
If those triggers occur, the game sets an index in GameEvents[] to true. If that index is true, if statement codeblocks execute.
Currently using Notepad, because my standard word processor doesn't format it right and I can't afford to pay for anything else. Look for more outlandish scripting ideas later!
You are missing out on two, powerful, open-source, and free code editors...
SciTE (my preference) is a lightweight code editor for Windows.
Notepad++ is another very popular option. It has more features than SciTE, and otherwise runs on the same engine.
There is also a special code editor for ZScript that another member developed, although I don't recall the name of that project off-hand, and the word 'code' is not a valid search word for some reason.