PDA

View Full Version : Weird problem with command's end



Xkower8181
April 28th, 2014, 22:15
Help me guys I got a very weird problem. I don't know how to fix it!
This is shown when I add it to srb2 6778
And this is how command ends 6779
If someone wants to know how is named lump with command script so here it is: LUA_BODY

Sky
April 28th, 2014, 22:21
Why do you have */ there? That's to mark the end of a comment. Lua lumps have to have a LUA_ prefix as well, and having three lines of code doesn't really help.

Xkower8181
April 29th, 2014, 13:14
I mean I have LUA_BODY not LUMP_BODY sorry for fail

- - - - - - - - - -

Okay so i gonna delete it now ;)

- - - - - - - - - -

Oh i don't see your post in my first custom command help topic and that you said there it solved the problem ^_^

- - - - - - - - - -

Okay this don't help because it says "WARNING: RusssianHat.wad| LUA_BODY: 80: unexpected symbol near ')'

Sky
April 29th, 2014, 13:38
Can you post the full Lua code? I don't know how to fix it unless if you show it.

Xkower8181
April 29th, 2014, 15:07
okay you should got on pv hatsandcapsbeta.wad

Sky
April 29th, 2014, 17:24
...what? I don't understand.

Can you post the full Lua code here?

Xkower8181
April 30th, 2014, 14:49
Okay here's the code:
COM_AddCommand("rushat", function(player)
if player.mo
freeslot(
"S_RUSHATFOLLOW1",
"S_RUSHATFOLLOW2",
"S_RUSHATFOLLOW3",
"S_RUSHATFOLLOW4",
"S_RUSHATFOLLOW5",
"S_RUSHATFOLLOW6",
"MT_RUAHAT")

//normal height characters
states[S_RUSHATFOLLOW1] = {SPR_RUSH, 0, 1, A_CapeChase, FRACUNIT*33, FRACUNIT*-7, S_RUSHATFOLLOW1}
states[S_RUSHATFOLLOW2] = {SPR_RUSH, 0, 1, A_CapeChase, FRACUNIT*23, FRACUNIT*-7, S_RUSHATFOLLOW2}
//short characters
states[S_RUSHATFOLLOW3] = {SPR_RUSH, 0, 1, A_CapeChase, FRACUNIT*26, FRACUNIT*-7, S_RUSHATFOLLOW3}
states[S_RUSHATFOLLOW4] = {SPR_RUSH, 0, 1, A_CapeChase, FRACUNIT*22, FRACUNIT*-7, S_RUSHATFOLLOW4}
//Crawla Honcho and Robo Hood need a taller following hat that doesent adjust for spin
states[S_RUSHATFOLLOW5] = {SPR_RUSH, 0, 1, A_CapeChase, FRACUNIT*38, FRACUNIT*-7, S_RUSHATFOLLOW5}
//Eggman needs and even TALLER following hat! With no spin adjust, of course
states[S_RUSHATFOLLOW6] = {SPR_RUSH, 0, 1, A_CapeChase, FRACUNIT*64, FRACUNIT*-7, S_RUSHATFOLLOW6}

addHook("ThinkFrame", do
for player in players.iterate
if player.mo
and not (player.pflags & PF_NIGHTSMODE)
if player.health and not player.mo.hat
player.mo.hat = P_SpawnMobj(player.mo.x, player.mo.y, player.mo.z+player.mo.height, MT_RUSHAT)
player.mo.hat.target = player.mo
end
end
end
end)

addHook("ThinkFrame", do
for player in players.iterate

if player.health and player.mo.hat
//this adjusts the hat when in any spin state
if (player.pflags & PF_JUMPED)
or (player.pflags & PF_MACESPIN)
or (player.mo.tracer and player.mo.tracer.type == MT_TUBEWAYPOINT)
or (player.pflags & PF_STARTDASH)
or (player.pflags & PF_SPINNING)
then
P_SetMobjStateNF(player.mo.hat, S_TOPHATFOLLOW2)
else
P_SetMobjStateNF(player.mo.hat, S_TOPHATFOLLOW1)
end
end

if player.health and player.mo.hat
and (player.mo.skin == "tails")
or (player.mo.skin == "cream")
//the shorter characters need a shorter hat adjust
if (player.pflags & PF_JUMPED)
or (player.pflags & PF_MACESPIN)
or (player.mo.tracer and player.mo.tracer.type == MT_TUBEWAYPOINT)
or (player.pflags & PF_STARTDASH)
or (player.pflags & PF_SPINNING)
then
P_SetMobjStateNF(player.mo.hat, S_RUSHATFOLLOW4)
else
P_SetMobjStateNF(player.mo.hat, S_RUSHATFOLLOW3)
end
end

if player.health and player.mo.hat
and (player.mo.skin == "crawlahoncho") or (player.mo.skin == "robo-hood")
//Crawla Honcho and Robo Hood hat adjust, no spin adjust
P_SetMobjStateNF(player.mo.hat, S_RUSHATFOLLOW5)
end

if player.health and player.mo.hat
and (player.mo.skin == "eggman")
//Eggman follow adjust, no spin adjust
P_SetMobjStateNF(player.mo.hat, S_RUSHATFOLLOW6)
end
end)

Colby
April 30th, 2014, 16:11
I'm no Lua expert, but would you need a closing parenthesis here?



addHook("ThinkFrame", do
for player in players.iterate

Sky
April 30th, 2014, 22:32
You had quite a few gaping holes in your code. There were many ends missing, and you needed to add a hook to some of the code. There was also a few misspellings...like MT_RUAHAT and S_TOPHAT (which in your case had to be S_RUSHAT).

Fixed code:


freeslot(
"S_RUSHATFOLLOW1",
"S_RUSHATFOLLOW2",
"S_RUSHATFOLLOW3",
"S_RUSHATFOLLOW4",
"S_RUSHATFOLLOW5",
"S_RUSHATFOLLOW6",
"MT_RUSHAT")

//normal height characters
states[S_RUSHATFOLLOW1] = {SPR_RUSH, 0, 1, A_CapeChase, FRACUNIT*33, FRACUNIT*-7, S_RUSHATFOLLOW1}
states[S_RUSHATFOLLOW2] = {SPR_RUSH, 0, 1, A_CapeChase, FRACUNIT*23, FRACUNIT*-7, S_RUSHATFOLLOW2}
//short characters
states[S_RUSHATFOLLOW3] = {SPR_RUSH, 0, 1, A_CapeChase, FRACUNIT*26, FRACUNIT*-7, S_RUSHATFOLLOW3}
states[S_RUSHATFOLLOW4] = {SPR_RUSH, 0, 1, A_CapeChase, FRACUNIT*22, FRACUNIT*-7, S_RUSHATFOLLOW4}
//Crawla Honcho and Robo Hood need a taller following hat that doesent adjust for spin
states[S_RUSHATFOLLOW5] = {SPR_RUSH, 0, 1, A_CapeChase, FRACUNIT*38, FRACUNIT*-7, S_RUSHATFOLLOW5}
//Eggman needs and even TALLER following hat! With no spin adjust, of course
states[S_RUSHATFOLLOW6] = {SPR_RUSH, 0, 1, A_CapeChase, FRACUNIT*64, FRACUNIT*-7, S_RUSHATFOLLOW6}

COM_AddCommand("rushat", function(player)
if player.mo
addHook("ThinkFrame", do
for player in players.iterate
if player.mo
and not (player.pflags & PF_NIGHTSMODE)
if player.health and not player.mo.hat
player.mo.hat = P_SpawnMobj(player.mo.x, player.mo.y, player.mo.z+player.mo.height, MT_RUSHAT)
player.mo.hat.target = player.mo
end
end
end
end)

addHook("ThinkFrame", do
for player in players.iterate
if player.health and player.mo.hat
//this adjusts the hat when in any spin state
if (player.pflags & PF_JUMPED)
or (player.pflags & PF_MACESPIN)
or (player.mo.tracer and player.mo.tracer.type == MT_TUBEWAYPOINT)
or (player.pflags & PF_STARTDASH)
or (player.pflags & PF_SPINNING)
P_SetMobjStateNF(player.mo.hat, S_RUSHATFOLLOW2)
else
P_SetMobjStateNF(player.mo.hat, S_RUSHATFOLLOW1)
end
end
end
end)

addHook("ThinkFrame", do
if player.health and player.mo.hat
and (player.mo.skin == "tails")
or (player.mo.skin == "cream")
//the shorter characters need a shorter hat adjust
if (player.pflags & PF_JUMPED)
or (player.pflags & PF_MACESPIN)
or (player.mo.tracer and player.mo.tracer.type == MT_TUBEWAYPOINT)
or (player.pflags & PF_STARTDASH)
or (player.pflags & PF_SPINNING)
P_SetMobjStateNF(player.mo.hat, S_RUSHATFOLLOW4)
else
P_SetMobjStateNF(player.mo.hat, S_RUSHATFOLLOW3)
end
end
end)

addHook("ThinkFrame", do
if player.health and player.mo.hat
and (player.mo.skin == "crawlahoncho") or (player.mo.skin == "robo-hood")
//Crawla Honcho and Robo Hood hat adjust, no spin adjust
P_SetMobjStateNF(player.mo.hat, S_RUSHATFOLLOW5)
end
end)

addHook("ThinkFrame", do
if player.health and player.mo.hat
and (player.mo.skin == "eggman")
//Eggman follow adjust, no spin adjust
P_SetMobjStateNF(player.mo.hat, S_RUSHATFOLLOW6)
end
end)
end
end)

Xkower8181
May 1st, 2014, 11:19
Still WARNING: RusssianHat.wad| LUA_BODY: 80: unexpected symbol near ')'

Sky
May 1st, 2014, 13:52
Still WARNING: RusssianHat.wad| LUA_BODY: 80: unexpected symbol near ')'That error doesn't show up for me with the code I posted. Make sure that you replace all of your code with all of mine.

Can you post the WAD file here so I can take a look and try to fix it?

Xkower8181
May 2nd, 2014, 15:49
Okay here it is
6800

Sky
May 2nd, 2014, 22:03
...you didn't replace my code with yours. Here's the fixed WAD: 6801

Xkower8181
May 2nd, 2014, 22:10
Thanks you Sky!