SphereCommunity
Passing a skill to a function - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: Passing a skill to a function (/Thread-Passing-a-skill-to-a-function)



Passing a skill to a function - Arcer - 04-29-2013 10:44 PM

Hi all,

I'm scripting a stone skill for custumazing the player skills.

The player can set his skill by usign +/- 1 +/-5 and +/- 10 buttons.

Is there a way to pass se skill object to a function??? like

on=1

f_upskill <src.archery>

[function f_upskill]

argo= <argo>+1.0


RE: Passing a skill to a function - darksun84 - 04-29-2013 10:52 PM

I think this can work
PHP Code:
ON=
f_upskill archery

[FUNCTION f_upskill]
args += 1.0 

Args contain the string Archery, so when the function is running the line :
args += 1.0
sphere will "evaluate" this line as
archery += 1.0


RE: Passing a skill to a function - Arcer - 04-29-2013 11:17 PM

(04-29-2013 10:52 PM)darksun84 Wrote:  I think this can work
PHP Code:
ON=
f_upskill archery

[FUNCTION f_upskill]
args += 1.0 

Args contain the string Archery, so when the function is running the line :
args += 1.0
sphere will "evaluate" this line as
archery += 1.0


nothing.....


but i've solved:

Code:
on = 2
f_upskill1 <src>, archery

[FUNCTION f_upskill1]
local.skillValue=<serv.uid.<argv[0]>.<argv[1]>>
if ( <local.skillValue> >= 1000)
    sysmessage Non puoi far salire la skill piu' di 100.0 con la stone!!
else
    serv.uid.<argv[0]>.<argv[1]> = <eval <local.skillValue> + 10>
endif