Maximus
1 May 2004, 05:44 PM
I was bored so I wrote this
Usage: .exp 2 5
calculates 2 to the 5th powerExponent cannot exceed 5If anyone thinks of a way to get this to work without exponent restrictions, then please let me know!
| CODE |
[function exp] local.x = <eval <strarg <args>>> local.exp = <eval <streat <args>>> if (<local.exp> == 0) || !<local.exp> message 1 return 1 elif (<local.exp> == 2) CALL exp2 elif (<local.exp> == 3) CALL exp3 elif (<local.exp> == 4) CALL exp4 elif (<local.exp> == 1) message <eval <local.x>> return 1 elif (<local.exp> == 5) CALL exp5 else sysmessage The exponent cannot exceed 5 return 1 endif
[function exp2] local.final = <eval <local.x> * <local.x>> message <eval <local.final>> return 1
[function exp3] local.temp = <eval <local.x> * <local.x>> local.final = <eval <local.x> * <local.temp>> message <eval <local.final>> return 1
[function exp4] local.temp = <eval <local.x> * <local.x>> local.temp2 = <eval <local.temp> * <local.x>> local.final = <eval <local.temp2> * <local.x>> message <eval <local.final>> return 1
[function exp5] local.temp = <eval <local.x> * <local.x>> local.temp2 = <eval <local.temp> * <local.x>> local.temp3 = <eval <local.temp2> * <local.x>> local.final = <eval <local.temp3> * <local.x>> message <eval <local.final>> return 1 |
Maximus
1 May 2004, 05:49 PM
I always forget to specify the version... 55r3rc3
Baube
1 May 2004, 07:39 PM
| QUOTE (Maximus @ May 1 2004, 05:44 PM) |
| If anyone thinks of a way to get this to work without exponent restrictions, then please let me know! |
Hello! my name is JyzJmz
| CODE |
[FUNCTION exp] local.number = <strarg <args>> local.number1 = <local.number> for <eval <streat <args>>+-1> local.number *= <local.number1> endfor return <local.number> |
SephDragoon
1 May 2004, 08:11 PM
or my version (sorry, gotta write one... shortest one wins).
[FUNCTION EXPO]//I renamed, because some people may have an EXP as in level system, like me.
LOCAL.NUMBER=1
FOR <eval <ARGN2>>
LOCAL.NUMBER=<eval <LOCAL.NUMBER>*<ARGN1>>
ENDFOR
RETURN <eval <LOCAL.NUMBER>>
Baube
1 May 2004, 09:00 PM
| QUOTE (SephDragoon @ May 1 2004, 08:11 PM) |
or my version (sorry, gotta write one... shortest one wins).
[FUNCTION EXPO]//I renamed, because some people may have an EXP as in level system, like me. LOCAL.NUMBER=1 FOR <eval <ARGN2>> LOCAL.NUMBER=<eval <LOCAL.NUMBER>*<ARGN1>> ENDFOR RETURN <eval <LOCAL.NUMBER>> |
Hey man, you used too many "eval's"

I win
SephDragoon
1 May 2004, 09:30 PM
mine is less lines, and I used ARGN1/2 which doesn't take up much compared to STREAT and STRARG

.
Tattooed_Corpse
1 May 2004, 09:37 PM
OK here we go again posting revisions of other people's submissions....
Baube
1 May 2004, 11:00 PM
[FUNCTION EXPO]//I renamed, because some people may have an EXP as in level system, like me.
LOCAL.NUMBER=1
FOR <eval <ARGN2>> // Used one time
LOCAL.NUMBER=<eval <LOCAL.NUMBER>*<ARGN1>> // Used 6times
ENDFOR
RETURN <eval <LOCAL.NUMBER>> // Used one time // Total:8
[FUNCTION exp]
local.number = <strarg <args>>
local.number1 = <local.number>
for <eval <streat <args>>+-1>
local.number *= <local.number1>
endfor
return <local.number>
Mine have a total of 3 "Useless things"
so the best thing would be:
| CODE |
[FUNCTION exp] argn3 = 1 for <argn2> argn3 *= <argn1> endfor return <argn3> |
Btw, my first function was only to help maximus because he's friend
And my other was to compete SpehDragoon because he's nice... hehe
SephDragoon
2 May 2004, 12:11 AM
| QUOTE (Tattooed_Corpse @ May 2 2004, 02:37 AM) |
OK here we go again posting revisions of other people's submissions.... |
| QUOTE (Maximus @ May 1 2004, 10:44 PM) |
| If anyone thinks of a way to get this to work without exponent restrictions, then please let me know! |
He kind of asked yah know.
Maximus
2 May 2004, 12:34 AM
lol.... this is amusing
Maximus
2 May 2004, 12:43 AM
Yeah earlier today, i was trying to figure out how to use a FOR loop, because thats what first came into my head, but i never figured it out, lol... and Tattooed, I did ask for help along with a submission, so it should be ok.
Tattooed_Corpse
2 May 2004, 03:05 PM
Well then post this in scripting help! This is for completed scripts...or did you forget to read that part?
Baube
2 May 2004, 04:24 PM
He posted a complete script.
He knew his script wasn't perfect but it still do the job.
We helped him.
There is nothing bad about it.
Tattooed_Corpse
2 May 2004, 08:05 PM
| QUOTE (Baube @ May 2 2004, 04:24 PM) |
He posted a complete script. He knew his script wasn't perfect but it still do the job. We helped him.
There is nothing bad about it. |
What is Bad about it is that people are having responsive threads on forum script submission section.
Please don't dispute this.
If it isn't ready then don't post a submission with a request.
I know you think I'm poking my nose and maybe I am, but it's all for the sake of clarity in the Submission Section.
I won't back down on this issue...
Period.
SephDragoon
2 May 2004, 08:13 PM
In other words... don't reply anymore and bump the thread up... (for those who don't know what it means). There are problems with that... so I hope this one clarifying the last one will be the last one... erm, yeah.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.