Forum

> > CS2D > General > F2 to tile?
ForenübersichtCS2D-ÜbersichtGeneral-ÜbersichtEinloggen, um zu antworten

Englisch F2 to tile?

7 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Re: F2 to tile?

Rainoth
Moderator Off Offline

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

alt Re: F2 to tile?

Mami Tomoe
User Off Offline

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

Script:
Mehr >

alt Re: F2 to tile?

Rainoth
Moderator Off Offline

Zitieren
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.
4× editiert, zuletzt 05.07.15 13:41:58

alt Re: F2 to tile?

Mami Tomoe
User Off Offline

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

alt Re: F2 to tile?

Rainoth
Moderator Off Offline

Zitieren
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.
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antwortenGeneral-ÜbersichtCS2D-ÜbersichtForenübersicht