Varskill - Printable Version +- SphereCommunity (https://forum.spherecommunity.net) +-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d) +--- Forum: Script Submissions (/Forum-Script-Submissions) +--- Thread: Varskill (/Thread-Varskill) |
Varskill - Crusader - 02-28-2013 05:24 AM Varskill <skillnumber> <value> is a function to take control over the skills we add to an item or a char. Code + 2 test items below. Any suggestions for bugfix, exploit, improving will be really appreciated Code: [FUNCTION VARSKILL] RE: Varskill - RanXerox - 02-28-2013 10:01 AM I would make the following suggestions: - don't use OBJ (OBJ is a global reference and some other script could clobber your reference or you could clobber theirs), use a REFn instead - when you are checking a TAG in an IF statement, use IF (<TAG0.whatever>) instead of IF (0<TAG.Whatever>) - instead of using ARGN to get passed-in arguments, use ARGV to see how many there are and ARGV[0] to get the first one and ARGV[1] to get the second one etc... - I would avoid creating tags that are just numeric... (in your example you are using TAG.<eval <ARGN>> and stuff like that... if gets confusing. Instead use TAG.Skill_<dARGN> - Since you don't use the LOCAL.tagcount inside the loops, this: Code: ON=@Equip could be simplified to: Code: ON=@Equip I think it would also greatly simplify the @unequip trigger to do that... At a glance I don't understand whats going on though. RE: Varskill - Crusader - 02-28-2013 06:14 PM Guess i need to do more explanations about this script: I need something like modstr/moddes/modint but for skills. Since there is no such command i was in dire need to create one to address the skillcap problem; How can i check if i'm at the skillcap because of my pure skill of because i dress enhancing skill items? i can undress e redress my char every time i do the check or ...more simply check if the char has a memory (i_mem_varskill) and look at what numeric exists on it. Every time i add something that raise skill, i create a tag.<skillnumber> on the memory which store the value. (that's why the numeric tag) in fact when i check i do: Code: [FUNCTION CHECKMEMSKILL] Now...the problems: Quote:- don't use OBJ (OBJ is a global reference and some other script could clobber your reference or you could clobber theirs), use a REFn instead Done Quote:- when you are checking a TAG in an IF statement, use IF (<TAG0.whatever>) instead of IF (0<TAG.Whatever>)I can't. If i use the other way i would get error in console -_- Quote:- instead of using ARGN to get passed-in arguments, use ARGV to see how many there are and ARGV[0] to get the first one and ARGV[1] to get the second one etc... ok, i'm gonna changing it, but i just take numbers, since is the only thing i'm working with (skill numbers) maybe i will put a def for the skills in order to use also skill names. Quote:- I would avoid creating tags that are just numeric... (in your example you are using TAG.<eval <ARGN>> and stuff like that... if gets confusing. Instead use TAG.Skill_<dARGN> I can't do that, for the reason i told u..otherwise i have to put a STREAT everytime i want to TRY the tags, so i guess it will slow down the process or just make it less efficient. Quote:- Since you don't use the LOCAL.tagcount inside the loops, this:ok, done __ Now, lil/big problems: when i do checkmemskill 0 or checkmemskill and i use IF <ARGN> or ARGS or whatever, for sphere is the same, but i need to check the difference (since, if i do checkmemskill 0, i'm gonna check if there is a Tag of alchemy in the mem of the player, while if i do checkmemskill, i'm gonna retrieve all the skill tags and values of the player) so i had to put argn > 0 and use a negative value to check all the tags... seriously? plus now i find some bugs while adding items with totally different skills coz when i unequip the first item the mem is also, getting char to lose skill points when he unequip the second item. (ofc, since u are a dev now, if u plan to do a modskill command, all this shit will be useless and i'll very happy to trash it ) RE: Varskill - RanXerox - 03-01-2013 01:44 AM To see if the function was passed an argument (even when the argument value is a zero), use IF (<ARGV>) |