![]() |
Gold -> Bag -> Bank - Printable Version +- SphereCommunity (https://forum.spherecommunity.net) +-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d) +--- Forum: Script Help (/Forum-Script-Help) +--- Thread: Gold -> Bag -> Bank (/Thread-Gold-Bag-Bank) |
RE: Gold -> Bag -> Bank - Llirik - 02-16-2016 09:22 AM (08-14-2015 01:26 AM)Kanibal Wrote: ![]() RE: Gold -> Bag -> Bank - Llirik - 03-01-2016 10:38 AM (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 ![]() RE: Gold -> Bag -> Bank - Khaos - 03-01-2016 12:13 PM 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. RE: Gold -> Bag -> Bank - Llirik - 03-01-2016 12:23 PM (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. 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! RE: Gold -> Bag -> Bank - Khaos - 03-01-2016 12:26 PM Optimized for you. ![]() Code: [FUNCTION f_add_gold] RE: Gold -> Bag -> Bank - Llirik - 03-01-2016 12:28 PM Thank you! RE: Gold -> Bag -> Bank - Khaos - 03-01-2016 12:31 PM 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. ![]() RE: Gold -> Bag -> Bank - Llirik - 03-01-2016 12:54 PM 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. RE: Gold -> Bag -> Bank - Khaos - 03-01-2016 02:56 PM 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 ![]() Code: [FUNCTION f_add_gold] RE: Gold -> Bag -> Bank - pointhz - 03-01-2016 06:44 PM 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 |