Forum

> > CS2D > Scripts > os.date and script errors
Forums overviewCS2D overview Scripts overviewLog in to reply

English os.date and script errors

12 replies
To the start Previous 1 Next To the start

old os.date and script errors

Alistaire
User Off Offline

Quote
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
26
27
28
p_a1=0
p_a2=0
p_b1=0
p_b2=0
p_c1=0
p_c2=0
rot_a=0
rot_b=0
rot_c=0

table_a[p_a1]=1
table_a[p_a2]=1

table_a[p_b1]=0
table_a[p_b2]=1

table_a[p_c1]=2
table_a[p_c2]=1

addhook(second,"p_move")
function p_move
	rot_a=os.date("%I")*30
	rot_b=os.date("%M")*6
	rot_c=os.date("%S")*6
	entity(""+table_a[p_a1]+","+table_a[p_a2]+","int4"")=rot_a
	entity(""+table_a[p_b1]+","+table_a[p_b2]+","int4"")=rot_b
	entity(""+table_a[p_c1]+","+table_a[p_c2]+","int4"")=rot_c
endtable_a={}

So something's wrong with my script; the rot_a=os.date("..") is not working, and the entity(""+table_a[p_a1]+" etc.) neither.

The lua errors are:

Errors has written
'(' expected near 'entity'
'(' expected near 'rot_a'


this way..

old Re: os.date and script errors

Alistaire
User Off Offline

Quote
I've changed it a bit;

1
2
3
4
5
function p_move()
	entity("table_a[p_a1],table_a[p_a2],int4")="os.date("%I")*30"
	entity("table_a[p_b1],table_a[p_b2],int4")="os.date("%M")*6"
	entity("table_a[p_c1],table_a[p_c2],int4")="os.date("%S")*6"
end

Only error left is "unexpected symbol near "="";

="os.date("%I")*30

old Re: os.date and script errors

MikuAuahDark
User Off Offline

Quote
user Alistaire has written
Only error left is "unexpected symbol near "="";

="os.date("%I")*30

hmm
1
2
3
4
5
function p_move()
     entity("table_a[p_a1],table_a[p_a2],int4")=os.date("%I")*30
     entity("table_a[p_b1],table_a[p_b2],int4")=os.date("%M")*6
     entity("table_a[p_c1],table_a[p_c2],int4")=os.date("%S")*6
end
try it
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview