SphereCommunity
Error in a script. Help! - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: Error in a script. Help! (/Thread-Error-in-a-script-Help)

Pages: 1 2


Error in a script. Help! - Lazarus - 07-08-2012 06:33 AM

Hi! first, sry for my english ^_^
My script team friend are trying to do a new script of a item. A part of the script get's a error.

this is the part:

Code:
[ITEMDEF i_desmontar_despues]
id=i_hat_wizards
type=t_eq_script
on=@create
ATTR=attr_can_decay
try <TOPOBJ.UID> LINK.events -e_nopodesmontarpibe

And the error:

Code:
boleadoras.scp,49)Can't try 040001ce6 LINK.events -e_nopodesmontarpibe object pibeloco (040001ce6)

Anyone knows what is happend ?

thanks ^_^


RE: Error in a script. Help! - Extreme - 07-08-2012 07:18 AM

try <TOPOBJ.UID> events -e_nopodesmontarpibe
or
try <TOPOBJ.UID> TOPOBJ.events -e_nopodesmontarpibe


RE: Error in a script. Help! - Gil Amarth - 07-08-2012 07:21 AM

Or better:

REF1 = <TOPOBJ.UID>
REF1.LINK.events -e_nopodesmontarpibe

Nevertheless, ON=@CREATE it´s a very bad trigger to put this code. It fires before to be positioned on the world, so there is no TOPOBJ to use.


RE: Error in a script. Help! - Extreme - 07-08-2012 12:14 PM

(07-08-2012 07:21 AM)Gil Amarth Wrote:  Or better:

REF1 = <TOPOBJ.UID>
REF1.LINK.events -e_nopodesmontarpibe

Nevertheless, ON=@CREATE it´s a very bad trigger to put this code. It fires before to be positioned on the world, so there is no TOPOBJ to use.
You're absolutely right =D


RE: Error in a script. Help! - Skul - 07-09-2012 11:01 AM

why not use @equip, see it is t_eq_script people can equip this right? Add and remove the event with @equip and @unequip. Or is this an item that is placed in the pack? If so use TIMERF 1, topobj.events -e_nopodesmontarpibe under @create

Code:
on=@create
attr=attr_can_decay
timerf 1, f_nopodesmontarpibe

[function f_nopodesmontarpibe]
if (<topobj.ischar>)
toptobj.events -e_nopodesmontarpibe
endif



RE: Error in a script. Help! - gonnie - 07-10-2012 02:29 AM

thank you guys i finally used the timerf which i didn't know about and it went great =o

i'm really new in this scripting thing. Is there any documentation besides the spherewiki that i can read to help me scripting? cos that timerf function doesn't appear in the wiki D:

i'm now trying to paralyze a target, how can i modify their flags :/

Code:
[function f_unpara]
FLAGS=<flags>&~statf_freeze

[EVENTS e_para_on_hit]
ON=@HIT
ARGO.FLAGS=<ARGO.FLAGS>|statf_freeze
ARGO.timerf 5, f_unpara
13:16:ERROR:(boleadoras.scp,51)Can't resolve <ARGO.FLAGS>
13:16:ERROR:(boleadoras.scp,51)Undefined keyword 'FLAGS'
13:16:ERROR:(boleadoras.scp,51)Undefined keyword 'ARGO.FLAGS'
13:16:ERROR:(boleadoras.scp,47)Can't resolve <flags>
13:16:ERROR:(boleadoras.scp,47)Undefined keyword 'FLAGS'


RE: Error in a script. Help! - RanXerox - 07-10-2012 04:49 AM

ARGO in @Hit is the weapon in the attackers hand is it not?


RE: Error in a script. Help! - Skul - 07-10-2012 08:01 AM

That's right Ran, you also need to use timerf to set the freeze flags in this scenario since @hit and @gethit are triggered before the hit is actually send through.
Code:
on=@hit
src.timerf 1, f_para //paralyze
src.timerf 6, f_unpara //unparalyze

[function f_para]
flags |= flags
update //update status bar



RE: Error in a script. Help! - Lazarus - 07-10-2012 10:03 AM

(07-10-2012 08:01 AM)Skul Wrote:  That's right Ran, you also need to use timerf to set the freeze flags in this scenario since @hit and @gethit are triggered before the hit is actually send through.
Code:
on=@hit
src.timerf 1, f_para //paralyze
src.timerf 6, f_unpara //unparalyze

[function f_para]
flags |= flags
update //update status bar

Can I put the freeze with the hit on the same time?
like don't wait 1 second to the paralyze and get the incoming damage anyways?.

Sry for my english.
I'm a buddy of Gonnie

Thanks ^_^


RE: Error in a script. Help! - Extreme - 07-10-2012 10:15 AM

Try this:
Code:
ON=@HIT
SRC.FLAGS=<SRC.FLAGS>|STATF_FREEZE
SRC.TIMERF 5,FLAGS=<FLAGS>&~STATF_FREEZE
PS: I think SRC in @HIT is the attacked character, if NOT, just fix.