Page 1 of 1

Itsboxxy! (the funny circular startbox script)

Posted: 11 Jun 2014, 11:50
by knorke
This is the best startbox editor so far.

http://www.lua.org/cgi-bin/demo is easy way to run Lua without installing anything.
1) :o Copy the script into textfield
2) :roll: edit script as needed
3) 8) click [Run] button.
4) :regret: Copy output into chat.
5) :shock: Perfect circular start boxes!

Code: Select all

--its boxxy! the circular startbox maker!
--for use with http://www.lua.org/cgi-bin/demo
 
local n = 7 --how many boxes
local r = 75 --radius of circle
local a = 10 --size of boxes
 
function box (x,y,a)
	x=math.floor (x)
	y=math.floor (y)
	io.write("!addbox " .. x-a .. " " ..y-a .. " "..x+a.." " ..y+a..    "\n")
end
 
for i = 0.001,2*math.pi,(2*math.pi/n)  do
  box (100+math.sin(i)*r ,100+math.cos(i)*r,a)  
end

Re: Itsboxxy! (the funny circular startbox script)

Posted: 11 Jun 2014, 12:22
by Jools
Nice!

Note that spads uses the coordinates x,y ∈ [0,200] and springie uses x,y ∈ [0,100]. In addition, spads uses the format addbox x1, y1, x2, y2 <boxnum>, whereas springie uses addbox x, y, Δx, Δy

Re: Itsboxxy! (the funny circular startbox script)

Posted: 11 Jun 2014, 19:55
by Jools
This could probably be made into a spads plugin. If someone can translate lua => perl.

Re: Itsboxxy! (the funny circular startbox script)

Posted: 13 Jun 2014, 07:29
by CarRepairer
It's boxxy the funny circular startbox generator inside the boxxy lobby client.

Image

^ This has been boxxy the thread post.

Why do you name everything boxxy? It's like the Q Continuum.

Re: Itsboxxy! (the funny circular startbox script)

Posted: 13 Jun 2014, 11:03
by Jools
That's very nice. But unfortunately weblobby doesn't work on my system, hope we can get similar functionality in a spads plugin, or the other lobbies.

http://imgur.com/NC39R8l

Re: Itsboxxy! (the funny circular startbox script)

Posted: 13 Jun 2014, 14:49
by Jools
Now there is also a spads plugin, it works just like the code above. The syntax is:

!addboxpolar <number of boxes> <radius> <boxsize>

Where:
number > 0
radius ∈ ]0, 100 - boxsize/2]
boxsize ∈ ]0, 100]

Image

If someone wants to add the plugin to spads, it is attached to the spads thread. It's version 0.2 so some things are stupoid. For example, it clears only the 50 first boxes, it's hardcoded because I could not figure out how to access the number of teams variable in spads. Also, it does not check if startpostype = 2. So use it wisely.

It's already added to semprini.

Edit: for some reason it only works up to number of boxes = 15. After that consecutive boxes to be added yield an error, which can be seen in #local, like this:

Code: Select all

[16:52:10] Ambiguous command : ADDSTARTRECT 16 59 183 79 163
I see nothing wrong with that command (parameters are teamNb left top right bottom)

Edit2: version 0.2 fixes the fact that teamnumbers started on 1 and not 0.