The following warnings occurred:
Warning [2] Use of undefined constant SAPI_NAME - assumed 'SAPI_NAME' (this will throw an Error in a future version of PHP) - Line: 3388 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3388 errorHandler->error
/showthread.php 116 build_archive_link
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/inc/functions.php 3324 build_forum_breadcrumb
/showthread.php 195 build_forum_breadcrumb
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb






Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Transfer Function
Author Message
Llirik
Journeyman
*

Posts: 116
Likes Given: 0
Likes Received: 10 in 8 posts
Joined: Feb 2015
Reputation: 0

UO Forum

Post: #1
Transfer Function
I need transfer all items from my backpack (GM) to target (bank) char (Player)!
This is right script?

[FUNCTION legend_transfer]
targetf f_legend_transfer

[FUNCTION f_legend_transfer]
serv.newitem i_bag, 1, <argo.findlayer.29.uid>
local.newbag = <new.uid>
forcont <findlayer.21>
serv.newitem <baseid>, <amount>, <local.newbag>
endfor

Happy New Year!
(This post was last modified: 11-25-2016 09:15 PM by Llirik.)
11-25-2016 09:14 PM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Kanibal
Master
**

Posts: 255
Likes Given: 6
Likes Received: 30 in 28 posts
Joined: Jun 2012
Reputation: 0



Post: #2
RE: Transfer Function
Code:
[FUNCTION f_backpack_to_bank]
findlayer(21).cont = <argo.findlayer(29).uid>
newitem=i_backpack
new.equip

(11-25-2016 09:14 PM)Llirik Wrote:  Happy New Year!
Lol

And if someone needs to move all items from char to his/her bank
Code:
[FUNCTION f_all_to_bank]
findlayer(1).cont = <findlayer(21).uid>
findlayer(2).cont = <findlayer(21).uid>
findlayer(3).cont = <findlayer(21).uid>
findlayer(4).cont = <findlayer(21).uid>
findlayer(5).cont = <findlayer(21).uid>
findlayer(6).cont = <findlayer(21).uid>
findlayer(7).cont = <findlayer(21).uid>
findlayer(8).cont = <findlayer(21).uid>
findlayer(9).cont = <findlayer(21).uid>
findlayer(10).cont = <findlayer(21).uid>
findlayer(12).cont = <findlayer(21).uid>
findlayer(13).cont = <findlayer(21).uid>
findlayer(14).cont = <findlayer(21).uid>
findlayer(17).cont = <findlayer(21).uid>
findlayer(18).cont = <findlayer(21).uid>
findlayer(19).cont = <findlayer(21).uid>
findlayer(20).cont = <findlayer(21).uid>
findlayer(22).cont = <findlayer(21).uid>
findlayer(23).cont = <findlayer(21).uid>
findlayer(24).cont = <findlayer(21).uid>
findlayer(31).cont = <findlayer(21).uid>
findlayer(21).cont = <findlayer(29).uid>
newitem=i_backpack
new.equip

Grandmaster Localhost Admin
(This post was last modified: 11-25-2016 10:30 PM by Kanibal.)
11-25-2016 10:18 PM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Coruja
Sphere Developer
*****

Posts: 987
Likes Given: 5
Likes Received: 226 in 187 posts
Joined: Jul 2012
Reputation: 7

Dimension Shard

Post: #3
RE: Transfer Function
if you want to move all backpack content to another packpack you must use CONT (which just change the item cont = move the item to another container) instead NEWITEM (which will create a new item)

also keep in mind that FINDLAYER always loop through all items equipped on player and only stop when it find the item on the layer X, so it's not a good idea use FINDLAYER inside FOR* loops, this will create a heavy loop and will waste server performance for no reason. To avoid this you can store the backpack UID just once (using REF1) before FORCONT starts. This will make FORCONT run moving the item directly to this backpack UID already defined (REF1) instead try to find the backpack UID again at each loop

Code:
[FUNCTION legend_transfer]
TARGETF f_legend_transfer

[FUNCTION f_legend_transfer]
REF1=<ARGO.FINDLAYER.layer_pack>
FORCONT <FINDLAYER.layer_pack>
  CONT=<REF1>
ENDFOR
11-26-2016 01:58 AM
Find all posts by this user Like Post Quote this message in a reply
Kanibal
Master
**

Posts: 255
Likes Given: 6
Likes Received: 30 in 28 posts
Joined: Jun 2012
Reputation: 0



Post: #4
RE: Transfer Function
This will be much better
Code:
[FUNCTION legend_transfer]
targetf f_legend_transfer

[FUNCTION f_legend_transfer]
serv.newitem i_bag
new.name <argo.name> loot
ref1=<new.uid>
forcont <argo.findlayer.layer_pack>
  cont=<ref1>
endfor
ref1.cont=<findlayer.layer_pack>
argo.kill
argo.sysmesage Ahahahahahaah!

[PLEVEL 1]
legend_transfer

Grandmaster Localhost Admin
(This post was last modified: 11-26-2016 03:35 AM by Kanibal.)
11-26-2016 03:19 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)