Forum

> > CS2D > Scripts > Lua Scripts/Questions/Help
Forums overviewCS2D overview Scripts overviewLog in to reply

English Lua Scripts/Questions/Help

6,770 replies
Page
To the start Previous 1 2134 135 136338 339 Next To the start

old Re: Lua Scripts/Questions/Help

Lee
Moderator Off Offline

Quote
Homer has written
Thanks yellow, and blazzing, Sorry, but I have another question xD, Im curious about what the string.sub(t,1,4) does. Like what is it's function really. And why are the arguments t,1,4? Thanks for all your help


print(string.sub("Hello World", 1, 5))

Hello

-----------------------------------------------------

print(string.sub("Hello World", 1, 4) .. " Yeah")

Hell Yeah

-----------------------------------------------------

print("YAY"..string.sub("Hello World", 6))

YAY World

old Re: Lua Scripts/Questions/Help

YellowBanana
BANNED Off Offline

Quote
string.reverse doesn't seem to work ..:(

1
2
3
4
sentence = "reviver"

print(string.format("Original sentence: %s",sentence))
print(string.format("Reversed sentence: %s",sentence:reverse()))

output::
Original sentence: reviver
Reversed sentence: reviver

old Re: Lua Scripts/Questions/Help

Homer
User Off Offline

Quote
Lol, Im sorry yellow, but are you trying to reverse reviver? reviver is reversable, so Not sure, but try using a different word?

old Re: Lua Scripts/Questions/Help

Homer
User Off Offline

Quote
YES! That's the word palindrome, Dang it, I couldn't remember what it was called. And guess what!! ANOTHER REQUEST! Well, I am asking on how to make a person request a register say like
!register <name> <pass>
and it stores it in a file, for acess. Then, a person can theoretically look at all the stored usernames. I know one of the things, but don't know the file open, write and close, All I know is that io.open.file or something is open close and write.
edited 1×, last 10.01.10 04:19:10 am

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
Homer, read these

io.open
http://www.lua.org/manual/5.1/manual.html#pdf-io.open
Opens a file in a specific format for reading/writing to it.

io.read or file:read
http://www.lua.org/manual/5.1/manual.html#pdf-file:read
Read from the file with the given format and returns a string (or nil)

io.write or file:write
http://www.lua.org/manual/5.1/manual.html#pdf-file:write
Writes to the stream the parameter(s) you passed to it.

file:close or io.close
http://www.lua.org/manual/5.1/manual.html#pdf-file:close
Once you finished working with your file, you can close it.

old Re: Lua Scripts/Questions/Help

memo
COMMUNITY BANNED Off Offline

Quote
i have 2 question :

1- i post it here first but no one answer me so i repeat it :
need help with this lvl script the credits never shows why ?
Spoiler >


2- dose any one know a script to control the bot movement ?

old Re: Lua Scripts/Questions/Help

DC
Admin Off Offline

Quote
1 - lol... do you seriously wonder that no one answers when you post a script with so many lines?! only post the important parts! otherwise nobody will even read it.

2 - you can't control the bot movement. the only thing you can do is using commands like cs2d cmd setpos to change the position of bots. however I wouldn't recommend that because it's not a good solution and it might confuse the AI when you suddenly change the position.

old Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Quote
DC has written
2 - you can't control the bot movement. the only thing you can do is using commands like cs2d cmd setpos to change the position of bots. however I wouldn't recommend that because it's not a good solution and it might confuse the AI when you suddenly change the position.

There is other way, making own bots.
It's not easy, but I can say it's possible since I made small AI on Lua.

By the way, some how if I use "\n" in print command, first line last letter disappear.
1
print("he[b]y[/b]\nhey")
So then should be... "*\n"

@Black, you should make double post.
Everyone saw you post already, I said you should optimize your script (on PM) already... You said "I will try"
edited 1×, last 10.01.10 01:25:53 pm

old Re: Lua Scripts/Questions/Help

memo
COMMUNITY BANNED Off Offline

Quote
i try but how i gonna make it less lines i can't .
and about the bots Blazzingxx you have a script control the bots movements or what .....?

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
I don't think that scripting NPCs would be a smart idea.
You would have to check if this NPCs is being shot or not, and thinking on that would just give me headache

old Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Quote
There is about 10 scripts about making bots.
Yea, that's a bit confusing since you have to check collisions for scripted bullets.

Anyway, I'm just scripting stuff I made on Blitzmax.

old Re: Lua Scripts/Questions/Help

Vectarrio
User Off Offline

Quote
Blazzingxx has written
since you have to check collisions for scripted bullets.
.
Scripted bullets? How to do it? I really want to use it!

old Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Quote
There is few pages back...
Script of snow for example, similar script to make bullets.
Spoiler >


Scripted bullets and other stuff like that reserved for my mods already.

old Re: Lua Scripts/Questions/Help

TicTac
BANNED Off Offline

Quote
Help!

Anyone know how script like.. when you say !getinpas
you get in car as passanger and !quitpas you out as passanger.

Sorry for bad english..

old Re: Lua Scripts/Questions/Help

memo
COMMUNITY BANNED Off Offline

Quote
ok i try to cut the part i think its making the script go wrong
hers is Now help me

Spoiler >

its says always :lua: funcs.lua:8: attempt to index global 'hero' (a nil value)

i don't know what to do now !!

old Re: Lua Scripts/Questions/Help

memo
COMMUNITY BANNED Off Offline

Quote
its still crashes when open in new game ?!

i just do what you tell me ....

Spoiler >
To the start Previous 1 2134 135 136338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview