Forum

> > CS2D > Scripts > Lua Scripts/Questions/Help
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Lua Scripts/Questions/Help

6.770 Antworten
Seite
Zum Anfang Vorherige 1 2134 135 136338 339 Nächste Zum Anfang

alt Re: Lua Scripts/Questions/Help

Lee
Moderator Off Offline

Zitieren
Homer hat geschrieben
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

alt Re: Lua Scripts/Questions/Help

YellowBanana
BANNED Off Offline

Zitieren
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

alt Re: Lua Scripts/Questions/Help

Homer
User Off Offline

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

alt Re: Lua Scripts/Questions/Help

Homer
User Off Offline

Zitieren
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.
1× editiert, zuletzt 10.01.10 04:19:10

alt Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Zitieren
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.

alt Re: Lua Scripts/Questions/Help

memo
COMMUNITY BANNED Off Offline

Zitieren
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 ?

alt Re: Lua Scripts/Questions/Help

DC
Admin Off Offline

Zitieren
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.

alt Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Zitieren
DC hat geschrieben
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"
1× editiert, zuletzt 10.01.10 13:25:53

alt Re: Lua Scripts/Questions/Help

memo
COMMUNITY BANNED Off Offline

Zitieren
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 .....?

alt Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Zitieren
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

alt Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Zitieren
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.

alt Re: Lua Scripts/Questions/Help

Vectarrio
User Off Offline

Zitieren
Blazzingxx hat geschrieben
since you have to check collisions for scripted bullets.
.
Scripted bullets? How to do it? I really want to use it!

alt Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Zitieren
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.

alt Re: Lua Scripts/Questions/Help

TicTac
BANNED Off Offline

Zitieren
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..

alt Re: Lua Scripts/Questions/Help

memo
COMMUNITY BANNED Off Offline

Zitieren
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 !!

alt Re: Lua Scripts/Questions/Help

memo
COMMUNITY BANNED Off Offline

Zitieren
its still crashes when open in new game ?!

i just do what you tell me ....

Spoiler >
Zum Anfang Vorherige 1 2134 135 136338 339 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht