Forum

> > CS2D > Scripts > parse() does not parse
Forums overviewCS2D overview Scripts overviewLog in to reply

English parse() does not parse

11 replies
To the start Previous 1 Next To the start

old closed parse() does not parse

Grulf
User Off Offline

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

old Re: parse() does not parse

DC
Admin Off Offline

Quote
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

old Re: parse() does not parse

Grulf
User Off Offline

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

old Re: parse() does not parse

Apache uwu
User Off Offline

Quote
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

old Re: parse() does not parse

Grulf
User Off Offline

Quote
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

old Re: parse() does not parse

Apache uwu
User Off Offline

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

old Re: parse() does not parse

Jarxo
User Off Offline

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