SphereCommunity
LINK - Printable Version

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



LINK - Llirik - 03-14-2016 05:02 AM

My construction is true? I'm use LINK at the first time!

[EVENTS e_repair]
ON=@ContextMenuRequest
src.addcontextentry 111,3000089

ON=@ContextMenuSelect
if (<distance> <= 3)
if <argn>==111 // Repair
src.newitem i_target_repair
src.act.target What item do you want to repair?
NEW.LINK=<UID> // ?
endif
else
src.sysmessage Too far away from the Vendor
endif

[ITEMDEF i_target_repair]
TYPE=t_eq_script

ON=@TargOn_Item
if (<LINK.DISTANCE> <= 5) // ?
if <src.targ.isweapon> || <src.targ.isarmor>
if <src.targ.hits>==<src.targ.maxhits>
src.sysmessage The item is already in full repair.
else
IF (<SRC.GOLD> >= (<SRC.TARG.MAXHITS>-<SRC.TARG.HITS>)*<SRC.TARG.TAG0.REPAIR>+1)
SRC.GOLD -= (<SRC.TARG.MAXHITS>-<SRC.TARG.HITS>)*<SRC.TARG.TAG0.REPAIR>+1
SRC.UPDATE
src.targ.hits=<src.targ.maxhits>
src.targ.update
src.emote repair the <src.targ.name>
ELSE
LINK.SAY You lack <eval (<SRC.TARG.MAXHITS>-<SRC.TARG.HITS>)*<SRC.TARG.TAG0.REPAIR>+1> gold! // ?
ENDIF
endif
else
src.sysmessage The item is not repairable
endif
else
src.sysmessage You can't reach the Vendor
endif
remove
return 1

Thank you!


RE: LINK - Khaos - 03-14-2016 05:44 AM

Try this and give me the errors if it gives any:

Code:
[EVENTS e_repair]
ON=@ContextMenuRequest
src.addcontextentry 111,3000089

ON=@ContextMenuSelect
If <argn>==111    // Repair
If (<Src.Distance> > 3)
  Src.SMsg Too far away from the Vendor
  Return 1
EndIf
Src.SMsg Target the weapon or armor you want to repair.
Src.TargetF fRepair
Return 1
EndIf

[Function fRepair]
If (<ArgO.Distance> > 5)
Src.SMsg You cannot reach the vendor.
Return 1
EndIf

If !(<ArgO.IsWeapon>) || !(<ArgO.IsArmor>)
Src.SMsg You can only repair weapons and armor.
Return 1
EndIf

If (<ArgO.More1> == <ArgO.More1L>)
Src.SMsg This item is already in full repair.
Return 1
EndIf

dLocal.Cost=<Eval (((<ArgO.More1H>-<ArgO.More1L>)*<ArgO.Tag0.Repair>) +1)>
If (<Src.Gold> < <dLocal.Cost>)
Src.SMsg You don't have <dLocal.Cost> gold to repair this.
Return 1
Else
ArgO.More1L=<ArgO.More1H>
Src.Gold -= <dLocal.Cost>
ArgO.Update
Return 1
EndIf



RE: LINK - Llirik - 03-14-2016 05:59 AM

Not!

[Function fRepair]
On=@TargOn_Item
If (<ArgO.Distance> > 5)
Src.SysMessage You cannot reach the vendor.
Return 1
EndIf

Functions can have TRIGGERS? Maybe Events?


RE: LINK - Khaos - 03-14-2016 06:50 PM

I fixed the above script. When we found triggers working in functions it was years ago and we are having issues replicating. It might have been fixed. SugarCube and I stumbled upon it on accident. Might have also been a dirty workaround we did. Cannot remember how we did it, but just used the code I edited. Also, Xun says 111 seems to be functioning oddly. Maybe raise the number.