Forum

> > CS2D > Scripts > Button Image?
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Button Image?

9 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Button Image?

Rygna
User Off Offline

Zitieren
Hi!,
hey!, can you help me?
how to make Button Image?
i mean Make Button on screen with Image like custom GFX.

i try Visual Lua by user EngiN33R, that too hard for me.
if you can example how to make like that..
plase show me

thanks.

alt Re: Button Image?

Gaios
Reviewer Off Offline

Zitieren
I lol'd. Visual Lua is for advanced scripters and you even don't know how to script very simple script.. as I said before, add me on skype and I will learn you.

It's not easy as well.. there so many things to care.

alt Re: Button Image?

_Yank
User Off Offline

Zitieren
@user Gaios: Personally I think that that is incorrect. @user EngiN33R's VisualLua was made to help lazy (or not) scripters or scripters with less knowledge.

alt Re: Button Image?

GeoB99
Moderator Off Offline

Zitieren
I guess that's too far to make a Visual Lua script. From my perspective you don't seem to get used to most of things in Lua like arrays, tables and much more which a Visual Lua uses it.

I'd suggest you to read Lua Pil 1 (you can also check for other tutorials in Google) tutorial which covers up all the parts of Lua programming language so you can cope with most of those such as a table, an array, the correct usage of statements and many things.

Once you've got the main principle basics of most of things, you can take a look at an example of a Visual Lua code (in this case check user EngiN33R's Visual Lua script) and (maybe?) you can make a Visual Lua script in your own.

alt Re: Button Image?

Zeik
User Off Offline

Zitieren
You have to use the cs2d lua hook attack hook to call the cs2d lua cmd reqcld function (this way you can tell the player has clicked the screen), which runs the cs2d lua hook clientdata hook.
In the cs2d lua hook clientdata function you have to check where the player has actually clicked, to know wether he clicked the button or not. If he clicked the button, then you call the button's function to do whatever you want it to.

alt Re: Button Image?

THEMUD
User Off Offline

Zitieren
@user Rygna: Here is an explanation.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
addhook("attack", "_attack")
function _attack(id)
	reqcld(id, 2);
end

addhook("clientdata", "_cd")
function _cd(id, mode, data1, data2)
	if mode == 2 then
		if data1 == YOUR_DESIRED_X_POSITION then
			if data2 == YOUR_DESIRED_Y_POSITION then
				--Do your script here
			end
		end
	end
end

Or if you don't want to make the X and the Y really precised, you can let them between two values like this:
1
2
3
4
5
if data1 > YOUR_POSITION and data1 < YOUR_POSITION2 then
	if data2 > YOUR_POSITION and data2 < YOUR_POSITION2 then
		--Do your script here
	end
end
And I recommend this option. Because it gives the X and the Y the freespace they want and it will let you click on them efficiently.
1× editiert, zuletzt 26.01.16 13:50:30

alt Re: Button Image?

Rygna
User Off Offline

Zitieren
√ @user THEMUD, Hey!, thanks for explanation!.
that was great, i will test it.
√ @user Gaios, ok bro!, i will learn basic lua thanks.

Very thanks.
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht