Forum

> > CS2D > Scripts > localhud
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch localhud

20 Antworten
Seite
Zum Anfang Vorherige 1 2 Nächste Zum Anfang

verschoben localhud

Mami Tomoe
User Off Offline

Zitieren
local hud_img = image("gfx/7hud/full.png", 554, 300, 2)
i have a problem with it, it sometimes disappear from itself for no reason how can i fix it? or if theres any better image hud... ty

Admin/Mod Kommentar

This seems to be about CS2D not Stranded II. Moved /DC

alt Re: localhud

_Yank
User Off Offline

Zitieren
Its a CS2D bug, you can't do anything about it. You will need to "redraw" the image manually.

alt Re: localhud

DC
Admin Off Offline

Zitieren
All images are removed on roundstart if that's what you're talking about (this is intended behavior).

alt Re: localhud

The Gajos
BANNED Off Offline

Zitieren
@user _Yank: haha no. If you forgot to clear memory of variable that store image id, another function of removing image, can simply disappear such other image.

1
2
3
4
5
6
7
8
9
10
11
12
13
var1 = image() -- var1=1001
var2 = image() -- var2=1002

freeimage(var1)
-- no var1=nil and it still store 1001

var3 = image() -- var3=1001 because it's free

-- and now at eg. if player leave (hook):
if var1 then
	freeimage(var1)
	-- so, it removed image with id from var3 (1001)
end
1× editiert, zuletzt 20.07.15 22:05:34

alt Re: localhud

_Yank
User Off Offline

Zitieren
@user The Gajos: That was confusing '-'
But thanks for the tip, will try it out
BTW, DC still should fix this. I'm (We're ?) tired of always having to find workarrounds to get things working properly.

alt Re: localhud

Yates
Reviewer Off Offline

Zitieren
Agreed. Freeimage should always set the variable used for the image to nil after being removed.

alt Re: localhud

Mami Tomoe
User Off Offline

Zitieren
I have no idea what you guys are talking about... can someone give me a working script that will last forever? for hud image? or freeimage...?

alt Re: localhud

The Gajos
BANNED Off Offline

Zitieren
Guys, because I don't have time in this moment, you can do it using _G table and:
1
2
3
4
5
_freeimage = freeimage
function freeimage(imgeid)
	_freeimage(imageid)
	-- such code with _G table :)
end
@user Mami Tomoe: and then if someone will do it for you, you have to run (dofile) the script before main script.


EDIT:
user _Yank hat geschrieben
user The Gajos: Dude, what a useless post --'

You needn't to say that .
1× editiert, zuletzt 21.07.15 19:12:56

alt Re: localhud

_Yank
User Off Offline

Zitieren
@user The Gajos: Dude, what a useless post --'

Anyways, here's my fix (haven't been deep tested yet)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
ifix = {
	image = image,
	freeimage = freeimage,
	data = {}
}

function image(path, ...)
	ifix.data[path] = ifix.data[path] or {}
	table.insert(ifix.data[path], false)
	ifix.data[path][#ifix.data[path]] = ifix.image(path, ...)
	return ifix.data[path][#ifix.data[path]]
end

function freeimage(object, ...)
	for path, data in pairs(ifix.data) do
		for key, core in ipairs(data) do
			if core == object then
				ifix.freeimage(core)
				table.remove(ifix.data[path], key)
				return
			end
		end
	end
	print("\169255000000Image["..object.."] not found!")
end

EDIT: Fixed a bug
EDIT2: Easier error handling
3× editiert, zuletzt 24.07.15 11:52:26

alt Re: localhud

The Gajos
BANNED Off Offline

Zitieren
@user Mami Tomoe: No meme pls. Just save this script to newImageSystem.lua in sys/lua location and in your main script on FIRST line type:
dofile('sys/lua/newImageSystem.lua')

alt Re: localhud

The Gajos
BANNED Off Offline

Zitieren
user Mami Tomoe hat geschrieben
local hud_img = image("gfx/7hud/full.png", 554, 300, 2)

Like this! but you have to do the things that I said.

alt Re: localhud

_Yank
User Off Offline

Zitieren
I think that the script is not working pretty well
Could you guys test it please ?

alt Re: localhud

Mami Tomoe
User Off Offline

Zitieren
Mehr >

i tried this code but i dont know where to add this: "gfx/7hud/full.png"

alt Re: localhud

GeoB99
Moderator Off Offline

Zitieren
Just replace "path" at 10 line near "ifix.image(path, ...)" with "gfx/7hud/full.png", so it'll be like this.
1
ifix.image("gfx/7hud/full.png", ...)
Zum Anfang Vorherige 1 2 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht