From the book of 101 ways to go batshit insane
Consider the following code:
1
2
3
4
5
6
function flare(id, tokens)
	e = "explosion " ..math.floor(player(id, "x")).. " " ..math.floor(player(id, "y")).." 5 5 0"
	print("\""..e.."\"")
	parse(e)
	print("eh")
end
It prints me nicely, the following thing:
"explosion 8027 2593 5 5 1"
But no explosion. Yet, if I enter that into the console directly, yes, I see one.
What the hell? you must use player(id, "tilex")/player(id, "tiley") except of X and Y -.- Nonsense. As I said, it works when I type it into the console directly. DC Admin Offline
so there is an assignment for e with .." 5 5 0" at the end but e ends with " 5 5 1" when you print it? without any changes going on between those 2 steps?
that's quite impossible. I know that parse works perfectly fine. there's no room for bugs.
a general hint: use wrapper.lua and just the wrapped lua function for explosions. edited 1×, last 09.10.11 08:53:59 pm
DC has written
so there is an assignment for e with .." 5 5 0" at the end but e ends with " 5 5 1" when you print it? without any changes going on between those 2 steps?
that's quite impossible.
Sorry, my bad. I actually changed the last bit because when you're desperate for something to work you try everything. Sorry can't reproduce your error.
Works 100%.
1
2
3
4
5
6
7
8
9
10
11
12
addhook("spawn","_spawn")
function _spawn(id)
	flare(id)
end
function flare(id, tokens)
	e = "explosion " ..math.floor(player(id, "x")).. " " ..math.floor(player(id, "y")).." 5 5 0"
	print("\""..e.."\"")
	parse(e)
	print("eh")
end
Console:
1
2
3
4
Lua: Adding function '_spawn' to hook 'spawn'
ktexc joins the terrorist forces
"explosion 688 2288 5 5 0"
eh
edited 2×, last 09.10.11 08:56:56 pm
Hmm ... Well it does work in my other scripts. May as well paste all the code I guess:
http://pastebin.com/rPUxh2Ug
/edit: oh for fucks .. i overwrote parse.. thanks for your help lolz Bahaha, just noticed that.
Feels just like the time I wrote over menu() I think next time I'll calmly go over all the possibilities before lighting candles and praying to god...
Not the first time something this obvious has made me go mad I see you were tying to get the return for parse.
@DC is there a return for parse anyway?
(1 for failed, 0 for success)
I like your avatar. Apache uwu has written
I see you were tying to get the return for parse.
@DC is there a return for parse anyway?
(1 for failed, 0 for success)
I like your avatar.
Speaking of avatars, you decided to finally get one Context? +1 for you Admin/mod comment
this thread is not about avatars. DC Admin Offline
@Textual Context: no there is no return value for parse.