You are not logged in.

Applications: [GameMaster: OPEN] | [Volunteer Testers: OPEN]


This forum will be permanently shut down on Friday 13.07.2018
Please copy or save all important information from old forum before they will be deactivated
We have moved to new board. https://forum.runesofmagic.gameforge.com/Come join us.

Amberwave

Intermediate

  • "Amberwave" started this thread

Posts: 369

Location: Chicagoland

  • Send private message

1

Wednesday, October 23rd 2013, 7:38pm

Upper limit on counting in macros

In a macro where you have a count like, /run for i=1,10 do something. Where this one counts to 10, is there an upper limit to what this number can be set to? Could you set it to 1000000 or 1000000000?

Mrpushpop

Master of the Storyteller

Posts: 800

Location: Indigo - The small and feisty server

Mood: Mellow

  • Send private message

2

Wednesday, October 23rd 2013, 8:02pm

I do not believe you can make it count close to that high. I will let someone else explain the technical aspects but even if you could for some reason the Macros i have build just to count down from 10 seconds seem to skip a number every now and then probably due to the wait time lag built in.

karmakarma

Master Procrastinator

Posts: 442

Location: Miami

Occupation: Diesel Mechanic (semi-trucks/tractor-trailers)

  • Send private message

3

Wednesday, October 23rd 2013, 9:57pm

you could easily go up to 300 (that i have tried) however the higher you go, the slower it will be so ill give you a couple examples to help you understand why the speed difference is important...

/run for i=1,240 do GetCountInBagByName("Guild Rune") if (GetCountInBagByName("Guild Rune")>1) then DEFAULT_CHAT_FRAME:AddMessage("Guild Runes = "..GetCountInBagByName("Guild Rune")) end end

---- that will search all of your backpack spaces and if you have guild runes it will put a message in your chat window saying how many guild runes you have... (if your bags are almost full then it might take a second or 2)

/run for i=1,10 do TargetNearestEnemy() if UnitIsPlayer("target") then break else TargetUnit("") end end

---- that will search the 10 nearest enemies for a player then stop if it finds one and if the 10th target is reached and it is not a player then it will drop target so you dont target a pet or a mob... (it usually take no time at all unless you are already lagging)

the higher you make it count the more time it will take and every millisecond counts in combat, out of combat it doesnt matter so much

hope that answers your question
LifeFire - Eternal - Grimdal
Mage/Priest/Knight
82/82/82

Give a macro, Take a Macro
Lifefire's Collections

Noguai

Beginner

Posts: 5

Location: Germany

  • Send private message

4

Friday, October 25th 2013, 1:04am

Oh, with Lua you can work with numbers that high, that you aren't able to imagine how much the number actually is. The Problem is, that after some time you'll loose precision. So eventhough Lua is able to store the value 10^300 (at least on the standard Lua interpreter for the Windows command line) precision is to low to differenciate between 10^300 and (10^300)-9, which causes the for loop

Source code

1
for i = (10^300)-9, 10^300 do print(i) end

to result in an infinite loop instead of printing only 10 numbers. No you can't go much higher, at some Point Lua will handle your value as intinity, which fyi is also stored in math.huge.

So the technical limit for you lies in the borders of the integer range of a specific Lua compiler as in RoM. But this is configurable by Runewaker and I don't know from ingame tests if they have changed something about that. But even without such information, the limit is damn high, higher than you would ever want to use.

More Information: http://stackoverflow.com/questions/94573…a-number-in-lua

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
-- get the maximum integer precision value
function mathFormat(n)
	local left,digits,decimals,right = string.match(tostring(n),"^([^%d]*%d)(%d*)%.?(%d*)(.-)$")
	digits = digits and digits:reverse():gsub("(%d%d%d)","%1."):reverse() or ""
	decimals = (decimals or "") ~= "" and ","..(decimals:gsub("(%d%d%d)", "%1."):gsub("(.*)%.$", "%1")) or ""
	return (left or "")..digits..decimals..(right or "")
end

local val = 0
for stepExp = 25, 0, -1 do
	for i = val, math.huge, 10^stepExp do
		if i == (i+1) then
			val = i - (10^stepExp)
			break
		end
	end
end
print(string.format("the maximum integer precision value is: %s", mathFormat(string.format("%.0f",val+1))))

Amberwave

Intermediate

  • "Amberwave" started this thread

Posts: 369

Location: Chicagoland

  • Send private message

5

Monday, October 28th 2013, 5:39pm

This is all been very useful, thank you. I have something to play with this week :0