JayPee Posted March 16, 2012 Share Posted March 16, 2012 This is just a additional script command for Math Function. Since I dont know yet on how to make a .diff file we will just do it manually. Function: abs(<numbe); 1.) Edit src/map/script.c 2.) Find BUILDIN_FUNC(distance) then add this below //JayPee Additional Math Function: absolute BUILDIN_FUNC(abs) { int a; int x; x = script_getnum(st,2); a = abs(x); script_pushint(st,a); return 0; } 3.) Now find BUILDIN_DEF(set,"rv"), then add this below. BUILDIN_DEF(abs,"i"), //JayPee 4.) Recompile your server. Quote Link to comment Share on other sites More sharing options...
xRaisen Posted April 29, 2012 Share Posted April 29, 2012 thanks! ive been looking for this! see this http://rathena.org/board/tracker/issue-5529-grouprandomitem-scriptc/page__gopid__8170#entry8170 Quote Link to comment Share on other sites More sharing options...
Brian Posted April 30, 2012 Share Posted April 30, 2012 And in case anyone needs it NOW before recompiling and restarting, you could use a script function: function script abs { [email protected] = atoi(getarg(0)); return ( ([email protected] < 0) ? [email protected] : [email protected] ); } thanks to the r15982: Script Engine Update ! 1 Quote Link to comment Share on other sites More sharing options...
xRaisen Posted April 30, 2012 Share Posted April 30, 2012 Hihihi.. You guys are awesomeness! Quote Link to comment Share on other sites More sharing options...