Question Creating Shaders

V1RU5

Known Member
Messages
3
Reaction score
2
Points
103
[SOLVED]
Thank you @P!X and @ISOCheated
It was just because Developer was set to 1.

I know this game is dead but I want to make a single player menu just because.
Im using this as 'createRectangle'
Code:
createRectangle(align, relative, x, y, width, height, color, alpha, sorting, shadero)
{
    barElemBG = newHudElem(self);
    barElemBG.elemType = "bar";
    barElemBG.width = width;
    barElemBG.height = height;
    barElemBG.align = align;
    barElemBG.relative = relative;
    barElemBG.xOffset = 0;
    barElemBG.yOffset = 0;
    barElemBG.children = [];
    barElemBG.color = color;
    barElemBG.alpha = alpha;
    barElemBG setShader( shadero, width , height );
    barElemBG.hidden = false;
    barElemBG.sort = sorting;
    barElemBG setPoint(align,relative,x,y);
    return barElemBG;
}

Here is the shader I'm trying to use (its pre-cached)
Code:
_createhud()
{
    self.Hud["BG"] = createRectangle("TOP", "TOP", 190, 0, 200, 200, (0,0,0), (1/4), 0, "white");
}
_destroyhud()
{
    self.Hud["BG"] destroy();
}

So the problem is every time I open the menu it shows the shader but I get this error and I don't know how to fix it.
Code:
******* Script runtime error *******
cannot cast undefined to int: (file ' maps/_hud_util.gsc', line 183)
self.bar.x = self.x - int((self.wudth - self.padding) / 2);
     *
Error: called from:
(file 'maps/_hud_util.gsc', line 161)
setPointBar( point, relativePoint, xOffset, yOffset);
     *
Error: called from:
(file 'maps/_main.gsc', line 130)
barElemBG setPoint(align,relative,x,y);
     *
Error: called from:
(file 'maps/_main.gsc', line 85)
self.Hud["BG"] = createRectangle("TOP", "TOP", 190, 0, 200, 200, (0,0,0), (1/4), 0, "white");
     *
Error: called from:
(file 'maps/_main.gsc', line 43)
self _createHud();
     *
Error: called from:
(file 'maps/_main.gsc', line 58)
wait 0.1;
     *
Please help, thank you in advance!
———————————————Video———————————————-
 
Last edited:

ISOCheated

Veteran
Messages
18
Reaction score
21
Points
803
I know this game is dead but I want to make a single player menu just because.
Im using this as 'createRectangle'
Code:
createRectangle(align, relative, x, y, width, height, color, alpha, sorting, shadero)
{
    barElemBG = newHudElem(self);
    barElemBG.elemType = "bar";
    barElemBG.width = width;
    barElemBG.height = height;
    barElemBG.align = align;
    barElemBG.relative = relative;
    barElemBG.xOffset = 0;
    barElemBG.yOffset = 0;
    barElemBG.children = [];
    barElemBG.color = color;
    barElemBG.alpha = alpha;
    barElemBG setShader( shadero, width , height );
    barElemBG.hidden = false;
    barElemBG.sort = sorting;
    barElemBG setPoint(align,relative,x,y);
    return barElemBG;
}

Here is the shader I'm trying to use (its pre-cached)
Code:
_createhud()
{
    self.Hud["BG"] = createRectangle("TOP", "TOP", 190, 0, 200, 200, (0,0,0), (1/4), 0, "white");
}
_destroyhud()
{
    self.Hud["BG"] destroy();
}

So the problem is every time I open the menu it shows the shader but I get this error and I don't know how to fix it.
Code:
******* Script runtime error *******
cannot cast undefined to int: (file ' maps/_hud_util.gsc', line 183)
self.bar.x = self.x - int((self.wudth - self.padding) / 2);
     *
Error: called from:
(file 'maps/_hud_util.gsc', line 161)
setPointBar( point, relativePoint, xOffset, yOffset);
     *
Error: called from:
(file 'maps/_main.gsc', line 130)
barElemBG setPoint(align,relative,x,y);
     *
Error: called from:
(file 'maps/_main.gsc', line 85)
self.Hud["BG"] = createRectangle("TOP", "TOP", 190, 0, 200, 200, (0,0,0), (1/4), 0, "white");
     *
Error: called from:
(file 'maps/_main.gsc', line 43)
self _createHud();
     *
Error: called from:
(file 'maps/_main.gsc', line 58)
wait 0.1;
     *
Please help, thank you in advance!
———————————————Video———————————————-
You cannot use your own createrectangle function for sp, you'll have to use the one that's defined in the common.ff.
 

P!X

Head Moderator
Staff member
Head Staff Team
Messages
408
Reaction score
590
Points
878
I know this game is dead but I want to make a single player menu just because.
Im using this as 'createRectangle'
Code:
createRectangle(align, relative, x, y, width, height, color, alpha, sorting, shadero)
{
    barElemBG = newHudElem(self);
    barElemBG.elemType = "bar";
    barElemBG.width = width;
    barElemBG.height = height;
    barElemBG.align = align;
    barElemBG.relative = relative;
    barElemBG.xOffset = 0;
    barElemBG.yOffset = 0;
    barElemBG.children = [];
    barElemBG.color = color;
    barElemBG.alpha = alpha;
    barElemBG setShader( shadero, width , height );
    barElemBG.hidden = false;
    barElemBG.sort = sorting;
    barElemBG setPoint(align,relative,x,y);
    return barElemBG;
}

Here is the shader I'm trying to use (its pre-cached)
Code:
_createhud()
{
    self.Hud["BG"] = createRectangle("TOP", "TOP", 190, 0, 200, 200, (0,0,0), (1/4), 0, "white");
}
_destroyhud()
{
    self.Hud["BG"] destroy();
}

So the problem is every time I open the menu it shows the shader but I get this error and I don't know how to fix it.
Code:
******* Script runtime error *******
cannot cast undefined to int: (file ' maps/_hud_util.gsc', line 183)
self.bar.x = self.x - int((self.wudth - self.padding) / 2);
     *
Error: called from:
(file 'maps/_hud_util.gsc', line 161)
setPointBar( point, relativePoint, xOffset, yOffset);
     *
Error: called from:
(file 'maps/_main.gsc', line 130)
barElemBG setPoint(align,relative,x,y);
     *
Error: called from:
(file 'maps/_main.gsc', line 85)
self.Hud["BG"] = createRectangle("TOP", "TOP", 190, 0, 200, 200, (0,0,0), (1/4), 0, "white");
     *
Error: called from:
(file 'maps/_main.gsc', line 43)
self _createHud();
     *
Error: called from:
(file 'maps/_main.gsc', line 58)
wait 0.1;
     *
Please help, thank you in advance!
———————————————Video———————————————-

Here is the source code of my sp menu, maybe it helps
You do not have permission to view link Log in or register now.


Also make sure you have developer and developer_script turned off
 
Last edited:
Top