Forum

> > CS2D > Scripts > short way to change tiles
Forums overviewCS2D overview Scripts overviewLog in to reply

English short way to change tiles

8 replies
To the start Previous 1 Next To the start

old short way to change tiles

X-Files
User Off Offline

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

old Re: short way to change tiles

Zeik
User Off Offline

Quote
user ohaz has written
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)

old Re: short way to change tiles

VADemon
User Off Offline

Quote
@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

old Re: short way to change tiles

Zeik
User Off Offline

Quote
@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

old Re: short way to change tiles

VADemon
User Off Offline

Quote
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

old Re: short way to change tiles

ohaz
User Off Offline

Quote
@user Zeik: he wrote
Quote
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.

old Re: short way to change tiles

Zeik
User Off Offline

Quote
@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.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview