SphereCommunity
Defname calling - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: Defname calling (/Thread-Defname-calling)

Pages: 1 2


Defname calling - Indiaret - 08-16-2016 01:00 PM

Hi,

How can i call some piece of defname ? It's possible ? Because there is my script and it returns "0" instead of "hello".

[DIALOG d_settings TEXT]
<f_make_text>

[function f_make_text]
local.test=<n_word>
return "<local.test>"

[DEFNAME settings]
n_word "hello "

I need it to my settings of shard (easy way to change and keep variables).

Thank you.


RE: Defname calling - Criminal - 08-16-2016 04:09 PM

<DEF.n_word>


RE: Defname calling - Indiaret - 08-16-2016 09:21 PM

Thanks ... I lost a couple of hours why it doesnt work Tongue


RE: Defname calling - Indiaret - 08-16-2016 10:56 PM

One more question ... how can i get 'decimal number' from defname ? Because it automatically converting to hexadecimal.

If i type 256, i got 100 hexa ... but i guess it can be problem later in another script, where i use this number.

I have this :
n_global_default[00] "100"

and it returns 064.


RE: Defname calling - pointhz - 08-16-2016 11:40 PM

<eval <def.n_word>>


RE: Defname calling - Indiaret - 08-17-2016 02:15 AM

Yea it works, thank you .


RE: Defname calling - n1ghtwish - 08-17-2016 06:42 PM

or --

<dDEF.n_word>

save a little space in your file Wink


RE: Defname calling - Indiaret - 08-19-2016 03:19 AM

Well i have next problem ....

I need a short script, which determinates that i have weapon(in 1 or second hand) and gives me tag with UID of the weapon.

I have this, but this doesnt work. I dont know how to use if with layer - all variants with errors Sad.

Has somebody idea how to do it ?

[function weapon_char]
tag.weaponuid=0
if (<findlayer.1>)
if(findlayer.1.isweapon)
tag.weaponuid=<findlayer.1>
endif
endif
if (<findlayer.2>)
if(findlayer.2.isweapon)
tag.weaponuid=<findlayer.2>
endif
endif

[function isweapon]
if (type==t_weapon_sword)
elseif (type==t_weapon_fence)
elseif (type==t_weapon_mace_smith)
elseif (type==t_weapon_mace_crook)
elseif (type==t_weapon_mace_staff)
elseif (type==t_weapon_bow_run)
elseif (type==t_weapon_bow)
elseif (type==t_weapon_xbow)
else
return 0
endif
return <uid>


RE: Defname calling - darksun84 - 08-19-2016 04:44 AM

First, you should rename your function because the isweapon function already exists, it's a built-in function that determines if an item is a weapon or not. ( http://wiki.sphere.torfo.org/index.php/Items )

Second, you can just use the <weapon> reference for returning the weapon's uid. ( http://wiki.sphere.torfo.org/index.php/Characters )


[FUNCTION weapon_char]
if <weapon>
tag.weaponuid = <weapon>
endif


RE: Defname calling - Indiaret - 08-19-2016 09:44 AM

Nice ! Smile thanks