Forum

> > CS2D > Scripts > short way to change tiles
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch short way to change tiles

8 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt short way to change tiles

X-Files
User Off Offline

Zitieren
1
parse('settile 30 145 2')

i want to change tiles btw 30 145 and 45 200
is there short way to do this ?
i dont want to write all codes like 31 146, 31 147, 30 146 etc...

alt Re: short way to change tiles

Zeik
User Off Offline

Zitieren
user ohaz hat geschrieben
1
2
3
4
5
for x = 30,45 do
	for y = 145,200 do
		parse('settile '..x..' '..y..' 2')
	end
end


Wouldn't it "settile" in (30, 145), (30, 200), (45, 145) and (45, 200) instead of only (30, 145) and (45, 200) as expected?

If so, then I only think of creating a function as solution:
1
2
3
function setTile(x, y, tile)
     parse('settile '..x..' '..y..' '..tile)
end

You call it like:
1
setTile(30, 145, 2)

You can't make it shorter unless what you want to do follows a pattern (like drawing a square or something similar)

alt Re: short way to change tiles

VADemon
User Off Offline

Zitieren
@user Zeik, user ohaz's code fills a rectangle as requested, don't know what you mean.
Top left: 30|145
Top right: 45|145
Bottom left: 30|200
Bottom right: 45|200

UPD: It loops through every coordinate, hence the for loop. Take a look at WorldEdit's code

alt Re: short way to change tiles

Zeik
User Off Offline

Zitieren
@user VADemon: Ah, I always get confused with lua's syntax

Anyway, @user X-Files: didn't say he wanted a rectangle... he just wrote random coordinates...

Mmh I read back his post and realized that he meant to say "between" when he said "btw"? -.-

It'd be better if they are more specific when asking for help

alt Re: short way to change tiles

VADemon
User Off Offline

Zitieren
It'd be better if one asking for help actually knew English and looked up unknown new words to describe his problem, but that's too much work for these community members.
Trust me after some time spent here you learn to understand those people, probably a useful skill in the service industry (e.g. support)
Before going completely offtopic:

Anybody asking for help, use translators to LOOKUP SINGLE WORDS. You are more likely to get adequate responses and help

alt Re: short way to change tiles

ohaz
User Off Offline

Zitieren
@user Zeik: he wrote
Zitat
i want to change tiles btw 30 145 and 45 200
. Since it wouldn't have made any sense this way, I thought he meant "between" with btw (even if btw usually means by the way).
Wouldn't have made any sense otherwise because he already wrote the answer down for that question.

alt Re: short way to change tiles

Zeik
User Off Offline

Zitieren
@user ohaz: Yeah, it made no sense for me when I first read it because I thought he didn't know what "btw" meant so I skipped the word (because a lot of people writes incomprehensible texts here). My mistake.
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht