nightname
|
  |
| Joined: 10 Jun 2008 |
| Total Posts: 8960 |
|
|
| 18 Feb 2012 04:55 PM |
I thought I would create a replica. I have not finished yet, but here is a working prototype:
event = { stuff = { func, connect = function(arg) arg(); end, fired = false, ready = false }, }
function event:Fire(arg) if event.stuff.ready then event.stuff.func(arg) else error("No function assigned to Event.", 1) end end
setmetatable(event, { __newindex = function(tab, ind, val) if (ind == "Event" and type(val) == "function") then event.stuff.func = val; ready = true; elseif ind ~= "Event" then error(ind.." is not a valid member of Event.",0); elseif type(val) ~= "function" then error("Event only accepts functions as a value."); end end })
--- --[[HERE IS WHERE THE FUN STARTS!]] ---
event.Event = function(arg) print(arg) end
event:Fire("Hi")
--> Hi
-------------
So I'll have add it to the Instance library, and some other stuff too. Fun! |
|
|
| Report Abuse |
|
|
stravant
|
  |
 |
| Joined: 22 Oct 2007 |
| Total Posts: 2893 |
|
|
| 18 Feb 2012 05:01 PM |
| Or you could use my signal class, which has everything normal events do including the far too underused "wait" method. |
|
|
| Report Abuse |
|
|
nightname
|
  |
| Joined: 10 Jun 2008 |
| Total Posts: 8960 |
|
|
| 18 Feb 2012 05:05 PM |
"Or you could use my signal class, which has everything normal events do including the far too underused "wait" method."
Yes, I've heard of your signal class thingy - but never really looked at it. No offence, but most libraries on Roblox are not really useful. For an example, Oysi's 3D GUI library is great - it gives you the ability to display 3D text - but it lags once it displays too many elements.
So what I am trying to say is, I avoid libraries because of the lack of use in normal situations.
Anyway, DON'T LISTEN TO STRAVANT - HE PROBABLY HAS SOME WEIRD, HARD TO READ FUNCTIONS THAT MAKE YOU GO BRAINDEAD. TRUST ME!!!
Heh.
|
|
|
| Report Abuse |
|
|
pighead10
|
  |
| Joined: 03 May 2009 |
| Total Posts: 10341 |
|
|
| 18 Feb 2012 05:11 PM |
| I only look at stravant's code when it's between noon and 6pm, anything before/after and I'm too tired. |
|
|
| Report Abuse |
|
|
nightname
|
  |
| Joined: 10 Jun 2008 |
| Total Posts: 8960 |
|
|
| 18 Feb 2012 05:12 PM |
"I only look at stravant's code when it's between noon and 6pm, anything before/after and I'm too tired."
Does it burn your eyes? |
|
|
| Report Abuse |
|
|
stravant
|
  |
 |
| Joined: 22 Oct 2007 |
| Total Posts: 2893 |
|
|
| 18 Feb 2012 05:14 PM |
| Hey, my Signal class for the RbxUtility library is probably the best commented piece of stuff on Roblox, it's got like, 2 lines of comments per line of code. Plus, the API is exactly identical to that of a normal event, so there's not much to figure out other than that "CreateSignal()" makes one, and ":fire(...)" fires it. |
|
|
| Report Abuse |
|
|
nightname
|
  |
| Joined: 10 Jun 2008 |
| Total Posts: 8960 |
|
|
| 18 Feb 2012 05:17 PM |
@Stravybaby
Link to your signal class?
Also, since I am a stalker - I looked at your stuff, and saw a bunch of relatively new decals. Are you making an RTS game?
If so - AWESOME, I love RTS games, and can you give us anymore details please? |
|
|
| Report Abuse |
|
|
nightname
|
  |
| Joined: 10 Jun 2008 |
| Total Posts: 8960 |
|
|
| 18 Feb 2012 05:19 PM |
I found it!
Here is the link for people who do not know where it is (PLEASE DO NOT BAN ME FOR POSTING THIS OFFSITE LINK:
http://codepad.org/2ADgpJON |
|
|
| Report Abuse |
|
|
nightname
|
  |
| Joined: 10 Jun 2008 |
| Total Posts: 8960 |
|
|
| 18 Feb 2012 05:22 PM |
@Stravybaby
Can you add a documentation similar to the one in Anaminus's gloo library? It would make things slightly more "awesomer".
|
|
|
| Report Abuse |
|
|
stravant
|
  |
 |
| Joined: 22 Oct 2007 |
| Total Posts: 2893 |
|
|
| 18 Feb 2012 05:45 PM |
I was working on some new RTS stuff, but those decals are totally unrelated, they're for all the gear I made recently.
http://www.roblox.com/CnV-Tests-place?id=179411
It's work to make a copy of RedAlert 2 in Roblox. I don't know if I'll do much more on it because it turns out that a lot of the features I would really want for it have too high a code complexity for me to figure out a good way to approach them. It does have full pathfinding code and some other nice things in it already though. |
|
|
| Report Abuse |
|
|
oxcool1
|
  |
| Joined: 05 Nov 2009 |
| Total Posts: 15444 |
|
| |
|
stravant
|
  |
 |
| Joined: 22 Oct 2007 |
| Total Posts: 2893 |
|
|
| 18 Feb 2012 06:01 PM |
| Assert doesn't give me control over what stack level to show the error on, error does. In my own code I use asserts, but for public API stuff you need to use error to make it clear what's an internal VS external error. |
|
|
| Report Abuse |
|
|
oxcool1
|
  |
| Joined: 05 Nov 2009 |
| Total Posts: 15444 |
|
| |
|
nightname
|
  |
| Joined: 10 Jun 2008 |
| Total Posts: 8960 |
|
|
| 18 Feb 2012 06:10 PM |
""error("Event only accepts functions as a value.");""
They should all have an error level of 0 - in that script. |
|
|
| Report Abuse |
|
|
nightname
|
  |
| Joined: 10 Jun 2008 |
| Total Posts: 8960 |
|
|
| 18 Feb 2012 06:12 PM |
"It's work to make a copy of RedAlert 2 in Roblox. I don't know if I'll do much more on it because it turns out that a lot of the features I would really want for it have too high a code complexity for me to figure out a good way to approach them. It does have full pathfinding code and some other nice things in it already though."
Amazing? You had the same Idea I had - but I had this idea over a year ago - but then decided to try and make in Java because I given up trying to make things on Roblox. However, at the time I did not know enough about Java to even write a simple pong game.
Please try to work on it - Red Alert was an awesome game! |
|
|
| Report Abuse |
|
|
stravant
|
  |
 |
| Joined: 22 Oct 2007 |
| Total Posts: 2893 |
|
|
| 18 Feb 2012 06:17 PM |
They should all have an error level of 0 - in that script."
In my opinion having level 2 is better, regardless if most of the Roblox API uses level 0.
"Please try to work on it - Red Alert was an awesome game!" That's the problem, even if I do more on it I can't make some of the features that I really need to do it in the RedAlert style, so to continue I'd have to think up a completely new game. |
|
|
| Report Abuse |
|
|
nightname
|
  |
| Joined: 10 Jun 2008 |
| Total Posts: 8960 |
|
|
| 18 Feb 2012 06:17 PM |
| How does stravybaby get modded? I mean - he is a mod. |
|
|
| Report Abuse |
|
|
nightname
|
  |
| Joined: 10 Jun 2008 |
| Total Posts: 8960 |
|
|
| 18 Feb 2012 06:18 PM |
Late post.
@stravybaby
Wait. You can make gears? I thought you were just a simple forum moderator - who lost his abilities - but then was given them back? |
|
|
| Report Abuse |
|
|
nightname
|
  |
| Joined: 10 Jun 2008 |
| Total Posts: 8960 |
|
|
| 18 Feb 2012 06:23 PM |
@stravybaby
I was looking at your code - and it looks like you followed a java-coding style. Anyway, why would you do this:
execute 'main' execute 'user' execute 'mapprovider' execute 'action' execute 'unit' execute 'alliedroleset' execute 'gameview' execute 'gamestate'
Not impressed. =/
|
|
|
| Report Abuse |
|
|
stravant
|
  |
 |
| Joined: 22 Oct 2007 |
| Total Posts: 2893 |
|
|
| 18 Feb 2012 06:33 PM |
"Anyway, why would you do this:"
If you look at the whole thing it's really quite clever. Since the code is quite massive, well upwards of 5000 lines, I have to keep it in quite a few files to make it manageable, and I also want to work on it in a better external editor.
However, that means that I need a good way to copy the code into the game, without having to do a lot of work. The solution that I found lets me do this: I simply Ctrl+A / Ctrl+C / Ctrl+V into the "Jumper" script. The "Jumper" script listens for it's source being changed, and when it it changed, it will read the name of the file which was pasted into it from a special comment at the start of the file.
It then copies that file's contents into a string-value in the game, these stringvalues contain the actual source code for the game.
This has another advantage though, since I now have all these separate files with their names saved, when I go to load the game I can load each chunk with it's correct file-name, so that when the code encounters and error I get the exact name of the file, and correct line for the files outside of Roblox, and I don't have to do an ugly translation of the line numbers of an error into my outside of Roblox line numbers.
It's really quite a nice system for working with a large code-base.
Of course, for the finished game when putting it out as a release I would strip all that info and compile it into a single big script, but for development purposes it's much nicer to have it the way it is right now. |
|
|
| Report Abuse |
|
|
nightname
|
  |
| Joined: 10 Jun 2008 |
| Total Posts: 8960 |
|
|
| 18 Feb 2012 06:58 PM |
@stravy
Interesting - however, I never actually use Roblox's script editor anymore. I use Notepad++ for saving and small edits.
However, when I work on projects - I use LuaEdit2010. What do you use? |
|
|
| Report Abuse |
|
|
stravant
|
  |
 |
| Joined: 22 Oct 2007 |
| Total Posts: 2893 |
|
|
| 18 Feb 2012 07:18 PM |
"Interesting - however, I never actually use Roblox's script editor anymore. I use Notepad++ for saving and small edits."
That's exactly what the system I described is for! It's for easily copying the work you do in another editor into your Roblox code-base to test it.
I use SublimeText. It's non-free but has a infinite trial version available which only occasionally asks you to buy a full version. It's far better than any other editor I've used. Any time I think of a feature I would want to have, it just magically has that feature somehow. Not to mention that it's filly cross-platform win/max/linux... and that's good cross platform too, it follows each platforms UI conventions and what not instead of just being good on windows and sort of okay on the others.
The key features for me: -It has a lightweight notion of "projects" which are lists of files + associated settings that you can open and close. It lets me have a "project" for each thing, such as my gear dev work, school programming stuff, and larger projects like Conquest. -It's really fast. You can throw 100K lines of code at it and it will still open fast and have the result syntax highlighted as you would expect. Also as fast as the system editor to start up. -It's got a cool idea where all of the settings are done via JSON config files. Which means no ugly settings menus, when you ask for some settings it'll open up the JSON settings file in the editor, which you can edit and save. -And as I said, it has such a large number of features that if you need something it probably has it. And if it doesn't you can use Python to write extensions for it. There's even a Clang plugin to give real code completion for C++ code in it and stuff like that. |
|
|
| Report Abuse |
|
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
|
| 18 Feb 2012 07:21 PM |
I use both Scite and Notepad++. I like Scite's syntax highlighting more than Notepad++'s, though. But I do like how Notepad++ automatically saves work, just in case my laptop dies or my computer randomly shuts down.
"Bro five! Wear this to let everyone know you think they deserve a high five." |
|
|
| Report Abuse |
|
|
Legend26
|
  |
| Joined: 08 Sep 2008 |
| Total Posts: 10586 |
|
|
| 18 Feb 2012 07:32 PM |
@Stravant,
Does it have an annoying issue of suggesting "does" when I have it in a comment instead of "do" when I try to make a for statement? SciTE's way of suggesting things is horrible. |
|
|
| Report Abuse |
|
|
nightname
|
  |
| Joined: 10 Jun 2008 |
| Total Posts: 8960 |
|
|
| 18 Feb 2012 07:40 PM |
Uh, do you use SublimeText 2 or Sublime Text 1.4? I love programming with a black background - but none of my editors have that.
LuaEdit2010 was fun because I could organize my stuff into projects, however it is not "that" good. |
|
|
| Report Abuse |
|
|