Forum

> > CS2D > Scripts > how to use [Str] (starkkz strider.lua)
Forums overviewCS2D overview Scripts overviewLog in to reply

English how to use [Str] (starkkz strider.lua)

8 replies
To the start Previous 1 Next To the start

old how to use [Str] (starkkz strider.lua)

kalis
User Off Offline

Quote
i see in strider.lua from starkkz
how to use [Str]?
                              Strider[str].x = Strider[str].x + math.sin(angle) * 18
                              Strider[str].y = Strider[str].y - math.cos(angle) * 18
and :
Need array ?
local ? some things? !
help!

Admin/mod comment

"help lua" = retarded title. fixed.

old Re: how to use [Str] (starkkz strider.lua)

TimeQuesT
User On Online

Quote
tables are variables that can hold more than 1 value at time.(they are nearly the same as arrays)
strider is a table so "str" is the index number for example:


example = {}
example[1] = 5 -- "1" is the indexnumber.

or

example = {}
local str = 4 -- i give the variable "str" the value "4".
example[str] = 20 --the 4th place of the variable is given the value "20"
print (example[str]) -- this will put in the console a message out that displays "20". (the 4th place of the table)
edited 1×, last 08.03.11 02:34:59 pm

old Re: how to use [Str] (starkkz strider.lua)

DannyDeth
User Off Offline

Quote
Lol. Actually lmfao!

Strider is an array and you are trying to access it with the variable 'str'. If str equals "lol", then it would be the same as:
1
Strider["lol"]

Learn some programming basics. Srsly.

old Re: how to use [Str] (starkkz strider.lua)

Starkkz
Moderator Off Offline

Quote
STR is a value for count.

1
2
3
4
for str = count_from_start, count_to_end do
	-- This block will be called (count_to_end-count_from_start) Times.
	-- And the str value will be set to the current count
end -- end our count

I used that to call each strider in game

old Re: how to use [Str] (starkkz strider.lua)

kalis
User Off Offline

Quote
ok thanks
i need help more :
closest = random players near strider
example : local hpdmg = 10
                                             
                                             local closest = nil
                                             parse("sethealth "..closest[1].." "..player(closest[1],"health")-hpdmg)

old Re: how to use [Str] (starkkz strider.lua)

EngiN33R
Moderator Off Offline

Quote
To define a table called closest do this:
1
closest={}
To give a table a value,
1
closest={"foo","bar"}
Thus,
1
2
closest[1]=="foo"
closest[2]=="bar"
And that's all. But it won't work for that script.

Look, if you don't understand what 'call a value' or 'table' means - you shouldn't edit complicated (for you) scripts like Starkkz's. First learn, then edit.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview