[Lua] Error in script menu

User Tag List

Results 1 to 10 of 10
  1. #1
    aseroth's Avatar Member
    Reputation
    2
    Join Date
    Dec 2007
    Posts
    22
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [Lua] Error in script

    First off, all credit goes to Maven/Deathdude for the base script itself (the random casting script) on ***********

    Okay, so I edited a random casting boss script to fit an NPC I made in-game. However, whenever I try to load up the script, I get the following error:

    "scripts\BOSS-Jon_CJG.lua:1: unexpected symbol near 'n' "

    I'm not sure what I'm looking for here since I am a noob when it comes to scripting of any kind, so I will post the entire script for you guys to look over.

    HTML Code:
    --Written by Maven (AKA Deathdude or Maven01)
    
    --[[REMEMBER THIS FOR EDITING
    pUnit:GetRandomPlayer(0) = Targets Random Player
    pUnit:GetRandomPlayer(1) = Targets Player in Shortrange
    pUnit:GetRandomPlayer( 2) = Targets Player in Midrange
    pUnit:GetRandomPlayer(4) = Targets Player in Longrange
    pUnit:GetRandomPlayer(4) = Targets Player with Mana
    pUnit:GetRandomPlayer( 5) = Targets Player with Rage
    pUnit:GetRandomPlayer(6) = Targets Player with Energy
    pUnit:GetRandomPlayer(7) = Targets any player that is not Main Tank
    pUnit:GetMainTank = Targets Main Tank
    pUnit:GetAddTank = Targets Offtank
    ]]
    
    
    local NPC_ID = 70070
    
    local Spell_1 = 47610 --For Boss_1
    local BuffSelf = 48932 --For Boss_2
    local Spell_2 = 59172 --For Boss_3
    
    local MessageBegin = "You humiliated me! You made me shut down everything! Now you will pay!"
    
    function Boss_OnCombat(pUnit, Event)
    Phase = math.random(1,3)
    if Phase == 1 then
    pUnit:SendChatMessage(12, 0, "You humiliated me! You made me shut down everything! Now you will pay!")
    pUnit:RemoveEvents();
    pUnit:RegisterEvent("Boss_1", math.random(1000, 30000), 0)
    end
    if Phase == 2 then
    pUnit:SendChatMessage(12, 0, "I am everything you ph33r!")
    pUnit:RemoveEvents();
    pUnit:RegisterEvent("Boss_2", math.random(1000, 30000), 0)
    end
    if Phase == 3 then
    pUnit:SendChatMessage(12, 0, "Death to the fanboys, death to the living!")
    pUnit:RemoveEvents();
    pUnit:RegisterEvent("Boss_3", math.random(1000, 30000), 0)
    end
    end
    
    function Boss_1(pUnit, Event)
    local plr = pUnit:GetMainTank()
    if (plr ~= nil) then
    pUnit:FullCastSpellOnTarget(Spell_1, plr) 
    pUnit:RemoveEvents();
    pUnit:RegisterEvent("Restart_Over", 1000, 0)
    end
    end
    
    function Boss_2(pUnit, Event) --Makes Boss Buffself
    pUnit:CastSpell(BuffSelf) 
    pUnit:RemoveEvents();
    pUnit:RegisterEvent("Restart_Over", 1000, 0)
    end
    
    function Boss_3(pUnit, Event)
    local plr = pUnit:GetMainTank()
    if (plr ~= nil) then
    pUnit:CastSpellOnTarget(Spell_2, plr)
    pUnit:RemoveEvents();
    pUnit:RegisterEvent("Restart_Over", 1000, 0)
    end
    end
    
    function Restart_Over(pUnit, Event)
    local Phase = math.random(1,3)
    if Phase == 1 then
    pUnit:RegisterEvent("Boss_1", math.random(1000, 45000), 0)
    end
    if Phase == 2 then
    pUnit:RegisterEvent("Boss_2", math.random(1000, 45000), 0)
    end
    if Phase == 3 then
    pUnit:RegisterEvent("Boss_3", math.random(1000, 45000), 0)
    end
    end
    
    
    local MessageEndCombat = "I won't beat around the bush, this was just a minor setback."
    local MessageOnDied = "I will have my....revenge...!"
    function Boss_OnLeaveCombat(pUnit, Event)
    pUnit:SendChatMessage(12, 0, MessageEndCombat)
    pUnit:RemoveEvents()
    end
    function Boss_OnDied(pUnit, Event)
    pUnit:SendChatMessage(12, 0, MessageOnDied)
    pUnit:RemoveEvents()
    end
    RegisterUnitEvent(NPCID, 1, "Boss_OnCombat")
    RegisterUnitEvent(NPCID, 2, "Boss_OnLeaveCombat")
    RegisterUnitEvent(NPCID, 3, "Boss_OnDied")
    Sorry for my noobiness =/ I want to learn to script stuff eventually but thought I'd start out with just a basic guideline I had found. Any help is appreciated.
    Last edited by aseroth; 03-06-2010 at 03:36 PM.

    [Lua] Error in script
  2. #2
    Kiev's Avatar Contributor
    Reputation
    288
    Join Date
    Nov 2007
    Posts
    1,819
    Thanks G/R
    0/4
    Trade Feedback
    3 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Line 1 = The comment on who it is.

    Try and remove that line, and see what happens.




  3. #3
    aseroth's Avatar Member
    Reputation
    2
    Join Date
    Dec 2007
    Posts
    22
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Tried doing what you said, but still ended up with the same error.

    I've looked over the code and even tried making sure segment that needed to be spaced out was only spaced once (if that could affect it) but still had no luck. =/

  4. #4
    Kiev's Avatar Contributor
    Reputation
    288
    Join Date
    Nov 2007
    Posts
    1,819
    Thanks G/R
    0/4
    Trade Feedback
    3 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Take away all the comments, and just leave the bits that are visibly needed, and then see what it returns.




  5. #5
    aseroth's Avatar Member
    Reputation
    2
    Join Date
    Dec 2007
    Posts
    22
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    still giving me some trouble even though I removed all the unnecessary stuff in it

    HTML Code:
    local NPC_ID = 70070
    
    local Spell_1 = 47610 --For Boss_1
    local BuffSelf = 48932 --For Boss_2
    local Spell_2 = 59172 --For Boss_3
    
    local MessageBegin = "You humiliated me! You made me shut down everything! Now you will pay!"
    
    function Boss_OnCombat(pUnit, Event)
    Phase = math.random(1,3)
    if Phase == 1 then
    pUnit:SendChatMessage(12, 0, "You humiliated me! You made me shut down everything! Now you will pay!")
    pUnit:RemoveEvents();
    pUnit:RegisterEvent("Boss_1", math.random(1000, 30000), 0)
    end
    if Phase == 2 then
    pUnit:SendChatMessage(12, 0, "I am everything you ph33r!")
    pUnit:RemoveEvents();
    pUnit:RegisterEvent("Boss_2", math.random(1000, 30000), 0)
    end
    if Phase == 3 then
    pUnit:SendChatMessage(12, 0, "Death to the fanboys, death to the living!")
    pUnit:RemoveEvents();
    pUnit:RegisterEvent("Boss_3", math.random(1000, 30000), 0)
    end
    end
    
    function Boss_1(pUnit, Event)
    local plr = pUnit:GetMainTank()
    if (plr ~= nil) then
    pUnit:FullCastSpellOnTarget(Spell_1, plr) 
    pUnit:RemoveEvents();
    pUnit:RegisterEvent("Restart_Over", 1000, 0)
    end
    end
    
    function Boss_2(pUnit, Event) --Makes Boss Buffself
    pUnit:CastSpell(BuffSelf) 
    pUnit:RemoveEvents();
    pUnit:RegisterEvent("Restart_Over", 1000, 0)
    end
    
    function Boss_3(pUnit, Event)
    local plr = pUnit:GetMainTank()
    if (plr ~= nil) then
    pUnit:CastSpellOnTarget(Spell_2, plr)
    pUnit:RemoveEvents();
    pUnit:RegisterEvent("Restart_Over", 1000, 0)
    end
    end
    
    function Restart_Over(pUnit, Event)
    local Phase = math.random(1,3)
    if Phase == 1 then
    pUnit:RegisterEvent("Boss_1", math.random(1000, 45000), 0)
    end
    if Phase == 2 then
    pUnit:RegisterEvent("Boss_2", math.random(1000, 45000), 0)
    end
    if Phase == 3 then
    pUnit:RegisterEvent("Boss_3", math.random(1000, 45000), 0)
    end
    end
    
    
    local MessageEndCombat = "I won't beat around the bush, this was just a minor setback."
    local MessageOnDied = "I will have my....revenge...!"
    function Boss_OnLeaveCombat(pUnit, Event)
    pUnit:SendChatMessage(12, 0, MessageEndCombat)
    pUnit:RemoveEvents()
    end
    function Boss_OnDied(pUnit, Event)
    pUnit:SendChatMessage(12, 0, MessageOnDied)
    pUnit:RemoveEvents()
    end
    RegisterUnitEvent(70070, 1, "Boss_OnCombat")
    RegisterUnitEvent(70070, 2, "Boss_OnLeaveCombat")
    RegisterUnitEvent(70070, 3, "Boss_OnDied")
    end
    Here is the original script with nothing edited to it

    HTML Code:
    --Written by Maven (AKA Deathdude or Maven01)
    
    --[[  REMEMBER THIS FOR EDITING
    pUnit:GetRandomPlayer(0) =  Targets Random Player
    pUnit:GetRandomPlayer(1) = Targets Player in Shortrange
    pUnit:GetRandomPlayer( 2)  = Targets Player in Midrange
    pUnit:GetRandomPlayer(4) = Targets Player in Longrange
    pUnit:GetRandomPlayer(4) = Targets Player with Mana
    pUnit:GetRandomPlayer( 5) = Targets Player with Rage
    pUnit:GetRandomPlayer(6) = Targets Player with Energy
    pUnit:GetRandomPlayer(7) = Targets any player that is not Main Tank
    pUnit:GetMainTank = Targets Main Tank
    pUnit:GetAddTank = Targets Offtank
    ]]
    
    
    local NPCID = NPCIDHERE
    
    local Spell_1 = SpellIDHere --For Boss_1
    local BuffSelf = SpellIDHere --For Boss_2
    local Spell_2 = SpellIDHere --For Boss_3
    
    local MessageBegin = "Enter Text Here"
    
    function Boss_OnCombat(pUnit, Event)
    Phase = math.random(1,3)
    if Phase == 1 then
    pUnit:SendChatMessage(12, 0, MessageBegin)
    pUnit:RemoveEvents();
    pUnit:RegisterEvent("Boss_1", math.random(1000, 30000), 0)
    end
    if Phase == 2 then
    pUnit:SendChatMessage(12, 0, MessageBegin)
    pUnit:RemoveEvents();
    pUnit:RegisterEvent("Boss_2", math.random(1000, 30000), 0)
    end
    if Phase == 3 then
    pUnit:SendChatMessage(12, 0, MessageBegin)
    pUnit:RemoveEvents();
    pUnit:RegisterEvent("Boss_3", math.random(1000, 30000), 0)
    end
    end
    
    function Boss_1(pUnit, Event)
    local plr = pUnit:GetMainTank()
    if (plr ~= nil) then
    pUnit:FullCastSpellOnTarget(Spell_1, plr) 
    pUnit:RemoveEvents();
    pUnit:RegisterEvent("Restart_Over", 1000, 0)
    end
    end
    
    function Boss_2(pUnit, Event) --Makes Boss Buffself
    pUnit:CastSpell(BuffSelf) 
    pUnit:RemoveEvents();
    pUnit:RegisterEvent("Restart_Over", 1000, 0)
    end
    
    function Boss_3(pUnit, Event)
    local plr = pUnit:GetMainTank()
    if (plr ~= nil) then
    pUnit:CastSpellOnTarget(Spell_2, plr)
    pUnit:RemoveEvents();
    pUnit:RegisterEvent("Restart_Over", 1000, 0)
    end
    end
    
    function Restart_Over(pUnit, Event)
    local Phase = math.random(1,3)
    if Phase == 1 then
    pUnit:RegisterEvent("Boss_1", math.random(1000, 45000), 0)
    end
    if Phase == 2 then
    pUnit:RegisterEvent("Boss_2", math.random(1000, 45000), 0)
    end
    if Phase == 3 then
    pUnit:RegisterEvent("Boss_3", math.random(1000, 45000), 0)
    end
    end
    
    local MessageEndCombat = "Enter Text Here"
    local MessageOnDied = "Enter Text Here"
    function Boss_OnLeaveCombat(pUnit, Event)
    pUnit:SendChatMessage(12, 0, MessageEndCombat)
    pUnit:RemoveEvents()
    end
    function Boss_OnDied(pUnit, Event)
    pUnit:SendChatMessage(12, 0, MessageOnDied)
    pUnit:RemoveEvents()
    end
    RegisterUnitEvent(NPCID, 1, "Boss_OnCombat")
    RegisterUnitEvent(NPCID, 2, "Boss_OnLeaveCombat")
    RegisterUnitEvent(NPCID, 3, "Boss_OnDied")
    Not sure if that will help though.
    Last edited by aseroth; 03-06-2010 at 06:07 PM.

  6. #6
    Kiev's Avatar Contributor
    Reputation
    288
    Join Date
    Nov 2007
    Posts
    1,819
    Thanks G/R
    0/4
    Trade Feedback
    3 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can you please tell us if the error has changed at all?




  7. #7
    aseroth's Avatar Member
    Reputation
    2
    Join Date
    Dec 2007
    Posts
    22
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm afraid the error has not changed at all =/ I'm not sure what the problem could be in the code...

  8. #8
    Kiev's Avatar Contributor
    Reputation
    288
    Join Date
    Nov 2007
    Posts
    1,819
    Thanks G/R
    0/4
    Trade Feedback
    3 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So its still returning a error @ Line one? Have you rebooted the server?




  9. #9
    aseroth's Avatar Member
    Reputation
    2
    Join Date
    Dec 2007
    Posts
    22
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'll have to try doing that once I've gotten this new DB installed since I'm trying to get one that does not crash as often

  10. #10
    Kiev's Avatar Contributor
    Reputation
    288
    Join Date
    Nov 2007
    Posts
    1,819
    Thanks G/R
    0/4
    Trade Feedback
    3 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The database probably isn't the cause for the crash, but an unstable core, try and update it (Aslong as you compiled it yourself)




Similar Threads

  1. [Lua] Error in script
    By Emanuel095 in forum WoW EMU Questions & Requests
    Replies: 6
    Last Post: 03-07-2010, 07:26 AM
  2. LUA Error.
    By controlsx2 in forum World of Warcraft Emulator Servers
    Replies: 2
    Last Post: 05-07-2008, 04:31 PM
  3. [LUA] Mulgore Creatures Scripted
    By SectorSeven in forum World of Warcraft Emulator Servers
    Replies: 8
    Last Post: 04-11-2008, 01:00 AM
  4. [Lua] Error
    By ~ViVo~ in forum World of Warcraft Emulator Servers
    Replies: 3
    Last Post: 03-15-2008, 11:15 AM
  5. [Errorz] A Lua Error I Havent seen before
    By Snailz in forum World of Warcraft Emulator Servers
    Replies: 2
    Last Post: 02-14-2008, 10:12 AM
All times are GMT -5. The time now is 08:27 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search