• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua <eof> ?

Triggah

TrigCore
Joined
Aug 1, 2007
Messages
436
Reaction score
2
[21/07/2009 13:41:12] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/quests/rings.lua)
[21/07/2009 13:41:12] data/actions/scripts/quests/rings.lua:13: '<eof>' expected near 'end'

what does <eof> mean?
 
It means that you forget to put an END.

Try adding another end to the script.

Maybe EOF is the end of the if, that is not found, and is not expected.
 
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
     if getPlayerStorageValue(cid, 9002) == -1 then
          setPlayerStorageValue(cid, 9002, 1)
		  local bp1 = doPlayerAddItem(cid, 1991, 1)
                doAddContainerItem(bp1, 2168, 2)
				doAddContainerItem(bp1, 2214, 2)
				doAddContainerItem(bp1, 2197, 2)
				doAddContainerItem(bp1, 2167, 2)			
        end					
          doPlayerSendTextMessage(cid, 24, "You found a bag of supplies.")
     end
     return TRUE
     end
end
 
;o

here it is fixed:

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
     if getPlayerStorageValue(cid, 9002) == -1 then
          setPlayerStorageValue(cid, 9002, 1)
		  local bp1 = doPlayerAddItem(cid, 1991, 1)
                doAddContainerItem(bp1, 2168, 2)
				doAddContainerItem(bp1, 2214, 2)
				doAddContainerItem(bp1, 2197, 2)
				doAddContainerItem(bp1, 2167, 2)			
        end					
          doPlayerSendTextMessage(cid, 24, "You found a bag of supplies.")
     end
     return TRUE
end

Just deleted one of the unussefull ends, that doesnt end anything.
 
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if getPlayerStorageValue(cid, 9002) == -1 then
        setPlayerStorageValue(cid, 9002, 1)
        local bp1 = doPlayerAddItem(cid, 1991, 1)
        doAddContainerItem(bp1, 2168, 2)
        doAddContainerItem(bp1, 2214, 2)
        doAddContainerItem(bp1, 2197, 2)
        doAddContainerItem(bp1, 2167, 2)            
        doPlayerSendTextMessage(cid, 24, "You found a bag of supplies.")
    end
    return TRUE
end
 
Yay i forgot i didnt pasted the right script xD!

Remember that always an IF ends with Ends.

As;

Code:
Function...

 If...

 Else...

 End..
 Return...

 End..

And you got 3 ends without "EOF".

;)

As nsanee posted
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerStorageValue(cid, 9002) == -1 then
setPlayerStorageValue(cid, 9002, 1)
local bp1 = doPlayerAddItem(cid, 1991, 1)
doAddContainerItem(bp1, 2168, 2)
doAddContainerItem(bp1, 2214, 2)
doAddContainerItem(bp1, 2197, 2)
doAddContainerItem(bp1, 2167, 2)

doPlayerSendTextMessage(cid, 24, "You found a bag of supplies.")
end
return TRUE

end
 
Never seen a more horrible tabbing but anyway:
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerStorageValue(cid, 9002) == -1 then
		setPlayerStorageValue(cid, 9002, 1)
		local bp1 = doPlayerAddItem(cid, 1991, 1)
		
		doAddContainerItem(bp1, 2168, 2)
		doAddContainerItem(bp1, 2214, 2)
		doAddContainerItem(bp1, 2197, 2)
		doAddContainerItem(bp1, 2167, 2)			
	end	
	 
	doPlayerSendTextMessage(cid, 24, "You found a bag of supplies.")
	return TRUE
end

Improved version:
Lua:
local items = {
	2168,
	2214,
	2197,
	2167
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if getPlayerStorageValue(cid, 9002) == -1 then
		setPlayerStorageValue(cid, 9002, 1)	
		local bp1 = doPlayerAddItem(cid, 1991, 1)

		for i = 0, #items do
			doAddContainerItem(bp1, items[i], 2)
		end
		
	end  							
    doPlayerSendTextMessage(cid, 24, "You found a bag of supplies.")
    return TRUE
end

Edit: Damn nsanee was faster :( Didn't see you posted cause I was typing xD
 
i can use the chest as many times as i want and get "you found a bag of supplies" but only get bag once, how would i put 'else' "this chest is empty"

tried and got errors
 
Lua:
  function onUse(cid, item, fromPosition, itemEx, toPosition)
        if getPlayerStorageValue(cid, 9002) == -1 then --If storage is right...
                setPlayerStorageValue(cid, 9002, 1) -- This will do
                local bp1 = doPlayerAddItem(cid, 1991, 1)
               
                doAddContainerItem(bp1, 2168, 2)
                doAddContainerItem(bp1, 2214, 2)
                doAddContainerItem(bp1, 2197, 2)
                doAddContainerItem(bp1, 2167, 2)  
        doPlayerSendTextMessage(cid, 24, "You found a bag of supplies.") 
        else -- If storage is used...
        doPlayerSendtextMessage(cid, 22, "You already received a bag of supplies.")                    
        end    
         
        return TRUE
end

Also remember the architecture;

Lua:
Function... --Start function

 If... --Start condition

  Else... --If condition is false or 0 or nil respecting the code...
  --Condition when condition If is false or wrong
 End... --This close the IF

 Return... --Return to the main

End... --Closes the funcion
 
Lua:
  function onUse(cid, item, fromPosition, itemEx, toPosition)
        if getPlayerStorageValue(cid, 9002) == -1 then --If storage is right...
                setPlayerStorageValue(cid, 9002, 1) -- This will do
                local bp1 = doPlayerAddItem(cid, 1991, 1)
               
                doAddContainerItem(bp1, 2168, 2)
                doAddContainerItem(bp1, 2214, 2)
                doAddContainerItem(bp1, 2197, 2)
                doAddContainerItem(bp1, 2167, 2)  
        doPlayerSendTextMessage(cid, 24, "You found a bag of supplies.") 
        else -- If storage is used...
        doPlayerSendtextMessage(cid, 22, "You already received a bag of supplies.")                    
        end    
         
        return TRUE
end

fixed it, working now
 
Hmm it worked for me and looks fine;

Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
        if getPlayerStorageValue(cid, 9002) == -1 then --If storage is right...
                setPlayerStorageValue(cid, 9002, 1) -- This will do
                local bp1 = doPlayerAddItem(cid, 1991, 1)
               
                doAddContainerItem(bp1, 2168, 2)
                doAddContainerItem(bp1, 2214, 2)
                doAddContainerItem(bp1, 2197, 2)
                doAddContainerItem(bp1, 2167, 2)  
        doPlayerSendTextMessage(cid, 24, "You found a bag of supplies.")
        else -- If storage is used...
        doPlayerSendtextMessage(cid, 22, "You already received a bag of supplies.")                    
        end    
         
        return TRUE
end

[21/07/2009 15:12:31] Reloaded actions.
[21/07/2009 15:12:47] Reloaded actions.

And the update of an screenshot i made for see it worked;

 
Last edited:
just tested it and it doesnt say you already recieved...
just opens the chest

Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
     if getPlayerStorageValue(cid, 9002) == -1 then
          setPlayerStorageValue(cid, 9002, 1)
          local bp1 = doPlayerAddItem(cid, 1991, 1)
                doAddContainerItem(bp1, 2168, 1)
                doAddContainerItem(bp1, 2214, 1)
                doAddContainerItem(bp1, 2197, 1)
                doAddContainerItem(bp1, 2167, 1) 
                doAddContainerItem(bp1, 2168, 1)
                doAddContainerItem(bp1, 2214, 1)
                doAddContainerItem(bp1, 2197, 1)
                doAddContainerItem(bp1, 2167, 1) 				                             
		doPlayerSendTextMessage(cid, 24, "You found a bag of supplies.") 
    else -- If storage is used...
        doPlayerSendtextMessage(cid, 22, "You already received a bag of supplies.")                    
        end    
         
        return TRUE
end


[21/07/2009 14:14:55] Lua Script Error: [Action Interface]
[21/07/2009 14:14:55] data/actions/scripts/quests/rings.lua:eek:nUse

[21/07/2009 14:14:55] data/actions/scripts/quests/rings.lua:12: attempt to call global 'doPlayerSendtextMessage' (a nil value)
[21/07/2009 14:14:55] stack traceback:
[21/07/2009 14:14:55] data/actions/scripts/quests/rings.lua:12: in function <data/actions/scripts/quests/rings.lua:1>
 
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerStorageValue(cid, 9002) == -1 then
		setPlayerStorageValue(cid, 9002, 1)
		local bp1 = doPlayerAddItem(cid, 1991, 1)

		doAddContainerItem(bp1, 2168, 2)
		doAddContainerItem(bp1, 2214, 2)
		doAddContainerItem(bp1, 2197, 2)
		doAddContainerItem(bp1, 2167, 2) 
		doPlayerSendTextMessage(cid, 24, "You found a bag of supplies.")
	else
		doPlayerSendCancel(cid, 'This chest is empty.')
	end	
    return TRUE
end

And it's doPlayerSendTextMessage not doPlayerSendtextMessage
 
You can also use this version, it's more advanced and more organized:
Lua:
local items = {
        2168,
        2214,
        2197,
        2167,
	2168,
	2214,
	2197,
	2167
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if getPlayerStorageValue(cid, 9002) == -1 then
		setPlayerStorageValue(cid, 9002, 1)    
		local bp1 = doPlayerAddItem(cid, 1991, 1)

		for i = 0, #items do
			doAddContainerItem(bp1, items[i], 2)
		end
		doPlayerSendTextMessage(cid, 24, "You found a bag of supplies.")
    else
		doPlayerSendCancel(cid, 'This chest is empty.')
    end

    return TRUE
end

I also added the new items you added in the newer version you posted.
 
HAHAHHA!

It doesnt matter if is a "T or a t" is the same character.

And it worked with the code i say;


Then explain me why my own version worked with a capital T whilst yours didn't? Also the picture you posted doesn't prove that the script you posted works, it's just the message you get when you receive the reward and the function is written with a capital T.

T and t is not the same character technically, they have different ASCII code.
 
Hmm i really dont know.

But this is the code i used to;
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
        if getPlayerStorageValue(cid, 9002) == -1 then --If storage is right...
                setPlayerStorageValue(cid, 9002, 1) -- This will do
                local bp1 = doPlayerAddItem(cid, 1991, 1)
               
                doAddContainerItem(bp1, 2168, 2)
                doAddContainerItem(bp1, 2214, 2)
                doAddContainerItem(bp1, 2197, 2)
                doAddContainerItem(bp1, 2167, 2)  
        doPlayerSendTextMessage(cid, 24, "You found a bag of supplies.")
        else -- If storage is used...
        doPlayerSendtextMessage(cid, 22, "You already received a bag of supplies.")                    
        end    
         
        return TRUE
end

And is working nice and nice, on the if to the end of the script. And liked it, maybe he is using an old version or dont know. But it worked with me ;S

I saw that the error he got was cuz the character he put was:

" ' " and not ".

'/".

See it by yours xD
 
Back
Top