News: Welcome back to Bullworth! If you haven't already, you will need to reset your password..


Author Topic: LuaC: luascript.lua:68: 'end' expected <to close 'function' at line 45>  (Read 1967 times)

0 Members and 1 Guest are viewing this topic.

Offline Ky

  • Full Member
  • ***
  • Posts: 329
  • Gender: Male
  • <3
    • View Profile
ImportScript("\\Library\\LibTable.lua")
ImportScript("\\Library\\LibPed.lua")
local l_0_0 = false
 
MissionSetup = function()
  local l_1_0 = 270
  local l_1_1 = -110
  local l_1_2 = 6.4000000953674
 
  PlayerSetHealth(5000)
  AreaTransitionXYZ(0, l_1_0, l_1_1, l_1_2)
  SoundPlayStream("MS_DishonorableFight.rsm", 0.69999998807907)
  TextPrintString("Darby Full Boss Style", 4, 1)
  Wait("5000")
  TextPrintString("By Ky", 4, 1)
 
end
 
 F_MissionSetup = function()

  LoadAnimationGroup("BOSS_Darby")
  LoadAnimationGroup("P_Striker_A")
  LoadAnimationGroup("P_Striker_B")
  LoadActionTree("P_Striker_A")
  LoadActionTree("P_Striker_B")
  LoadActionTree("BOSS_Darby")
 
  PlayerSetControl(1)
 
  DisablePunishmentSystem(false)
 
 
 
  ClockSet(8, 30)
 
  ClockSetTickRate(0.0060000000521541)
 
  LaunchScript("SObjTest.lua")

end

MissionCleanup = function()
end
 
main = function()
  F_MissionSetup()
  gMissionRunning = true
  while gMissionRunning do
  if IsButtonPressed(15,0) then
  PedSetActionTree(gplayer, "/Global/P_Striker_A", "Act/Anim/P_Striker_A.act")
  elseif IsButtonPressed(3,0) then
  PedSetActionTree(gPlayer, "/Global/P_Striker_B", "Act/Anim/P_Striker_B.act")
  elseif IsButtonPressed(10,0) and IsButtonPressed(8,0) then
  PedSetActionTree(gplayer, "/Global/BOSS_Darby", "Act/Anim/BOSS_Darby.act")
  elseif IsButtonPressed(1,0) then
  PedSetActionNode(gPlayer, "/Global/BOSS_Darby/Offense/Short/Grapples/HeavyAttacks/Catch_Throw", "Act/Anim/BOSS_Darby.act")
  elseif IsButtonPressed(0,0) then
  PedSetActionNode(gPlayer, "/Global/BOSS_Darby/Offense/Short/Strikes/HeavyAttacks", "Act/Anim/BOSS_Darby.act")
  elseif IsButtonPressed(12,0) then
  PedSetActionNode(gPlayer, "/Global/P_Striker_A/Offense/Short/Strikes/LightAttacks", "Act/Anim/P_Striker_A.act")
  elseif IsButtonPressed(6,0) and IsButtonPressed(7,0) then
  PedSetActionNode(gplayer, "/Global/Actions/Offense/RunningAttacks/RunningAttacksDirect", "Act/Anim/GlobalActions.act")
  elseif IsButtonPressed(2,0) then
  PedSetActionTree(gplayer, "/Global/Player", "Act/Anim/Player.act")
  UpdateTextQueue()
    Wait(0)
   end
  end

Offline DaBOSS54320

  • Hero Member
  • ****
  • Posts: 3,398
  • Gender: Female
    • View Profile
Re: LuaC: luascript.lua:68: 'end' expected <to close 'function' at line 45>
« Reply #1 on: November 15, 2014, 09:20:20 PM »
Look at the bottom of your script, notice you have 2 'end's. The first end represents the end of all the 'if' and 'elseif' statements you have, and the 2nd one is the end of the while loop. However, you are missing one for the main function.

So, simply put another 'end' at the bottom of the script.

Offline Enderman

  • What i'm doing right now?
  • Full Member
  • ***
  • Posts: 293
  • Gender: Male
  • I'm no longer do mods for Bully ...
    • View Profile
    • bully-board.com
Re: LuaC: luascript.lua:68: 'end' expected <to close 'function' at line 45>
« Reply #2 on: November 15, 2014, 10:56:28 PM »
Hey Ky that my code  :euro:

FaZe

  • Guest
Re: LuaC: luascript.lua:68: 'end' expected <to close 'function' at line 45>
« Reply #3 on: November 16, 2014, 05:23:46 AM »
Whether it is or not is a completely different story, Kovn. Maybe it didn't work for him and he wants to know how to fix it, or maybe just by chance he did it himself almost exact to yours. Let's not start an argument about who's code it is, I'm saying this because I feel this is gonna end in an argument.

If you have a problem, please sort it out over Private Messages.
Thank you
~Evann

SWEGTA Agrees.
« Last Edit: November 16, 2014, 05:49:42 AM by SWEGTA »

Offline Unknownsoldier

  • Hero Member
  • ****
  • Posts: 2,773
    • View Profile
Re: LuaC: luascript.lua:68: 'end' expected <to close 'function' at line 45>
« Reply #4 on: November 29, 2014, 11:18:24 PM »
Found the problem. One more "end" was needed at the last line(68), due to an "if" statement placed at 45, but was never closed. Try this code:

Code: [Select]
ImportScript("\\Library\\LibTable.lua")
ImportScript("\\Library\\LibPed.lua")
local l_0_0 = false
 
MissionSetup = function()
  local l_1_0 = 270
  local l_1_1 = -110
  local l_1_2 = 6.4000000953674
 
  PlayerSetHealth(5000)
  AreaTransitionXYZ(0, l_1_0, l_1_1, l_1_2)
  SoundPlayStream("MS_DishonorableFight.rsm", 0.69999998807907)
  TextPrintString("Darby Full Boss Style", 4, 1)
  Wait("5000")
  TextPrintString("By Ky", 4, 1)
 
end
 
 F_MissionSetup = function()

  LoadAnimationGroup("BOSS_Darby")
  LoadAnimationGroup("P_Striker_A")
  LoadAnimationGroup("P_Striker_B")
  LoadActionTree("P_Striker_A")
  LoadActionTree("P_Striker_B")
  LoadActionTree("BOSS_Darby")
 
  PlayerSetControl(1)
 
  DisablePunishmentSystem(false)
 
 
 
  ClockSet(8, 30)
 
  ClockSetTickRate(0.0060000000521541)
 
  LaunchScript("SObjTest.lua")

end

MissionCleanup = function()
end
 
main = function()
  F_MissionSetup()
  gMissionRunning = true
  while gMissionRunning do
  if IsButtonPressed(15,0) then
  PedSetActionTree(gplayer, "/Global/P_Striker_A", "Act/Anim/P_Striker_A.act")
  elseif IsButtonPressed(3,0) then
  PedSetActionTree(gPlayer, "/Global/P_Striker_B", "Act/Anim/P_Striker_B.act")
  elseif IsButtonPressed(10,0) and IsButtonPressed(8,0) then
  PedSetActionTree(gplayer, "/Global/BOSS_Darby", "Act/Anim/BOSS_Darby.act")
  elseif IsButtonPressed(1,0) then
  PedSetActionNode(gPlayer, "/Global/BOSS_Darby/Offense/Short/Grapples/HeavyAttacks/Catch_Throw", "Act/Anim/BOSS_Darby.act")
  elseif IsButtonPressed(0,0) then
  PedSetActionNode(gPlayer, "/Global/BOSS_Darby/Offense/Short/Strikes/HeavyAttacks", "Act/Anim/BOSS_Darby.act")
  elseif IsButtonPressed(12,0) then
  PedSetActionNode(gPlayer, "/Global/P_Striker_A/Offense/Short/Strikes/LightAttacks", "Act/Anim/P_Striker_A.act")
  elseif IsButtonPressed(6,0) and IsButtonPressed(7,0) then
  PedSetActionNode(gplayer, "/Global/Actions/Offense/RunningAttacks/RunningAttacksDirect", "Act/Anim/GlobalActions.act")
  elseif IsButtonPressed(2,0) then
  PedSetActionTree(gplayer, "/Global/Player", "Act/Anim/Player.act")
  end
  UpdateTextQueue()
    Wait(0)
   end
  end