English [Cyrus] Cs2d Lua Easy Coder (Jet) v1.0 icon

13 comments
16.07.17 04:46:29 pm
like 1 likes it!
3 kb, 14 Downloads
_3yrus
User
Offline Off
Hi there !
After that unsuccessful upload , i changed the code and improved it and optimized it too !

This is a mini framework that able you to write less and do more

Features :

∗ Defining Hooks Easily (all hooks are supported) :

Code:
1
2
3
4
5
6
7
#hookname {
     -- Lua codes !
}
-- E.g :
#spawn {
     equip(id,83)
}


∗ Improved Parse (@ or Jparse) With Infinite Inputs :

Code:
1
2
3
4
-- E.g :
#startround {
     @('bot_add_t','bot_add_ct',...)
}

hooks variables name's are as they in Cs2d.com

° For script out of hooks (like creating a function) you can use #initial :

Code:
1
2
3
4
5
6
7
8
9
10
11
12
#initial {
     -- anything you want
     -- E.g :
     initial_var = 'cool'
     function Example(arg)
          print(arg)
     end
}

#spawn {
     Example(id)
}


∗ Using Variables In String (just double quotation ") With $ Sign Before Variable Name (just like php ) :

Code:
1
2
3
4
5
6
-- E.g :
#spawn {
     x = player(id,'x') + 100
     y = player(id,'y') - 100
     @("setpos $id $x $y")
}


∗ Easy Way To Use Colors (just write - before colors rgb) :

Code:
1
2
3
4
-- E.g :
#startround {
     msg('-255255255Have Fun !')
}


And i promise i will improve it and add some amazing thing that u enjoy coding , just tell me your ideas to make scripting pleasant (also report bugs)

On the way :

> Custom Hooks

Instruction :

You have to write your jet scripts in a .jet.lua file (e.g : sample.jet.lua) and then run it as :
Code:
1
Jet('file path')


us Enjoy -- Comment
image
edited 12×, last 17.07.17 11:37:46 am
x This file has been reviewed and declined by Yates (18.07.17 01:31:28 pm)
The quality of the file is too low! Please invest more time and only upload stuff which is actually good. Do not upload your first "5 minute"-attempts. Sorry, but nobody wants to see and download stuff like that!

Comments

13 comments
Goto Page
To the start Previous 1 Next To the start

Log in!

You need to log in to be able to write comments!Log in
18.07.17 03:46:33 pm
Up
VaiN
User
Offline Off
"
you just mentioned one example , so write a easier way for this :
Code:
1
msg('-255000000$playername Level is : $playerlevel')

"
Code:
1
2
local s = string.format("%s%s Level is : %s", color.red, playername, playerlevel)
msg(s)

And yes, this is better because it's Lua, and doesn't require a separate parser to do it. Which also makes it more efficient.

Use a library for color codes! There's no reason to have to type out commonly used colors by hand in every message.
18.07.17 11:48:45 am
Up
Yates
Reviewer
Offline Off
@user Talented Doge:
table.concat()
ftw.

Lua copies the original value and creates a new instance when concatenating. Other languages do not. So concatenating strings in most other languages is fine.
18.07.17 11:13:14 am
Up
Talented Doge
User
Offline Off
I prefer concatenating variables outside of strings, disliked the way in C, php, etc.
18.07.17 09:17:40 am
Up
_3yrus
User
Offline Off
user VaiN : so its not going to be the best in the first version :).
about this :
"
And let's look at this example:

Code:
1
@("setpos $id $x $y")


How's that better than this:

Code:
1
setpos(id,x,y)

"
you just mentioned one example , so write a easier way for this :
Code:
1
msg('-255000000$playername Level is : $playerlevel')


and about variables name they are customizable in the code easily.

and thanks for tips
18.07.17 05:40:09 am
Up
VaiN
User
Offline Off
@user _3yrus: My feedback was also partially based on what @user Bowlinghead: was requesting. Seeing as he's the only one so far who has given this a like, I wouldn't want you to waste too much time where you don't need to.

Also, your system has fundamental flaws. You don't validate any Lua code within your hooks, and the files can't pass a Lua syntax check. So you'd have to have all of the jet stuff separate from the acutal Lua which defeats the purpose. It would likely cost more time trying to track down errors as well. If it's "JetScript" instead of Lua, then it might as well be Moonscript, which has syntax checking. You also don't take into account that hooks can have priorities. Your scripts have only global functions without a 'namespace' table, which could conflict with others' scripts. Your examples show references to parameters that the user can't name. What about hooks that have multiple parameters, what names will those have? How is looking that up supposed to save someone time? Jet might be a little less to type, but it does very little if anything to make things easier for the coder.

"not a shorthand for lua, it's a short hand for cs2d scripting" ... which is Lua. So yeah, shorthand for Lua. Just a much less complete and more specialized one.

You'd be better off creating a different hook system in Lua code. AMX2D managed this just by checking global function names for "hook_". That's an example of typing less to do more.

And let's look at this example:
Code:
1
@("setpos $id $x $y")

How's that better than this:
Code:
1
setpos(id,x,y)

This is even included with CS2D in sys/wrappers.lua

There are many ways to achieve what you are trying to do. Some of if could even be done with code snippets in Sublime Text.

Saving a few seconds of typing shouldn't require a separate script format and parser. But if that's what you want, that is exactly what moonscript is for. Seriously, I recommend you give it a try, it's a pretty cool scripting language in it's own right. And anyone who finds the concept of Jet interesting might very well find that interesting too.

Sorry to be so harsh. I just don't really like things that encourage laziness over efficiency. If someone can't be bothered to type out addhook() or parse() then using this isn't going to do them any favors in the long run.

You do seem to know Lua fairly well at least, so I hate to discourage you. I'll look forward to seeing what else you share.
17.07.17 02:05:51 pm
Up
_3yrus
User
Offline Off
user VaiN : my script is not a shorthand for lua ,its a short hand for cs2d scripting (for example easy hooks). These are diffrent.
17.07.17 12:58:54 pm
Up
VaiN
User
Offline Off
I see what you're trying to do, but why reinvent the wheel?

If you want shorthand Lua, it's already available in the form of moonscript. It's done properly, makes it easier to work with modules and class objects, and since it compiles to Lua it works anywhere regular Lua works, including CS2D.

Edit: This is a good place to start if you want to learn more.
edited 1×, last 17.07.17 01:11:33 pm
16.07.17 07:53:33 pm
like I like it!
Up
Bowlinghead
User
Offline Off
I like it. It just saves some time.
I dislike the design. It doesnt look like lua (but they are .jet.lua files so its ok)
There are still many questions left open:
How to combine normal scripts with your jet-scripts?
How to combine two jet scripts?

You need to add some unique things tho. Now I dont see the point installing it, as I save a few lines of .."".. and addhooks.
What about a simple object class thingy. You can save variables and functions in it and have a constructor to initiate it.
16.07.17 06:36:22 pm
Up
_3yrus
User
Offline Off
user Avo : how can u dislike it ?? variables in string is not cool ?
16.07.17 06:08:06 pm
Up
Avo
User
Offline Off
@user Rainoth: comments and off-topic spam

I still don't like it but now it looks less confusing (no angle brackets).
16.07.17 05:10:34 pm
Up
_3yrus
User
Offline Off
i wanted to remove that comments .
ok , forgot that whats your idea about new one ?
16.07.17 05:02:49 pm
Up
Rainoth
Moderator
Offline Off
Would be nice if you didn't remove and re-upload your updated file. Now all the comments are lost together with the feedback they provided.
16.07.17 05:02:06 pm
Up
Infinite Rain
Reviewer
Offline Off
You could've just updated the previous version instead of re-uploading.
To the start Previous 1 Next To the start