Forum

> > CS2D > Scripts > Tibia NPC Error
Forums overviewCS2D overview Scripts overviewLog in to reply

English Tibia NPC Error

1 reply
To the start Previous 1 Next To the start

old Tibia NPC Error

sCy
User Off Offline

Quote
So, I got this error called:

Lua error: <eof> expected near "elseif"

Can I get it fixed please?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
NPCs[9].func = function(npc, id, words, state)
     if words == "hi" then
          NPCspeak(npc, "This cave has biggest challenge of all; the D.C")
          NPCspeak(npc, "Because the horror inside, you need to be at least level 75.")	
          NPCspeak(npc, "Only way out is to die or teleport. Recember that.")
          PLAYERS[id].tmp.npcstate = {npc, 1}
     elseif contains(words, "bye") then
          NPCspeak(npc, "Wise choice, young hero.")
          PLAYERS[id].tmp.npcstate = nil
     elseif state == 1 then
          if contains(words, "yes") then
               if PLAYERS[id].Level > 75 then
                         NPCspeak(npc, "Be warned, the shadows inside devour")
		NPCspeak(npc, "your health VERY fast. You MUST have ways of healing.")
		PLAYERS[id].tmp.npcstate = {npc, 2}
                    end
               else
                    NPCspeak(npc, "Your level isn't high enough!")
	PLAYERS[id].tmp.npcstate = nil
               end
          elseif state == 2 then
      	if contains(words, "yes", "ok", "ready") then
		parse("setpos " .. id .. " 3616 6080")
		NPCspeak(npc, "Good luck young hero. You will need it.")
		PLAYERS[id].tmp.npcstate = nil
		end
	     end
	end
	  elseif contains(words, "bye", "no", "unprepared") then
         	 NPCspeak(npc, "Wise choice, young hero.")
          	PLAYERS[id].tmp.npcstate = nil
        	  end
    	 end
	end

old Re: Tibia NPC Error

Jynxxx
User Off Offline

Quote
<eof> means end of line

Got it

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
NPCs[9].func = function(npc, id, words, state)
	if words == "hi" then
		NPCspeak(npc, "You need to be at least level 75 to enter this area.")
		PLAYERS[id].tmp.npcstate = {npc, 1}
	elseif contains(words, "bye") then
		NPCspeak(npc, "Goodbye.")
		PLAYERS[id].tmp.npcstate = nil
	elseif state == 1 then
		if contains(words, "yes") then
			if addmoney(id, -0) then
			if PLAYERS[id].Level > 75 then
				NPCspeak(npc, "Be warned, the 

shadows inside devour")
				NPCspeak(npc, "your health VERY 

fast. You MUST have ways of healing.")
				parse("setpos " .. id .. " 3616 

6080")
			else
		NPCspeak(npc, "Your level isn't high enough!")
				PLAYERS[id].tmp.npcstate = nil
			end
		end
		elseif contains(words, "no") then
			NPCspeak(npc, "alright then.")
			PLAYERS[id].tmp.npcstate = nil
		end
	end
end
edited 2×, last 09.12.11 02:30:38 am
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview