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
Gold -> Bag -> Bank
Author Message
Llirik
Journeyman
*

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

UO Forum

Post: #11
RE: Gold -> Bag -> Bank
(08-14-2015 01:26 AM)Kanibal Wrote:  
Code:
[FUNCTION f_add_gold]
serv.newitem i_bag, 1, <src.findlayer.29.uid>
var.newbag = <new.uid>

if (<argn1> > 65000)
  var.tmp=<argn1>/65000
    for i 1 <eval <var.tmp>>
      serv.newitem i_gold, 65000, <var.newbag>
    endfor
    serv.newitem i_gold, (<argn1>-(<eval <var.tmp>>*65000)), <var.newbag>
else
   serv.newitem i_gold, <argn1>, <var.newbag>
endif
src.update
use
.f_add_gold 1000000

Smile
02-16-2016 09:22 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Llirik
Journeyman
*

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

UO Forum

Post: #12
RE: Gold -> Bag -> Bank
(08-18-2015 04:42 AM)Kanibal Wrote:  
(08-14-2015 05:15 AM)evening Wrote:  maybe after we test, provide an answer to the questioner will be better!
Ok Veryhappy
Code:
[FUNCTION f_add_gold]
serv.newitem i_bag, 1, <findlayer.29.uid>
var.newbag = <new.uid>
var.money = <argn>
  
if <var.money> > 65000
  while <var.money> > 65000
    serv.newitem i_gold, 65000, <var.newbag>
    var.money -= 65000
  endwhile
  serv.newitem i_gold, <var.money>, <var.newbag>
else
  serv.newitem i_gold, <var.money>, <var.newbag>
endif
update

Smile
(This post was last modified: 03-01-2016 10:38 AM by Llirik.)
03-01-2016 10:38 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Khaos
Master
**

Posts: 595
Likes Given: 166
Likes Received: 83 in 51 posts
Joined: Mar 2012
Reputation: 11



Post: #13
RE: Gold -> Bag -> Bank
Did you still need help with this? If so, Coruja's works. Just change Layer_BackPack to Layer_BankBox. Kanibals is a good example too. Just change out that var to a local. Var's are globally stored and no one is clearing out this Var I am noticing.

Also. Xun is right, Gold function will send it right to the bank, but without a container.

Coruja says NewGold will work, but it doesn't go to the bank, as it has no bounce option. It actually is stored to the <Src> who called that function. Meaning it would just go in their backpack or a chest if a chest called it. Just whatever is calling the function is where that Gold is stored.

This just leaves you with two While options from Coruja and Kanibal, which are the best option for what you are trying to achieve as a While parses until it returns false. Both of their function do this and then take the remainder and drop it in the bag (or in the backpack in Coruja's example, which can be changed to a bag).

Coruja's is accurate without storing anything in a global Var, but in the long run Kanibal's is the most ideal as it doesn't parse the conditional Else and has already been lowering the Var the entire time to dump it in the bag when While returns False. Just change his Vars to locals as I stated.

Also, Kanibal's method for calling Layer 29 is correct, while I saw people calling for layer_backpack.

Also, change Kanibal's Src.Update to Src.Resend. Update is called from an Item and Resend refreshes the Client's screen, whom is your recipient. Both are good, but in this case, Resend is probably what you truly want. If this is being parsed from the player as the <Src>, Resend is your function for updating you want.
(This post was last modified: 03-01-2016 12:18 PM by Khaos.)
03-01-2016 12:13 PM
Find all posts by this user Like Post Quote this message in a reply
Llirik
Journeyman
*

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

UO Forum

Post: #14
RE: Gold -> Bag -> Bank
(03-01-2016 12:13 PM)Khaos Wrote:  Did you still need help with this? If so, Coruja's works. Just change Layer_BackPack to Layer_BankBox. Kanibals is a good example too. Just change out that var to a local. Var's are globally stored and no one is clearing out this Var I am noticing.

Also. Xun is right, Gold function will send it right to the bank, but without a container.

Coruja says NewGold will work, but it doesn't go to the bank, as it has no bounce option. It actually is stored to the <Src> who called that function. Meaning it would just go in their backpack or a chest if a chest called it. Just whatever is calling the function is where that Gold is stored.

This just leaves you with two While options from Coruja and Kanibal, which are the best option for what you are trying to achieve as a While parses until it returns false. Both of their function do this and then take the remainder and drop it in the bag (or in the backpack in Coruja's example, which can be changed to a bag).

Coruja's is accurate without storing anything in a global Var, but in the long run Kanibal's is the most ideal as it doesn't parse the conditional Else and has already been lowering the Var the entire time to dump it in the bag when While returns False. Just change his Vars to locals as I stated.

Also, Kanibal's method for calling Layer 29 is correct, while I saw people calling for layer_backpack.

Also, change Kanibal's Src.Update to Src.Resend. Update is called from an Item and Resend refreshes the Client's screen, whom is your recipient. Both are good, but in this case, Resend is probably what you truly want. If this is being parsed from the player as the <Src>, Resend is your function for updating you want.

I can use?

[FUNCTION f_add_gold]
serv.newitem i_bag, 1, <findlayer.29.uid>
local.newbag = <new.uid>
local.money = <argn>

if <local.money> > 65000
while <local.money> > 65000
serv.newitem i_gold, 65000, <local.newbag>
local.money -= 65000
endwhile
serv.newitem i_gold, <local.money>, <local.newbag>
else
serv.newitem i_gold, <local.money>, <local.newbag>
endif
update


local=var? In this function only.
Sorry my English isn't good!
(This post was last modified: 03-01-2016 12:26 PM by Llirik.)
03-01-2016 12:23 PM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Khaos
Master
**

Posts: 595
Likes Given: 166
Likes Received: 83 in 51 posts
Joined: Mar 2012
Reputation: 11



Post: #15
RE: Gold -> Bag -> Bank
Optimized for you. Smile Give it a try. Let me know if it has any issues.

Code:
[FUNCTION f_add_gold]
Serv.NewItem i_bag,1,<Src.FindLayer.29.UID>
Local.NewBag=<New.UID>
Local.Money=<ArgN>
  
If (<Local.Money> > 65000)
  While (<Local.Money> > 65000)
    <Local.NewBag>.NewGold 65000
    Local.Money -= 65000
  EndWhile
  <Local.NewBag>.NewGold <Local.Money>
Else
  <Local.NewBag>.NewGold <Local.Money>
EndIf
Src.Resend
03-01-2016 12:26 PM
Find all posts by this user Like Post Quote this message in a reply
Llirik
Journeyman
*

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

UO Forum

Post: #16
RE: Gold -> Bag -> Bank
Thank you!
03-01-2016 12:28 PM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
[+] 1 user Likes Llirik's post
Khaos
Master
**

Posts: 595
Likes Given: 166
Likes Received: 83 in 51 posts
Joined: Mar 2012
Reputation: 11



Post: #17
RE: Gold -> Bag -> Bank
No problem. If there is any complication, please let me know. I am only iffy about one part, but I am 95% sure it should work and a bit cleaner than everything else removing those vars and using the bag's uid in the bankbox to call the NewGold function. Smile
(This post was last modified: 03-01-2016 12:31 PM by Khaos.)
03-01-2016 12:31 PM
Find all posts by this user Like Post Quote this message in a reply
Llirik
Journeyman
*

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

UO Forum

Post: #18
RE: Gold -> Bag -> Bank
My last script work well! But your script:

05:41:ERROR:(stone_money.scp,40)Undefined keyword '040014d61.NewGold'
05:41:ERROR:(stone_money.scp,40)Undefined keyword '040014d61.NewGold'
05:41:ERROR:(stone_money.scp,40)Undefined keyword '040014d61.NewGold'
05:41:ERROR:(stone_money.scp,40)Undefined keyword '040014d61.NewGold'
05:41:ERROR:(stone_money.scp,40)Undefined keyword '040014d61.NewGold'
05:41:ERROR:(stone_money.scp,40)Undefined keyword '040014d61.NewGold'
05:41:ERROR:(stone_money.scp,40)Undefined keyword '040014d61.NewGold'
05:41:ERROR:(stone_money.scp,40)Undefined keyword '040014d61.NewGold'
05:41:ERROR:(stone_money.scp,43)Undefined keyword '040014d61.NewGold'

P.S: write without src please!

I'm use Sphere beta.
(This post was last modified: 03-01-2016 12:56 PM by Llirik.)
03-01-2016 12:54 PM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Khaos
Master
**

Posts: 595
Likes Given: 166
Likes Received: 83 in 51 posts
Joined: Mar 2012
Reputation: 11



Post: #19
RE: Gold -> Bag -> Bank
I was 95% sure. Didn't have server up to test. I was trying to just bounce it to the bag itself. I will attempt it more in the AM. Been up for 26 hours now. Sorry Big Grin
Code:
[FUNCTION f_add_gold]
Serv.NewItem i_bag,1,<Src.FindLayer.29.UID>
Local.NewBag=<New.UID>
Local.Money=<ArgN>
  
If (<Local.Money> > 65000)
  While (<Local.Money> > 65000)
    Serv.NewItem i_gold,65000,<Local.NewBag>
    Local.Money=<Eval (<Local.Money> - 65000)>
  EndWhile
  Serv.NewItem i_gold,<Local.Money>,<Local.NewBag>
Else
  Serv.NewItem i_gold,<Local.Money>,<Local.NewBag>
EndIf
Src.Update
(This post was last modified: 03-01-2016 02:59 PM by Khaos.)
03-01-2016 02:56 PM
Find all posts by this user Like Post Quote this message in a reply
pointhz
Journeyman
*

Posts: 148
Likes Given: 1
Likes Received: 55 in 28 posts
Joined: Oct 2013
Reputation: 1



Post: #20
RE: Gold -> Bag -> Bank
You can also remove the "else" from the IF i guess.

Just put

If money > 65000
While money > 65000
Add money 65000
Money - 65000
Endwhile
Endif
Add money <money left>

Saves 3 lines of code xD
(This post was last modified: 03-01-2016 06:55 PM by pointhz.)
03-01-2016 06:44 PM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


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