Posts: 51
Threads: 10
Joined: Nov 2014
Thanks: 29
Given 1 thank(s) in 1 post(s)
Are you confused by using Assault cube's "math operators"?You prefer using C++/C math operators? If so, this script was made for you!!
Code: alias cmop [
if (strcmp $arg2 +) [
+ $arg1 $arg3
] [
if (strcmp $arg2 -) [
- $arg1 $arg3
] [
if (strcmp $arg2 *) [
* $arg1 $arg3
] [
if (strcmp $arg2 div) [
div $arg1 $arg3
] [
if (strcmp $arg2 mod) [
mod $arg1 $arg3
] [
if (strcmp $arg2 powf) [
powf $arg1 $arg3
] [
if (strcmp $arg2 +f) [
+f $arg1 $arg3
] [
if (strcmp $arg2 -f) [
-f $arg1 $arg3
] [
if (strcmp $arg2 *f) [
*f $arg1 $arg3
] [
if (strcmp $arg2 divf) [
divf $arg1 $arg3
] [
if (strcmp $arg2 modf) [
modf $arg1 $arg3
] [
if (strcmp $arg2 !) [
! $arg1 $arg3
] [
if (strcmp $arg2 ==) [
= $arg1 $arg3
] [
if (strcmp $arg2 !=) [
!= $arg1 $arg3
] [
if (strcmp $arg2 <) [
< $arg1 $arg3
] [
if (strcmp $arg2 >) [
> $arg1 $arg3
] [
if (strcmp $arg2 <f) [
<f $arg1 $arg3
] [
if (strcmp $arg2 >f) [
>f $arg1 $arg3
] [
if (strcmp $arg2 =f) [
=f $arg1 $arg3
] [
if (strcmp $arg2 <=) [
<= $arg1 $arg3
] [
if (strcmp $arg2 >=) [
>= $arg1 $arg3
] [
if (strcmp $arg2 div=) [
div= $arg1 $arg3
] [
if (strcmp $arg2 div=f) [
div=f $arg1 $arg3
] [
if (strcmp $arg2 !=f) [
+ $arg1 $arg3
] [
if (strcmp $arg2 &&) [
&& $arg1 $arg3
] [
if (strcmp $arg2 ||) [
|| $arg1 $arg3
] [ hudecho (c 3) Alias M: Error in second argument ]
] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ]
]
Usage:
cmop number math-operator number
Ex:
echo cmop 6 + 5
Outputs: 11
PS:
I know that this script is extremely useless but who cares!Its my first time!
Posts: 591
Threads: 19
Joined: Jun 2010
Thanks: 3
Given 12 thank(s) in 7 post(s)
03 Dec 14, 08:15PM
(This post was last modified: 03 Dec 14, 08:20PM by Alien.)
it looks terrible, dont tell me, there is no list and find function in cube script and what is !=f ?
Posts: 51
Threads: 10
Joined: Nov 2014
Thanks: 29
Given 1 thank(s) in 1 post(s)
I know :( im trying to make assaultcube's scripting "language" simpler for C++ programers (like me) BTW every operator that ends to f means operator's argument's are float.
Posts: 51
Threads: 10
Joined: Nov 2014
Thanks: 29
Given 1 thank(s) in 1 post(s)
Also in cubescript there is something called strstr....
Please see the description of it....
Posts: 51
Threads: 10
Joined: Nov 2014
Thanks: 29
Given 1 thank(s) in 1 post(s)
03 Dec 14, 09:38PM
(This post was last modified: 03 Dec 14, 09:42PM by Mhtsos.)
And its not THAT awfull!
In cubescript:
+ 6 4
In C++:
6 + 4
In my script:
cmop 6 + 4
Posts: 376
Threads: 32
Joined: Apr 2014
Thanks: 0
Given 57 thank(s) in 33 post(s)
a) even a "C++ programmer" should be able to understand polish notation
b) you should learn cubescript, before you try to "improve" it
c) if you really need that: alias cmop [($arg2 $arg1 $arg3)]
Posts: 1,033
Threads: 85
Joined: Oct 2013
Thanks: 3
Given 37 thank(s) in 22 post(s)
Cubescript is annoying, and while C++ is more well-defined, C++ is in no way simpler. Cubescript uses pre-order instead of in-order operators. It's not that bad... C++ may seem simpler, but that's because growing up you were taught in order operators. Pre-order is cleaner. No need for annoying parentheses
In-order:
((1+2)*3+4)/5
Pre-Order
/ + * + 1 2 3 4 5
Posts: 51
Threads: 10
Joined: Nov 2014
Thanks: 29
Given 1 thank(s) in 1 post(s)
Ok guys DONT judge me that hard as i said its my first time!Its useful for me putting in order!Where is your problem?If you want something PERFECTLY written ask Bukz for it!!!!
Posts: 51
Threads: 10
Joined: Nov 2014
Thanks: 29
Given 1 thank(s) in 1 post(s)
Stef maybe you should learn cubescript before judging peoples scripts this script has no error and its working perfectly.
Posts: 376
Threads: 32
Joined: Apr 2014
Thanks: 0
Given 57 thank(s) in 33 post(s)
So, I should learn cubescript, to improve my 21-character script, which outperforms your 80-line monster? I'll get right on it :)
Posts: 1,038
Threads: 96
Joined: Jun 2010
Thanks: 23
Given 37 thank(s) in 14 post(s)
Why are you being harsh on him?
His script is clearly more natural than CS is!
Mhtsos job nice! err, I meant nice job Mhtsos!
Posts: 2,230
Threads: 32
Joined: Jun 2011
Thanks: 170
Given 333 thank(s) in 189 post(s)
(04 Dec 14, 07:01AM)Mhtsos Wrote: Stef maybe you should learn cubescript before judging peoples scripts this script has no error and its working perfectly.
You tell him bruv
Posts: 51
Threads: 10
Joined: Nov 2014
Thanks: 29
Given 1 thank(s) in 1 post(s)
(04 Dec 14, 11:30AM)stef Wrote: So, I should learn cubescript, to improve my 21-character script, which outperforms your 80-line monster? I'll get right on it :)
Yeah whatever its too long but I DONT CARE!!!Ok?Share your hate somewhere else!Is it working?If yes shut up and say something good for it!If its not working tell me how to make it work!Too simple!No need to judge!!!!
Posts: 1,033
Threads: 85
Joined: Oct 2013
Thanks: 3
Given 37 thank(s) in 22 post(s)
(04 Dec 14, 06:46AM)Mhtsos Wrote: Ok guys DONT judge me that hard as i said its my first time!Its useful for me putting in order!Where is your problem?If you want something PERFECTLY written ask Bukz for it!!!!
I'm not saying your script is bad, I'm just saying if you know C++, cubescript should be really easy for you. Also, what stef is saying is, when you call a command, say "cmop 1 + 2", 1 is $arg1, + is $arg2, and 2 is $arg3. Therefore, since you are writing the operator out verbatim, it's simpler to write "alias cmop [$arg2 $arg1 $arg3]"
Posts: 591
Threads: 19
Joined: Jun 2010
Thanks: 3
Given 12 thank(s) in 7 post(s)
"!=f == +" ? Show your naked girlfriend if you want positive feedback so much.
Posts: 51
Threads: 10
Joined: Nov 2014
Thanks: 29
Given 1 thank(s) in 1 post(s)
(03 Dec 14, 10:53PM)stef Wrote: a) even a "C++ programmer" should be able to understand polish notation
b) you should learn cubescript, before you try to "improve" it
c) if you really need that: alias cmop [($arg2 $arg1 $arg3)]
(04 Dec 14, 01:59PM)Mousikos Wrote: (04 Dec 14, 06:46AM)Mhtsos Wrote: Ok guys DONT judge me that hard as i said its my first time!Its useful for me putting in order!Where is your problem?If you want something PERFECTLY written ask Bukz for it!!!!
I'm not saying your script is bad, I'm just saying if you know C++, cubescript should be really easy for you. Also, what stef is saying is, when you call a command, say "cmop 1 + 2", 1 is $arg1, + is $arg2, and 2 is $arg3. Therefore, since you are writing the operator out verbatim, it's simpler to write "alias cmop [$arg2 $arg1 $arg3]"
Stef could say that a better way to write this script is alias cmop [$arg2 $arg1 $arg3]
Posts: 51
Threads: 10
Joined: Nov 2014
Thanks: 29
Given 1 thank(s) in 1 post(s)
(04 Dec 14, 02:46PM)Alien Wrote: "!=f == +" ? Show your naked girlfriend if you want positive feedback so much.
OK XD
Posts: 153
Threads: 3
Joined: Jul 2010
Thanks: 0
Given 0 thank(s) in 0 post(s)
On such a small engine its better to streamline code as opposed to bloating it.
Posts: 51
Threads: 10
Joined: Nov 2014
Thanks: 29
Given 1 thank(s) in 1 post(s)
04 Dec 14, 07:10PM
(This post was last modified: 04 Dec 14, 08:03PM by Mhtsos.)
Ok but i just want not being judged SO F*CKING HARD!
Posts: 153
Threads: 3
Joined: Jul 2010
Thanks: 0
Given 0 thank(s) in 0 post(s)
04 Dec 14, 08:13PM
(This post was last modified: 04 Dec 14, 08:17PM by MCS.
Edit Reason: correct my INNNNGLISHHH
)
I'm not judging your coding, I'm judging your little kid rants. You've been here, what? three days, and already you're screaming at people.
Posts: 51
Threads: 10
Joined: Nov 2014
Thanks: 29
Given 1 thank(s) in 1 post(s)
Ok i feel sorry about it TO EVERYONE ESPECIALLY TO STEF IM SO SORRY
Posts: 2,230
Threads: 32
Joined: Jun 2011
Thanks: 170
Given 333 thank(s) in 189 post(s)
OK CAN WE NOW LOCK THE THREAD? :D
Posts: 1,981
Threads: 63
Joined: Jun 2010
Thanks: 18
Given 93 thank(s) in 51 post(s)
05 Dec 14, 01:05PM
(This post was last modified: 05 Dec 14, 01:05PM by Luc@s.)
(04 Dec 14, 09:01PM)Mhtsos Wrote: Ok i feel sorry about it TO EVERYONE ESPECIALLY TO STEF IM SO SORRY
now please apologize for overusing caps.
|