Jump to content




Tollway not charging chest correctly


2 replies to this topic

#1 CreeperGoBoom

  • Members
  • 91 posts

Posted 13 December 2019 - 09:10 PM

Hi again guys,

if i set toll to more than 64, then
if count is above toll cost it only takes one stack to open even though it is less than the toll cost


what have i missed?

Edit: see lines 101 through 151.

https://pastebin.com/QEai09dx


Also if you see any other errors please let me know. Cheers :)

Edited by CreeperGoBoom, 13 December 2019 - 09:31 PM.


#2 Lupus590

  • Members
  • 2,029 posts
  • LocationUK

Posted 13 December 2019 - 10:08 PM

are you saying that it will only open when it sees enough items but it only sucks one stack?

maybe you should try a hungry toll? I.e. you take items and count them as you take them (instead of counting them and then trying to take all of them)

#3 CreeperGoBoom

  • Members
  • 91 posts

Posted 13 December 2019 - 10:28 PM

View PostLupus590, on 13 December 2019 - 10:08 PM, said:

are you saying that it will only open when it sees enough items but it only sucks one stack?

Correct. I wanted my toll to only take what is available only if the amount is correct.


View PostLupus590, on 13 December 2019 - 10:08 PM, said:

maybe you should try a hungry toll? I.e. you take items and count them as you take them (instead of counting them and then trying to take all of them)


That make sense.... I'll consider it as maybe an option in my config.

So is there any way to fix the toll only taking one stack?

I tried changing the code that counts through if amount less than toll to this:

elseif (val < toll) and (topay > 0 ) and (val > 0) then
			  print("Counting pennies")
			  if chest.pushItem(pushdir,key,1) then
				topay=topay-1
			  end
			  print("Amount left to pay: ",topay)
			  if topay < 0 then
				print("Oops! something went wrong and chest was overcharged!")
			  end
			end

But this is terribly inefficient. in the case of toll = 96, it took about 8 seconds to count through

but i do know that the problem lies somewhere between line 120 and 126 in my pastebin.

Ill edit my post if I find a fix but right now its driving me nuts.

Also I hate leaving stuff unfinished. Being the sort of person I am. Knowing that I'm not there yet but it's so close to in my grasp is enough to make me go till its all fixed. ahh good times XD.

are there many people on this forum like me? :)


EDIT: [solved]

Turns out I needed a secondary check.

Pastebin Updated

BTW: This is stable release #1, I will post this once i have finalized a few details like an auto updater

Edited by CreeperGoBoom, 14 December 2019 - 03:40 AM.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users