« on: April 28, 2017, 11:06:13 PM »
Hello guys, I am back after dealing with a long year of school, but I also have been thinking during this time. In approximately 3-4 weeks I will be out for summer, which I will have another idea composed after this one.
During my school, I have a E.A.S.T. class and mine is student-oriented, where as the student chooses what project they can work on. I have chosen program development using Apple Xcode (Macs were the only open computer at the time of project assignment).
New Script Syntax
A script syntax is very useful... it denotes how you set a command up and what not. Some syntaxes are harder to understand than others, but this one should make it simple for all the newcomers.
For one, I would like to give a DEFAULT VALUE for all commands which allows for quick experimentation for newcomers without the confusion of how to set the command up properly. Secondly, I want to make the syntax more, descriptive? I mean most of the basic commands have really descriptive documentation, but what about those really confusing commands that don't have documentation? Then it just adds a whole lot of confusion to the already big pile of confusion a newbie scripter faces.
TL;DR: I want to make the syntax more noob friendly as with scripts you can do amazing things.
New scripting features
One notable feature of Xcode is dynamic compilation/recompilation (Pre-building the script and rebuilding as necessary). This neat little feature will allow the program, as you make it, to scan for any rookie mistakes and errors. If a rookie mistake is found, it offers a "Fix It" which will correct your mistake. If it finds a rookie mistake but it will not lead to an error, it displays a warning triangle beside the line of the code that has a mistake in it, and it tells you that you can still compile the script, but certain functions will not work properly/at all. If it is a serious error that will prevent the proper execution of the script, or it would crash the game, it would prevent the compiler from building the code, often throwing an error.
Another thing that is notable about Xcode (and most IDE's including Visual Studio) is command prediction. What this does is while you are typing out commands, it will try to guess what command you are trying to insert; and within the selections, it shows you how to use the parameters of said command. This will help many beginner scriptures as it may take a while for some people to remember certain commands that they may need at a given time, but can't remember the exact name of said command.
Try/Catch statements (Also includes raise statement)
Many IDE's have a try/catch system where it will try a line/block of code and if any errors/specific errors arise it would continue execution, but alter the program via the catch statement to handle aforementioned error. This would be really useful for players who want to try to make server data integrity systems as from xbox360 version, if the remote player is lagging or their internet drops for a bit, some data may get corrupted and they may lose some data or they may lose it all together. You could potentially make a system in which it constantly refreshes the player's data with the server's expected data and in case of any discrepancies, be able to restore data back to normal.
As the command above helps resolve data errors, this command can be used in tandem with the try/catch system. To begin, you need to have 2 parameters the first one being a player target which is either local or global. If it is a local refresh then it performs said refresh on that device only. If it is global it performs said refresh on ALL devices. The second parameter is a refresh type. It can either be a data, world, or total refresh. A data refresh will send current data like inventory data, health data, skill data, etc. then it would request all that data back from the server. A world data refresh will ask the server host to resend world related data back to the client. This is only server to client, so it should be noted that when a client tries to manipulate the world data by forcing a client to server world data refresh should have their game shut down as a auto protection of sorts. A total data refresh will perform both a data and world refresh, making it like you just joined the game again, but you have not left the actual server. Now, you might be thinking "Well a hacker could manipulate the data and make god mode, max skills, etc." and you would be right. I have a way to circumvent this. What you do is take a SHA-256 Checksum of the data during gameplay and send it to the server for storage. Next you would send the data to the server and the server would perform the same SHA-256 Checksum calculation. If the two checksums match it would accept the data as accurate. If the data is changed in ANY way (right before the send, during transit of data, server receives data and experiences internet issues, etc.) it would reject the data as damaged. This would help prevent the basic "script kiddie" hacker from modding his inventory, health, etc. and the server accepting the change making it permeant. Now this system would obviously need refined as to not be vulnerable to basic hacks but also not so picky that if you pick one more gold up before the data is sent that the server rejects the change.
TL;DR: You could refresh the server data, world data, or both with this command. There will be a countermeasure to help protect against hackers.
This one should be simple. It would allow the storage of multiple comma separated values (here on in known as CSVs) in a single variable. It would be like setting something like the value of x to "1" but instead of just one number you have a list that looks like this: [1,4,24,9,123...] You could also perform specific array functions like getting the length of the array, inserting CSVs, deleting CSVs, etc.
This one might be complicated, but it would make server-wide data easy to store. What it would do is create a simple .txt or .svfile data file in the directory of the world under /WorldName/ScriptName/File.txt -or- File.svfile
This file could be accessed by ANY script at any given time and can be opened with the following modes: R for reading, W for writing, W+ for creating a file if it doesn't exist and opening the file for data writing. The data would be stored as JSON as to make it easy for scripts to differentiate values by reading the keys before the values
This one is simple. You could ban the player, their IP, or their Steam ID.
This would allow players to setup what's called a "Watchdog" which is a computer timer that ticks down from a given time until it hits zero. If the timer isn't reset (Commonly known as kicking or feeding the "dog") the timer would begin code that begins corrective actions of some sort. For example, in the Roblox game Traitor Town (a Trouble in Terrorist Town remake) if your internet connection gets so slow that the client doesn't respond to the server within 5 seconds you would be kicked. The parameters for this command are as follows: WatchdogTimer [name] [start|kick|stop] [time] [timeout]. The name parameter is blatantly obvious, its a reference point to the timer itself. the start, stop, or kick parameter is obvious too; it starts, resets, or stops the given timer. Time is also simple, in Milliseconds, how much time should the timer wait before timing out? And last but not least, timeout. Upon the timer running out without being reset, it will execute the given script.
(I thought of more but forgot what they were as I was typing this out...)