Raised This Month: $ Target: $400
 0% 

Thoughts


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Cr3V3TT3
Senior Member
Join Date: Jul 2004
Location: V'dauban
Old 05-15-2005 , 19:17   Thoughts
Reply With Quote #1

Just a thought about function definition

A function definition wich will work like a #define (macros) in cpp and like *_var(varname) in ES.

Code:
function "myfunc" 1 "echo $1"
             |    |    |
func name ---+    |    |
func params # ----+    |
func definition -------+

As :

Code:
es_setinfo myvar "test"
es echo server_var(myvar)
is took as:
Code:
es_setinfo myvar "test"
echo test
Code:
registervar "myfunc" 1 "echo $1"
es myfunc(So guess what ? IT WORK :])
will be taken as :
Code:
registervar "myfunc" 1 "echo $1"
echo So guess what ? IT WORK :]
@Anyone Does anybody need something like this ?

@Mani It' s a good idea?
(ps : i have a lot of stuff but i can break if you want and made some tries :])

Bye,
Cr3V3TT3
Cr3V3TT3 is offline
Send a message via MSN to Cr3V3TT3
Cr3V3TT3
Senior Member
Join Date: Jul 2004
Location: V'dauban
Old 05-16-2005 , 12:48  
Reply With Quote #2

Nobody love this ?

...

Simple example :

Server.cfg
Code:
function "add" 2 "es_math $1 + server_var($2)"
Whereyouwant.cfg
Code:
es_setinfo a 15
es_setinfo b 60
es add(a b)
echo a should be 75
es echo a = server_var(a)
This is an advanced example (More what i want to use with this function^^):
Server.cfg
Code:
es_setinfo __lib_pi_vars_a 0
es_setinfo __lib_pi_vars_b 0
es_setinfo __lib_pi_vars_c 0
alias __lib_pi_r_loop_0 es_format __lib_pi_vars_a "es_setinfo Player[%1].%2" __lib_pi_vars_b __lib_pi_vars_c
alias __lib_pi_r_loop_1 es server_var(__lib_pi_vars_a)
alias __lib_pi_r_loop_2 es_math __lib_pi_vars_b + 1
alias __lib_pi_r_loop_on __lib_pi_r_loop_0;__lib_pi_r_loop_1;__lib_pi_r_loop_2
alias __lib_pi_r_loop_off
alias __lib_pi_r_doloop "__lib_pi_r_loop; if ( server_var(__lib_pi_vars_b) equalto 64 ) then alias __lib_pi_r_loop __lib_pi_r_loop_off; if ( server_var(__lib_pi_vars_b) notequalto 64 ) then __lib_pi_r_doloop"
alias __lib_pi_r_iloop "alias __lib_pi_r_loop __lib_pi_r_loop_on;__lib_pi_vars_b 0;__lib_pi_r_doloop"

function "RegisterPlayerInfo" 1 "__lib_pi_vars_c $1;__lib_pi_r_iloop"

RegisterPlayerInfo(name)
RegisterPlayerInfo(userid)
This should register 128 vars :
Player[0].name
Player[1].name
[...]
Player[63].name
Player[64].name

Player[0].userid
Player[1].userid
[...]
Player[63].userid
Player[64].userid

yeah i can do it manualy but i think use this is cool :]
Cr3V3TT3 is offline
Send a message via MSN to Cr3V3TT3
ajax
Veteran Member
Join Date: Jan 2005
Old 05-16-2005 , 12:56  
Reply With Quote #3

seems like it would be a nice feature, but i don't have any need for this right now. i'm sure when i find a way to use it, i'll want it very much.
ajax is offline
Cr3V3TT3
Senior Member
Join Date: Jul 2004
Location: V'dauban
Old 05-16-2005 , 13:12  
Reply With Quote #4

Quote:
Originally Posted by ajax
seems like it would be a nice feature, but i don't have any need for this right now. i'm sure when i find a way to use it, i'll want it very much.
In fact, its not realy usefull, its more for script-styling ^^

I think :
Code:
function "LoadLib" 1 "exec ES_LIB/$1.rc"

// Is greater than, less, ect..
LoadLib(Comparse)

// Run lib' s commands
LoadLib(Events)

// Player[id].{info} , require EventLink
LoadLib(PlayerInfo)
Got a better looking as :
Code:
// Is greater than, less, ect..
exec ES_LIB/Comparse.rc

// Run lib' s commands
exec ES_LIB/Events.rc

// Player[id].{info} , require "Events"
exec ES_LIB/PlayerInfo.rc
and you can do something like
Code:
function "LoadLib" 1 "echo Loading $1 Module...; exec ES_LIB/$1.rc;echo Module $1 Loaded..."
Cr3V3TT3 is offline
Send a message via MSN to Cr3V3TT3
ichthys
Veteran Member
Join Date: Dec 2004
Location: []*[]
Old 05-16-2005 , 13:24  
Reply With Quote #5

Im not really understanding all of it. Never use "cpp" or whatever that is.
I dont really have any use for it now. But like ajax said.....might later.
__________________
ichthys is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:43.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode