Jump to content

stack overflow


myyusuf

Recommended Posts

hello.

local name, author, lastTimePlayed, playedCount, modename 
local startTick 
local month = {"January","February","March","April","May","June","Juli","August","September","October","November","December"} 
local screenWidth, screenHeight = guiGetScreenSize() 
local endPosition = screenHeight-140 
local moveback = false 
  
function timestampToDate(stamp) 
    local time = getRealTime(stamp) 
    return string.format("%d %s %02d:%02d",time.monthday,month[time.month+1],time.hour,time.minute) 
end 
  
function handleMapInfo(mapInfo) 
    name            = mapInfo.name or "Unknown" 
    author          = mapInfo.author or "Unknown" 
    lastTimePlayed  = timestampToDate(mapInfo.lastTimePlayed) or "Unknown" 
    playedCount     = tostring(mapInfo.playedCount or "Unknown") 
    modename        = mapInfo.modename ~= "Destruction derby" and mapInfo.modename or "Destruction derby" 
    position        = screenHeight+90 
    movePosition    = 5 
    tickCount       = 400 
    moveback        = false 
    alpha           = 0 
    addEventHandler("onClientRender",getRootElement(),drawMapInfo) 
end 
addEvent("onClientMapStarting",true) 
addEventHandler("onClientMapStarting",getRootElement(),handleMapInfo) 
  
function drawMapInfo () 
    if position == endPosition then 
        if tickCount == 0 then  
            moveback = true 
        end 
        tickCount = tickCount-1 
        movePosition = 0 
    end 
    if position >= screenHeight+91 then  
        removeEventHandler("onClientRender",getRootElement(),drawMapInfo) 
    end 
    if moveback then 
        movePosition = -2.5 
        alpha = alpha - 10 
    end 
    alpha = alpha + 5 
    if alpha > 255 then 
        alpha = 255 
    elseif alpha < 0 then  
        alpha = 0 
    end 
    local heighResize = dxGetFontHeight(1.15, "default-bold") 
    local widthRezise1 = dxGetTextWidth("Map - "..name,1.15,"default-bold") 
    local widthRezise2 = dxGetTextWidth("Lasttime played - "..lastTimePlayed,1.15,"default-bold") 
    local widthRezise3 = dxGetTextWidth("By - "..author,1.15,"default-bold") 
    if widthRezise1 > widthRezise2 and widthRezise1 > widthRezise3 then 
        widthRezise = widthRezise1 
    elseif  widthRezise2 > widthRezise1 and widthRezise2 > widthRezise3 then 
        widthRezise = widthRezise2 
    elseif  widthRezise3 > widthRezise1 and widthRezise3 > widthRezise2 then 
        widthRezise = widthRezise3 
    end 
    --Background 
    dxDrawImage(screenWidth/2-widthRezise/2-8,position-movePosition-(heighResize-3),widthRezise+16,140+heighResize, "bgr.png",0,0,0,tocolor(200,200,200,alpha)) 
    --Map 
    dxDrawingColorText ( "#FF9900Map - #FFFFFF"..name,screenWidth/2,position-movePosition+heighResize,screenWidth/2,position-movePosition+heighResize, tocolor(255,255,255,alpha), alpha, 1.15, "default-bold", "center", "bottom", false, false, false ) 
    --By 
    dxDrawingColorText ( "#FF9900By - #FFFFFF"..author,screenWidth/2,position-movePosition+heighResize*2,screenWidth/2,position-movePosition+heighResize*2, tocolor(255,255,255,alpha), alpha, 1.15, "default-bold", "center", "bottom", false, false, false ) 
    --Played 
    dxDrawingColorText ( "#FF9900Played - #FFFFFF"..playedCount.." times",screenWidth/2,position-movePosition+heighResize*3,screenWidth/2,position-movePosition+heighResize*3, tocolor(255,255,255,alpha), alpha, 1.15, "default-bold", "center", "bottom", false, false, false ) 
    --Last time 
    dxDrawingColorText ( "#FF9900Lasttime played - #FFFFFF"..lastTimePlayed,screenWidth/2,position-movePosition+heighResize*4,screenWidth/2,position-movePosition+heighResize*4, tocolor(255,255,255,alpha), alpha, 1.15, "default-bold", "center", "bottom", false, false, false ) 
    --Mode 
    dxDrawingColorText ( "#FF9900Mode - #FFFFFF"..modename,screenWidth/2,position-movePosition+heighResize*5,screenWidth/2,position-movePosition+heighResize*5, tocolor(255,255,255,alpha), alpha, 1.15, "default-bold", "center", "bottom", false, false, false ) 
    position = position - movePosition 
end 
  
function dxDrawingColorText ( text,left,top,right,bottom,color,scale,font,alignX,alignY)  
    dxDrawingColorText ( text, left+scale, top , right+scale, bottom, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left+scale, top+scale , right+scale, bottom+scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left, top+scale , right, bottom+scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left-scale, top+scale , right-scale, bottom+scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left-scale, top , right-scale, bottom, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left-scale, top-scale , right-scale, bottom-scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left, top-scale , right, bottom-scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left+scale, top-scale , right+scale, bottom-scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left, top , right, bottom, color,scale,font,alignX,alignY) 
end 

i have got this warning: info.lua:77: stack overflow

Link to comment

lol? I give you ( see my last post ). You need fix yourself.

You can see you create this

function dxDrawingColorText ( text,left,top,right,bottom,color,scale,font,alignX,alignY)  
    dxDrawingColorText ( text, left+scale, top , right+scale, bottom, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left+scale, top+scale , right+scale, bottom+scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left, top+scale , right, bottom+scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left-scale, top+scale , right-scale, bottom+scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left-scale, top , right-scale, bottom, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left-scale, top-scale , right-scale, bottom-scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left, top-scale , right, bottom-scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left+scale, top-scale , right+scale, bottom-scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left, top , right, bottom, color,scale,font,alignX,alignY) 
end 

Edited by Guest
Link to comment
lol? I give you ( see my last post ). You need fix yourself.

You can see you create this

function dxDrawingColorText ( text,left,top,right,bottom,color,scale,font,alignX,alignY)  
    dxDrawingColorText ( text, left+scale, top , right+scale, bottom, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left+scale, top+scale , right+scale, bottom+scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left, top+scale , right, bottom+scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left-scale, top+scale , right-scale, bottom+scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left-scale, top , right-scale, bottom, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left-scale, top-scale , right-scale, bottom-scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left, top-scale , right, bottom-scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left+scale, top-scale , right+scale, bottom-scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left, top , right, bottom, color,scale,font,alignX,alignY) 
end 

i dont know how to do it. :oops:

Link to comment
Read all my posts better!
function fStackOverflow( ) 
    fStackOverflow( ) -- we get stack overflow 
end 
  
fStackOverflow( ) -- call function fStackOverflow 
  

It's example

function fStackOverflow( ) 
    fStackOverflow( ) 
end 
local name, author, lastTimePlayed, playedCount, modename 
local startTick 
local month = {"January","February","March","April","May","June","Juli","August","September","October","November","December"} 
local screenWidth, screenHeight = guiGetScreenSize() 
local endPosition = screenHeight-140 
local moveback = false 
  
function timestampToDate(stamp) 
    local time = getRealTime(stamp) 
    return string.format("%d %s %02d:%02d",time.monthday,month[time.month+1],time.hour,time.minute) 
end 
  
function handleMapInfo(mapInfo) 
    name            = mapInfo.name or "Unknown" 
    author          = mapInfo.author or "Unknown" 
    lastTimePlayed  = timestampToDate(mapInfo.lastTimePlayed) or "Unknown" 
    playedCount     = tostring(mapInfo.playedCount or "Unknown") 
    modename        = mapInfo.modename ~= "Destruction derby" and mapInfo.modename or "Destruction derby" 
    position        = screenHeight+90 
    movePosition    = 5 
    tickCount       = 400 
    moveback        = false 
    alpha           = 0 
    addEventHandler("onClientRender",getRootElement(),drawMapInfo) 
end 
addEvent("onClientMapStarting",true) 
addEventHandler("onClientMapStarting",getRootElement(),handleMapInfo) 
  
function drawMapInfo () 
    if position == endPosition then 
        if tickCount == 0 then 
            moveback = true 
        end 
        tickCount = tickCount-1 
        movePosition = 0 
    end 
    if position >= screenHeight+91 then 
        removeEventHandler("onClientRender",getRootElement(),drawMapInfo) 
    end 
    if moveback then 
        movePosition = -2.5 
        alpha = alpha - 10 
    end 
    alpha = alpha + 5 
    if alpha > 255 then 
        alpha = 255 
    elseif alpha < 0 then 
        alpha = 0 
    end 
    local heighResize = dxGetFontHeight(1.15, "default-bold") 
    local widthRezise1 = dxGetTextWidth("Map - "..name,1.15,"default-bold") 
    local widthRezise2 = dxGetTextWidth("Lasttime played - "..lastTimePlayed,1.15,"default-bold") 
    local widthRezise3 = dxGetTextWidth("By - "..author,1.15,"default-bold") 
    if widthRezise1 > widthRezise2 and widthRezise1 > widthRezise3 then 
        widthRezise = widthRezise1 
    elseif  widthRezise2 > widthRezise1 and widthRezise2 > widthRezise3 then 
        widthRezise = widthRezise2 
    elseif  widthRezise3 > widthRezise1 and widthRezise3 > widthRezise2 then 
        widthRezise = widthRezise3 
    end 
    --Background 
    dxDrawImage(screenWidth/2-widthRezise/2-8,position-movePosition-(heighResize-3),widthRezise+16,140+heighResize, "bgr.png",0,0,0,tocolor(200,200,200,alpha)) 
    --Map 
    dxDrawingColorText ( "#FF9900Map - #FFFFFF"..name,screenWidth/2,position-movePosition+heighResize,screenWidth/2,position-movePosition+heighResize, tocolor(255,255,255,alpha), alpha, 1.15, "default-bold", "center", "bottom", false, false, false ) 
    --By 
    dxDrawingColorText ( "#FF9900By - #FFFFFF"..author,screenWidth/2,position-movePosition+heighResize*2,screenWidth/2,position-movePosition+heighResize*2, tocolor(255,255,255,alpha), alpha, 1.15, "default-bold", "center", "bottom", false, false, false ) 
    --Played 
    dxDrawingColorText ( "#FF9900Played - #FFFFFF"..playedCount.." times",screenWidth/2,position-movePosition+heighResize*3,screenWidth/2,position-movePosition+heighResize*3, tocolor(255,255,255,alpha), alpha, 1.15, "default-bold", "center", "bottom", false, false, false ) 
    --Last time 
    dxDrawingColorText ( "#FF9900Lasttime played - #FFFFFF"..lastTimePlayed,screenWidth/2,position-movePosition+heighResize*4,screenWidth/2,position-movePosition+heighResize*4, tocolor(255,255,255,alpha), alpha, 1.15, "default-bold", "center", "bottom", false, false, false ) 
    --Mode 
    dxDrawingColorText ( "#FF9900Mode - #FFFFFF"..modename,screenWidth/2,position-movePosition+heighResize*5,screenWidth/2,position-movePosition+heighResize*5, tocolor(255,255,255,alpha), alpha, 1.15, "default-bold", "center", "bottom", false, false, false ) 
    position = position - movePosition 
end 
  
  
function dxDrawingColorText ( text,left,top,right,bottom,color,scale,font,alignX,alignY) 
fStackOverflow( ) 
        dxDrawingColorText ( text, left+scale, top , right+scale, bottom, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
        dxDrawingColorText ( text, left+scale, top+scale , right+scale, bottom+scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
        dxDrawingColorText ( text, left, top+scale , right, bottom+scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
        dxDrawingColorText ( text, left-scale, top+scale , right-scale, bottom+scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
        dxDrawingColorText ( text, left-scale, top , right-scale, bottom, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
        dxDrawingColorText ( text, left-scale, top-scale , right-scale, bottom-scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
        dxDrawingColorText ( text, left, top-scale , right, bottom-scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
        dxDrawingColorText ( text, left+scale, top-scale , right+scale, bottom-scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
        dxDrawingColorText ( text, left, top , right, bottom, color,scale,font,alignX,alignY) 
end 

? :?

Link to comment
function drawMyText ( text,left,top,right,bottom,color,scale,font,alignX,alignY)  
    dxDrawingColorText ( text, left+scale, top , right+scale, bottom, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left+scale, top+scale , right+scale, bottom+scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left, top+scale , right, bottom+scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left-scale, top+scale , right-scale, bottom+scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left-scale, top , right-scale, bottom, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left-scale, top-scale , right-scale, bottom-scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left, top-scale , right, bottom-scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left+scale, top-scale , right+scale, bottom-scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left, top , right, bottom, color,scale,font,alignX,alignY) 
end 

?

You created a function "dxDrawingColorText" and call it inside the function a lot of times.

Link to comment
Read all my posts better!
function fStackOverflow( ) 
    fStackOverflow( ) -- we get stack overflow 
end 
  
fStackOverflow( ) -- call function fStackOverflow 
  

It's example

function fStackOverflow( ) 
    fStackOverflow( ) 
end 
local name, author, lastTimePlayed, playedCount, modename 
local startTick 
local month = {"January","February","March","April","May","June","Juli","August","September","October","November","December"} 
local screenWidth, screenHeight = guiGetScreenSize() 
local endPosition = screenHeight-140 
local moveback = false 
  
function timestampToDate(stamp) 
    local time = getRealTime(stamp) 
    return string.format("%d %s %02d:%02d",time.monthday,month[time.month+1],time.hour,time.minute) 
end 
  
function handleMapInfo(mapInfo) 
    name            = mapInfo.name or "Unknown" 
    author          = mapInfo.author or "Unknown" 
    lastTimePlayed  = timestampToDate(mapInfo.lastTimePlayed) or "Unknown" 
    playedCount     = tostring(mapInfo.playedCount or "Unknown") 
    modename        = mapInfo.modename ~= "Destruction derby" and mapInfo.modename or "Destruction derby" 
    position        = screenHeight+90 
    movePosition    = 5 
    tickCount       = 400 
    moveback        = false 
    alpha           = 0 
    addEventHandler("onClientRender",getRootElement(),drawMapInfo) 
end 
addEvent("onClientMapStarting",true) 
addEventHandler("onClientMapStarting",getRootElement(),handleMapInfo) 
  
function drawMapInfo () 
    if position == endPosition then 
        if tickCount == 0 then 
            moveback = true 
        end 
        tickCount = tickCount-1 
        movePosition = 0 
    end 
    if position >= screenHeight+91 then 
        removeEventHandler("onClientRender",getRootElement(),drawMapInfo) 
    end 
    if moveback then 
        movePosition = -2.5 
        alpha = alpha - 10 
    end 
    alpha = alpha + 5 
    if alpha > 255 then 
        alpha = 255 
    elseif alpha < 0 then 
        alpha = 0 
    end 
    local heighResize = dxGetFontHeight(1.15, "default-bold") 
    local widthRezise1 = dxGetTextWidth("Map - "..name,1.15,"default-bold") 
    local widthRezise2 = dxGetTextWidth("Lasttime played - "..lastTimePlayed,1.15,"default-bold") 
    local widthRezise3 = dxGetTextWidth("By - "..author,1.15,"default-bold") 
    if widthRezise1 > widthRezise2 and widthRezise1 > widthRezise3 then 
        widthRezise = widthRezise1 
    elseif  widthRezise2 > widthRezise1 and widthRezise2 > widthRezise3 then 
        widthRezise = widthRezise2 
    elseif  widthRezise3 > widthRezise1 and widthRezise3 > widthRezise2 then 
        widthRezise = widthRezise3 
    end 
    --Background 
    dxDrawImage(screenWidth/2-widthRezise/2-8,position-movePosition-(heighResize-3),widthRezise+16,140+heighResize, "bgr.png",0,0,0,tocolor(200,200,200,alpha)) 
    --Map 
    dxDrawingColorText ( "#FF9900Map - #FFFFFF"..name,screenWidth/2,position-movePosition+heighResize,screenWidth/2,position-movePosition+heighResize, tocolor(255,255,255,alpha), alpha, 1.15, "default-bold", "center", "bottom", false, false, false ) 
    --By 
    dxDrawingColorText ( "#FF9900By - #FFFFFF"..author,screenWidth/2,position-movePosition+heighResize*2,screenWidth/2,position-movePosition+heighResize*2, tocolor(255,255,255,alpha), alpha, 1.15, "default-bold", "center", "bottom", false, false, false ) 
    --Played 
    dxDrawingColorText ( "#FF9900Played - #FFFFFF"..playedCount.." times",screenWidth/2,position-movePosition+heighResize*3,screenWidth/2,position-movePosition+heighResize*3, tocolor(255,255,255,alpha), alpha, 1.15, "default-bold", "center", "bottom", false, false, false ) 
    --Last time 
    dxDrawingColorText ( "#FF9900Lasttime played - #FFFFFF"..lastTimePlayed,screenWidth/2,position-movePosition+heighResize*4,screenWidth/2,position-movePosition+heighResize*4, tocolor(255,255,255,alpha), alpha, 1.15, "default-bold", "center", "bottom", false, false, false ) 
    --Mode 
    dxDrawingColorText ( "#FF9900Mode - #FFFFFF"..modename,screenWidth/2,position-movePosition+heighResize*5,screenWidth/2,position-movePosition+heighResize*5, tocolor(255,255,255,alpha), alpha, 1.15, "default-bold", "center", "bottom", false, false, false ) 
    position = position - movePosition 
end 
  
  
function dxDrawingColorText ( text,left,top,right,bottom,color,scale,font,alignX,alignY) 
fStackOverflow( ) 
        dxDrawingColorText ( text, left+scale, top , right+scale, bottom, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
        dxDrawingColorText ( text, left+scale, top+scale , right+scale, bottom+scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
        dxDrawingColorText ( text, left, top+scale , right, bottom+scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
        dxDrawingColorText ( text, left-scale, top+scale , right-scale, bottom+scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
        dxDrawingColorText ( text, left-scale, top , right-scale, bottom, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
        dxDrawingColorText ( text, left-scale, top-scale , right-scale, bottom-scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
        dxDrawingColorText ( text, left, top-scale , right, bottom-scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
        dxDrawingColorText ( text, left+scale, top-scale , right+scale, bottom-scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
        dxDrawingColorText ( text, left, top , right, bottom, color,scale,font,alignX,alignY) 
end 

? :?

Copy paste activated? :x

It's example!

i did show you your mistake!

i think it's easy to understand upper example.

You get stack overflow, because you call ( same ) function inside the function!

If you not understand it too:

1) Call function fStackOverflow

2) Inside function fStackOverflow call again this function.( fStackOverflow )

3) Get stack overflow!

Link to comment

Copy paste activated? :x

It's example!

i did show you your mistake!

i think it's easy to understand upper example.

You get stack overflow, because you call ( same ) function inside the function!

If you not understand it too:

1) Call function fStackOverflow

2) Inside function fStackOverflow call again this function.( fStackOverflow )

3) Get stack overflow!

sorry but i just really dont understand this. i try it in all way. dont work :/

Link to comment
function drawMyText ( text,left,top,right,bottom,color,scale,font,alignX,alignY)  
    dxDrawingColorText ( text, left+scale, top , right+scale, bottom, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left+scale, top+scale , right+scale, bottom+scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left, top+scale , right, bottom+scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left-scale, top+scale , right-scale, bottom+scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left-scale, top , right-scale, bottom, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left-scale, top-scale , right-scale, bottom-scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left, top-scale , right, bottom-scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left+scale, top-scale , right+scale, bottom-scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left, top , right, bottom, color,scale,font,alignX,alignY) 
end 

?

You created a function "dxDrawingColorText" and call it inside the function a lot of times.

Link to comment
function drawMyText ( text,left,top,right,bottom,color,scale,font,alignX,alignY)  
    dxDrawingColorText ( text, left+scale, top , right+scale, bottom, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left+scale, top+scale , right+scale, bottom+scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left, top+scale , right, bottom+scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left-scale, top+scale , right-scale, bottom+scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left-scale, top , right-scale, bottom, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left-scale, top-scale , right-scale, bottom-scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left, top-scale , right, bottom-scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left+scale, top-scale , right+scale, bottom-scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left, top , right, bottom, color,scale,font,alignX,alignY) 
end 

?

You created a function "dxDrawingColorText" and call it inside the function a lot of times.

local name, author, lastTimePlayed, playedCount, modename 
local startTick 
local month = {"January","February","March","April","May","June","Juli","August","September","October","November","December"} 
local screenWidth, screenHeight = guiGetScreenSize() 
local endPosition = screenHeight-140 
local moveback = false 
  
function timestampToDate(stamp) 
    local time = getRealTime(stamp) 
    return string.format("%d %s %02d:%02d",time.monthday,month[time.month+1],time.hour,time.minute) 
end 
  
function handleMapInfo(mapInfo) 
    name            = mapInfo.name or "Unknown" 
    author          = mapInfo.author or "Unknown" 
    lastTimePlayed  = timestampToDate(mapInfo.lastTimePlayed) or "Unknown" 
    playedCount     = tostring(mapInfo.playedCount or "Unknown") 
    modename        = mapInfo.modename ~= "Destruction derby" and mapInfo.modename or "Destruction derby" 
    position        = screenHeight+90 
    movePosition    = 5 
    tickCount       = 400 
    moveback        = false 
    alpha           = 0 
    addEventHandler("onClientRender",getRootElement(),drawMapInfo) 
end 
addEvent("onClientMapStarting",true) 
addEventHandler("onClientMapStarting",getRootElement(),handleMapInfo) 
  
function drawMapInfo () 
    if position == endPosition then 
        if tickCount == 0 then 
            moveback = true 
        end 
        tickCount = tickCount-1 
        movePosition = 0 
    end 
    if position >= screenHeight+91 then 
        removeEventHandler("onClientRender",getRootElement(),drawMapInfo) 
    end 
    if moveback then 
        movePosition = -2.5 
        alpha = alpha - 10 
    end 
    alpha = alpha + 5 
    if alpha > 255 then 
        alpha = 255 
    elseif alpha < 0 then 
        alpha = 0 
    end 
    local heighResize = dxGetFontHeight(1.15, "default-bold") 
    local widthRezise1 = dxGetTextWidth("Map - "..name,1.15,"default-bold") 
    local widthRezise2 = dxGetTextWidth("Lasttime played - "..lastTimePlayed,1.15,"default-bold") 
    local widthRezise3 = dxGetTextWidth("By - "..author,1.15,"default-bold") 
    if widthRezise1 > widthRezise2 and widthRezise1 > widthRezise3 then 
        widthRezise = widthRezise1 
    elseif  widthRezise2 > widthRezise1 and widthRezise2 > widthRezise3 then 
        widthRezise = widthRezise2 
    elseif  widthRezise3 > widthRezise1 and widthRezise3 > widthRezise2 then 
        widthRezise = widthRezise3 
    end 
    dxDrawImage(screenWidth/2-widthRezise/2-8,position-movePosition-(heighResize-3),widthRezise+16,140+heighResize, "bgr.png",0,0,0,tocolor(200,200,200,alpha)) 
    dxDrawingColorText ( "#FF9900Map - #FFFFFF"..name,screenWidth/2,position-movePosition+heighResize,screenWidth/2,position-movePosition+heighResize, tocolor(255,255,255,alpha), alpha, 1.15, "default-bold", "center", "bottom", false, false, false ) 
    dxDrawingColorText ( "#FF9900By - #FFFFFF"..author,screenWidth/2,position-movePosition+heighResize*2,screenWidth/2,position-movePosition+heighResize*2, tocolor(255,255,255,alpha), alpha, 1.15, "default-bold", "center", "bottom", false, false, false ) 
    dxDrawingColorText ( "#FF9900Played - #FFFFFF"..playedCount.." times",screenWidth/2,position-movePosition+heighResize*3,screenWidth/2,position-movePosition+heighResize*3, tocolor(255,255,255,alpha), alpha, 1.15, "default-bold", "center", "bottom", false, false, false ) 
    dxDrawingColorText ( "#FF9900Lasttime played - #FFFFFF"..lastTimePlayed,screenWidth/2,position-movePosition+heighResize*4,screenWidth/2,position-movePosition+heighResize*4, tocolor(255,255,255,alpha), alpha, 1.15, "default-bold", "center", "bottom", false, false, false ) 
    dxDrawingColorText ( "#FF9900Mode - #FFFFFF"..modename,screenWidth/2,position-movePosition+heighResize*5,screenWidth/2,position-movePosition+heighResize*5, tocolor(255,255,255,alpha), alpha, 1.15, "default-bold", "center", "bottom", false, false, false ) 
    position = position - movePosition 
end 
  
function drawMyText ( text,left,top,right,bottom,color,scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left+scale, top , right+scale, bottom, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left+scale, top+scale , right+scale, bottom+scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left, top+scale , right, bottom+scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left-scale, top+scale , right-scale, bottom+scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left-scale, top , right-scale, bottom, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left-scale, top-scale , right-scale, bottom-scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left, top-scale , right, bottom-scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left+scale, top-scale , right+scale, bottom-scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left, top , right, bottom, color,scale,font,alignX,alignY) 
end 

info.lua:62: attemp to global 'dxDrawingColorText' (a nil value)

Link to comment
Where is the function 'dxDrawingColorText' ?

oh

local name, author, lastTimePlayed, playedCount, modename 
local startTick 
local month = {"January","February","March","April","May","June","Juli","August","September","October","November","December"} 
local screenWidth, screenHeight = guiGetScreenSize() 
local endPosition = screenHeight-140 
local moveback = false 
  
function timestampToDate(stamp) 
    local time = getRealTime(stamp) 
    return string.format("%d %s %02d:%02d",time.monthday,month[time.month+1],time.hour,time.minute) 
end 
  
function handleMapInfo(mapInfo) 
    name            = mapInfo.name or "Unknown" 
    author          = mapInfo.author or "Unknown" 
    lastTimePlayed  = timestampToDate(mapInfo.lastTimePlayed) or "Unknown" 
    playedCount     = tostring(mapInfo.playedCount or "Unknown") 
    modename        = mapInfo.modename ~= "Destruction derby" and mapInfo.modename or "Destruction derby" 
    position        = screenHeight+90 
    movePosition    = 5 
    tickCount       = 400 
    moveback        = false 
    alpha           = 0 
    addEventHandler("onClientRender",getRootElement(),drawMapInfo) 
end 
addEvent("onClientMapStarting",true) 
addEventHandler("onClientMapStarting",getRootElement(),handleMapInfo) 
  
function drawMapInfo () 
    if position == endPosition then 
        if tickCount == 0 then 
            moveback = true 
        end 
        tickCount = tickCount-1 
        movePosition = 0 
    end 
    if position >= screenHeight+91 then 
        removeEventHandler("onClientRender",getRootElement(),drawMapInfo) 
    end 
    if moveback then 
        movePosition = -2.5 
        alpha = alpha - 10 
    end 
    alpha = alpha + 5 
    if alpha > 255 then 
        alpha = 255 
    elseif alpha < 0 then 
        alpha = 0 
    end 
    local heighResize = dxGetFontHeight(1.15, "default-bold") 
    local widthRezise1 = dxGetTextWidth("Map - "..name,1.15,"default-bold") 
    local widthRezise2 = dxGetTextWidth("Lasttime played - "..lastTimePlayed,1.15,"default-bold") 
    local widthRezise3 = dxGetTextWidth("By - "..author,1.15,"default-bold") 
    if widthRezise1 > widthRezise2 and widthRezise1 > widthRezise3 then 
        widthRezise = widthRezise1 
    elseif  widthRezise2 > widthRezise1 and widthRezise2 > widthRezise3 then 
        widthRezise = widthRezise2 
    elseif  widthRezise3 > widthRezise1 and widthRezise3 > widthRezise2 then 
        widthRezise = widthRezise3 
    end 
    dxDrawImage(screenWidth/2-widthRezise/2-8,position-movePosition-(heighResize-3),widthRezise+16,140+heighResize, "bgr.png",0,0,0,tocolor(200,200,200,alpha)) 
    dxDrawingColorText ( "#FF9900Map - #FFFFFF"..name,screenWidth/2,position-movePosition+heighResize,screenWidth/2,position-movePosition+heighResize, tocolor(255,255,255,alpha), alpha, 1.15, "default-bold", "center", "bottom", false, false, false ) 
    dxDrawingColorText ( "#FF9900By - #FFFFFF"..author,screenWidth/2,position-movePosition+heighResize*2,screenWidth/2,position-movePosition+heighResize*2, tocolor(255,255,255,alpha), alpha, 1.15, "default-bold", "center", "bottom", false, false, false ) 
    dxDrawingColorText ( "#FF9900Played - #FFFFFF"..playedCount.." times",screenWidth/2,position-movePosition+heighResize*3,screenWidth/2,position-movePosition+heighResize*3, tocolor(255,255,255,alpha), alpha, 1.15, "default-bold", "center", "bottom", false, false, false ) 
    dxDrawingColorText ( "#FF9900Lasttime played - #FFFFFF"..lastTimePlayed,screenWidth/2,position-movePosition+heighResize*4,screenWidth/2,position-movePosition+heighResize*4, tocolor(255,255,255,alpha), alpha, 1.15, "default-bold", "center", "bottom", false, false, false ) 
    dxDrawingColorText ( "#FF9900Mode - #FFFFFF"..modename,screenWidth/2,position-movePosition+heighResize*5,screenWidth/2,position-movePosition+heighResize*5, tocolor(255,255,255,alpha), alpha, 1.15, "default-bold", "center", "bottom", false, false, false ) 
    position = position - movePosition 
end 
  
  
function dxDrawingColorText ( text,left,top,right,bottom,color,scale,font,alignX,alignY) 
end 
  
function drawMyText ( text,left,top,right,bottom,color,scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left+scale, top , right+scale, bottom, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left+scale, top+scale , right+scale, bottom+scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left, top+scale , right, bottom+scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left-scale, top+scale , right-scale, bottom+scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left-scale, top , right-scale, bottom, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left-scale, top-scale , right-scale, bottom-scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left, top-scale , right, bottom-scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left+scale, top-scale , right+scale, bottom-scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) 
    dxDrawingColorText ( text, left, top , right, bottom, color,scale,font,alignX,alignY) 
end 

i did this now. but i only can see the image. cant see the text. what is wrong?

Link to comment
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...