Forum

> > CS2D > Scripts > tween_color (lua)
Forums overviewCS2D overview Scripts overviewLog in to reply

English tween_color (lua)

4 replies
To the start Previous 1 Next To the start

old tween_color (lua)

limonata
User Off Offline

Quote
1
2
3
4
5
addhook("join","as")
function as()
local text = parse('hudtxt 1 "Test "282 26')
tween_color(text,2000,050,255,100)
end

It doesnt work please fix it

old Re: tween_color (lua)

Apache uwu
User Off Offline

Quote
Please read up on cs2d lua hook join, and cs2d cmd hudtxt2, and cs2d lua cmd tween_color.

The `join` hook sends a parameter of `ID`, which is perfect because it is unique for every user.

The `hudtxt2`/`hudtxt` requires an ID to be specified so that other commands that modify this text.

The `tween_color` command modifies ID of images, so it does not work on `hudtxt2`. (? Correct me if I'm wrong ?)

1
2
3
4
5
addhook("join","as")
function as(id)
	parse('hudtxt2 '..id..' '..id..' "Test" 282 26')
	tween_color(id,2000,050,255,100)
end

old Re: tween_color (lua)

DC
Admin Off Offline

Quote
@user limonata: The problems with your code are:

1. Line 3: cs2d lua cmd parse command doesn't return any value. So doing something like variable=parse(...) NEVER makes any sense.

2. Line 4: All the tween commands work with images only. They neither work with players nor with any texts. This is the second time today you are trying to use them with other stuff than images. This simply doesn't work. Images only!

Solution:
The command you need to fade the color of a text is cs2d cmd hudtxtcolorfade. Note that it is a CS2D console command so you have to use it with cs2d lua cmd parse when using it in a Lua script. Also the ID of the hudtxt is 1 because you specified 1 as ID (see: cs2d cmd hudtxt)
1
parse("hudtxtcolorfade 0 1 2000 50 255 100")


@user Apache uwu: Your code isn't correct either. You are using cs2d lua cmd tween_color with a player ID. It expects an image ID.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview