Ranking
Original Post
[REL]Speed Graph
It shows yours and ukes speed in the last frames, you can edit the file (the line that starts with "frame_num") to show more or less data.
Attached Files
speedgraph.lua (890 Bytes, 39 views)
Last edited by Fran; Jan 13, 2012 at 04:03 AM.
Nice little script. I hope you don't mind that I tweaked it a little.
I changed some parts of the display stuff and I added a /graphhelp, /size and /frames command so you can change the size and frame number with a command.
The usage is:
/size widthInPixels e.g: /size 300 for a 300 pixel wide graph
/frames number e.g: /frames 500 for a graph over 500 frames

It also saves settings.
Works for 3.91+
Attached Files
speedgraph.lua (2.5 KB, 28 views)
Signature temporarily out of order.
Do you know how to get the joint/ghost/usertext color, would be nice to know to whom is the line from in mp.
Yes, it's possible. You have to read out the color number of the user's item.dat and then convert the color number to RGB. Unfortunately there is no function for colorcode -> RGB so I'm trying to put something together. At least there is a list of colorcodes with RGB here. The format is colorcode name R G B ?. Usually the last number is alpha but it doesn't make any sense here. Doesn't matter anyways.
Signature temporarily out of order.
Originally Posted by psycore View Post
The format is colorcode name R G B ?. Usually the last number is alpha but it doesn't make any sense here. Doesn't matter anyways.

Yes, always having an alpha of either 0 or 1 (out of 255) would be a bit weird.
I believe it's whether the color has been put into the game or not, with 0 being "yes, it has" and 1 being "no, it has not".
It seems switched, at least to me, because normally 0 = no/false and 1 = yes/true. But it really doesn't matter.
Here's a sample to support my reasoning:
9 static 255 255 0 0
10 green 0 255 0 1
11 neptune 51 153 255 0
12 ecto 51 255 153 0
13 spring 153 255 51 1
14 violet 153 51 255 1
15 pink 255 51 153 1
16 copper 255 186 38 0
Static, neptune, ecto, and copper are all colors usable for joints and such,
but green, spring, violet, and pink are not. Note the ones and zeroes.

Anyway, the script is pretty cool.
The only use for it that I can think of at the moment is picking apart replays to figure out how to hit faster/harder,
but I guess that's a valid reason if you're really into singleplayer.
Originally Posted by psycore View Post
Yes, it's possible. You have to read out the color number of the user's item.dat and then convert the color number to RGB. Unfortunately there is no function for colorcode -> RGB so I'm trying to put something together. At least there is a list of colorcodes with RGB here. The format is colorcode name R G B ?. Usually the last number is alpha but it doesn't make any sense here. Doesn't matter anyways.

get_color_info(), it returns the rgb in a float from 0 to 1.
Didn't know get_color_info(). Another good thing about it is that unlike colors.txt it's up to date.

So here the code to get colors from item.dat:
Lua code:
local colorType = { force = 3, relax = 4, body = 5, ghost = 7, text = 13 }

local function getNumber(str, n)
local getN = str:gfind("%d+")
for i=1, n-1 do getN() end
return tonumber(getN())
end

local function getColor(player, cType)
local items = assert(io.open("custom/"..player.."/item.dat", "r", 1))
for line in items:lines() do
if line:sub(1, 4) == "ITEM" then
items:close()
local n = getNumber(line, colorType[cType:lower()])
if n == 0 then return nil
else return get_color_info(n)
end
end
end
end

usage:
get_color(string player_name, string cType)
cType can be any existing key of the colorType array ("force", "relax", "body", "ghost" or "text"; "body" is the joint color during replays, "text" is the color of the displayed name). Not case-sensitive.
Returns an array with the fields "r", "g", "b" and "name".

If someone hasn't bought the item, it will return nil.
Last edited by psycore; Jan 16, 2012 at 04:32 AM.
Signature temporarily out of order.