Forum

> > CS2D > General > F2 to tile?
Forums overviewCS2D overviewGeneral overviewLog in to reply

English F2 to tile?

7 replies
To the start Previous 1 Next To the start

old Re: F2 to tile?

Rainoth
Moderator Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
menus = {
[1] = {x = 88, y = 99, str = "Title,button 1,button 2"},
[2] = {x = 89, y = 98, str = "Title B,button 1,button 2"}
}

addhook("movetile","yey")
function yey(id,x,y)
	for k,v in pairs (menus) do
		if x == v.x and y == v.y then
			menu(id,v.str)
		end
	end
end

x and y are positions of your tiles and str is the menu string. all you have to do is copy the string that would call the menus you want and place it in the table.

old Re: F2 to tile?

Mami Tomoe
User Off Offline

Quote
@user Rainoth: I'm sitting here for about 5 minutes and I cant understand what to do.

Script:
More >

old Re: F2 to tile?

Rainoth
Moderator Off Offline

Quote
That code shouldn't even work. I've started tabbing it and there's missing ends >.>
You could begin by tabbing your code to make it readable. Trust me, it pisses off everyone if they have to read untabbed code and they normally just have to tab it themselves. So you're not helping out others just by posting such code. Secondly, you could use code tags in this forum, they also help.
Give me a sec and I'll fix your script then explain some more and then give you what you need.

// Here's your tabbed
code >

I also removed all the needless "if end if end if end" crap and changed it to "if elseif elseif elseif end"

/// I added the feature you wanted in the following
code >


//// and finally it's been a while since I've worked on lua so I thought I'd give it a go. Try if the script works fine with this
code >


Hope that helps. In the future please tab your code.
edited 4×, last 05.07.15 01:41:58 pm

old Re: F2 to tile?

Mami Tomoe
User Off Offline

Quote
parsing Lua autorun script 'sys/lua/autorun/Shop.LUA'
I think its working...
Where to put the X/Y? I tried this line:
[1] = {x = 123, y = 123...
But it did nothing

The file is on autorun...

old Re: F2 to tile?

Rainoth
Moderator Off Offline

Quote
Ooops! I missed two commas in between tables that's why it shouldn't have worked. I added them now in this
code >

I tested it and it did display a menu for me.
To the start Previous 1 Next To the start
Log in to replyGeneral overviewCS2D overviewForums overview