• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Script Problem.. Quest Box

Teddy

SweStream.se
Joined
Oct 2, 2008
Messages
3,797
Reaction score
10
Location
Sweden 172
All my quest i have from 0.3.6 are look like this
LUA:
function onUse(cid, item, frompos, item2, topos)

	if item.uid == 51001 then
		if getPlayerStorageValue(cid,51001) == -1 then
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"You have found a Chain Armor.")
			doPlayerAddItem(cid,2464,1)
			setPlayerStorageValue(cid,51001,1)
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"The is empty.")
		end

	elseif item.uid == 51002 then
		if getPlayerStorageValue(cid,51002) == -1 then
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"You have found 2 Crystal Coin.")
			doPlayerAddItem(cid,2160,2)
			setPlayerStorageValue(cid,51002,1)
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"The is empty.")
		end
		
			elseif item.uid == 51003 then
		if getPlayerStorageValue(cid,51003) == -1 then
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"You have found a Rope.")
			doPlayerAddItem(cid,2120,1)
			setPlayerStorageValue(cid,51003,1)
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"The is empty.")
		end
		
			elseif item.uid == 51004 then
		if getPlayerStorageValue(cid,51004) == -1 then
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"You have found a Shovel.")
			doPlayerAddItem(cid, MESSAGE_INFO_DESCR54,1)
			setPlayerStorageValue(cid,51004,1)
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"The is empty.")
		end
		
			elseif item.uid == 51005 then
		if getPlayerStorageValue(cid,51005) == -1 then
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"You have found a Backpack.")
			doPlayerAddItem(cid,1988,1)
			setPlayerStorageValue(cid,51005,1)
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"The is empty.")
		end
					elseif item.uid == 51006 then
		if getPlayerStorageValue(cid,51006) == -1 then
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"You have found a Mage Hat.")
			doPlayerAddItem(cid,8820,1)
			setPlayerStorageValue(cid,51006,1)
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"The is empty.")
		end
					elseif item.uid == 51007 then
		if getPlayerStorageValue(cid,51007) == -1 then
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"You have found a Mage Armor.")
			doPlayerAddItem(cid,8819,1)
			setPlayerStorageValue(cid,51007,1)
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"The is empty.")
		end
		
							elseif item.uid == 51008 then
		if getPlayerStorageValue(cid,51008) == -1 then
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"You have found a Boots.")
			doPlayerAddItem(cid,2643,1)
			setPlayerStorageValue(cid,51008,1)
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"The is empty.")
		end
		
						elseif item.uid == 51009 then
		if getPlayerStorageValue(cid,51009) == -1 then
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"You have found a Spellbook.")
			doPlayerAddItem(cid,2175,1)
			setPlayerStorageValue(cid,51009,1)
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"The is empty.")
		end
		
						elseif item.uid == 51010 then
		if getPlayerStorageValue(cid,51010) == -1 then
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"You have found a Spike Sword.")
			doPlayerAddItem(cid,2383,1)
			setPlayerStorageValue(cid,51010,1)
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"The is empty.")
		end
		
								elseif item.uid == 51011 then
		if getPlayerStorageValue(cid,51011) == -1 then
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"You have found a Dwarven Shield.")
			doPlayerAddItem(cid, MESSAGE_INFO_DESCR MESSAGE_INFO_DESCR,1)
			setPlayerStorageValue(cid,51011,1)
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"The is empty.")
		end
										elseif item.uid == 51012 then
		if getPlayerStorageValue(cid,51012) == -1 then
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"You have found a Rod.")
			doPlayerAddItem(cid,2182,1)
			setPlayerStorageValue(cid,51012,1)
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"The is empty.")
		end
										elseif item.uid == 51013 then
		if getPlayerStorageValue(cid,51013) == -1 then
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"You have found a Wand.")
			doPlayerAddItem(cid,2190,1)
			setPlayerStorageValue(cid,51013,1)
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"The is empty.")
		end
												elseif item.uid == 51014 then
		if getPlayerStorageValue(cid,51014) == -1 then
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"You have found a Spear.")
			doPlayerAddItem(cid,2389,1)
			setPlayerStorageValue(cid,51014,1)
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"The is empty.")
		end
		elseif item.uid == 51015 then
				if getPlayerStorageValue(cid,51015) == -1 then
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"You have found a Aol.")
			doPlayerAddItem(cid,2173,1)
			setPlayerStorageValue(cid,51015,1)
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"The is empty.")
		end
		elseif item.uid == 51016 then
			if getPlayerStorageValue(cid,51016) == -1 then
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"You have found a Chain Legs.")
			doPlayerAddItem(cid,2468,1)
			setPlayerStorageValue(cid,51016,1)
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"The is empty.")
		end
				elseif item.uid == 51017 then
			if getPlayerStorageValue(cid,51017) == -1 then
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"You have found a Health Potion.")
			doPlayerAddItem(cid,7618,1)
			setPlayerStorageValue(cid,51017,1)
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"The is empty.")
		end
						elseif item.uid == 51018 then
			if getPlayerStorageValue(cid,51018) == -1 then
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"You have found a Leather Helmet.")
			doPlayerAddItem(cid,2461,1)
			setPlayerStorageValue(cid,51018,1)
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"The is empty.")
		end
								elseif item.uid == 51019 then
			if getPlayerStorageValue(cid,51019) == -1 then
			doPlayerSendTextMessage(cid,19,"You have found a First Mount.")
			doPlayerAddItem(cid,11246,1)
			setPlayerStorageValue(cid,51019,1)
		else
			doPlayerSendTextMessage(cid,TALKTYPE_ORANGE_1,"The is empty.")
		end
	
	
	end
	return TRUE
end
But they dont work anymore in last rev drom 0.4 ? .. how can i do so its work for 0.4... its very much quests so i cant edit ;/
 
Last edited:
That's the problem, I don't have the 0.4 functions, so I can't help you.
Just open 'doc/LUA_FUNCTIONS' in notepad++ and search for 'storage', then post any function you came across.
 
exhaustion.check(cid, storage)
exhaustion.get(cid, storage)
exhaustion.set(cid, storage, time)
exhaustion.make(cid, storage, time)

.. its the only storage functions that came up S:
 
Old functions are in compat of 0.4 Error's due:
LUA:
doPlayerAddItem(cid, MESSAGE_INFO_DESCR54,1)

and:

LUA:
doPlayerAddItem(cid, MESSAGE_INFO_DESCR MESSAGE_INFO_DESCR,1)


Take this from uncle quas:

LUA:
local defaultMsg = MESSAGE_INFO_DESCR;
local defaultEmptyText = "It's empty.";

local questItems = {
	[51001] = {item = 2461, count = 1, text = "You have found a Chain Armor.", msg_type = defaultMsg, emptyText = defaultEmptyText, emptyType = defaultMsg},
	[51002] = {item = 2160, count = 2, text = "You have found 2 Crystal Coin.", msg_type = defaultMsg, emptyText = defaultEmptyText, emptyType = defaultMsg},
	[51003] = {item = 2120, count = 1, text = "You have found a Rope.", msg_type = defaultMsg, emptyText = defaultEmptyText, emptyType = defaultMsg},
	[51004] = {item = "Put here id of shovel instead of this msg.", count = 1, text = "You have found a Shovel.", msg_type = defaultMsg, emptyText = defaultEmptyText, emptyType = defaultMsg},
	[51005] = {item = 1988, count = 1, text = "You have found a Backpack.", msg_type = defaultMsg, emptyText = defaultEmptyText, emptyType = defaultMsg},
	[51006] = {item = 8820, count = 1, text = "You have found a Mage Hat.", msg_type = defaultMsg, emptyText = defaultEmptyText, emptyType = defaultMsg},
	[51007] = {item = 8819, count = 1, text = "You have found a Mage Armor.", msg_type = defaultMsg, emptyText = defaultEmptyText, emptyType = defaultMsg},
	[51008] = {item = 2643, count = 1, text = "You have found a Boots.", msg_type = defaultMsg, emptyText = defaultEmptyText, emptyType = defaultMsg},
	[51009] = {item = 2175, count = 1, text = "You have found a Spellbook.", msg_type = defaultMsg, emptyText = defaultEmptyText, emptyType = defaultMsg},
	[51010] = {item = 2383, count = 1, text = "You have found a Spike Sword.", msg_type = defaultMsg, emptyText = defaultEmptyText, emptyType = defaultMsg},
	[51011] = {item = "Put here id of Dwarven shield instead of this msg.", count = 1, text = "You have found a Dwarven Shield.", msg_type = defaultMsg, emptyText = defaultEmptyText, emptyType = defaultMsg},
	[51012] = {item = 2182, count = 1, text = "You have found a Rod.", msg_type = defaultMsg, emptyText = defaultEmptyText, emptyType = defaultMsg},
	[51013] = {item = 2190, count = 1, text = "You have found a Wand.", msg_type = defaultMsg, emptyText = defaultEmptyText, emptyType = defaultMsg},
	[51014] = {item = 2389, count = 1, text = "You have found a Spear.", msg_type = defaultMsg, emptyText = defaultEmptyText, emptyType = defaultMsg},
	[51015] = {item = 2173, count = 1, text = "You have found a Aol.", msg_type = defaultMsg, emptyText = defaultEmptyText, emptyType = defaultMsg},
	[51016] = {item = 2468, count = 1, text = "You have found a Chain Legs.", msg_type = defaultMsg, emptyText = defaultEmptyText, emptyType = defaultMsg},
	[51017] = {item = 7618, count = 1, text = "You have found a Health Potion.", msg_type = defaultMsg, emptyText = defaultEmptyText, emptyType = defaultMsg},
	[51018] = {item = "Put here id of Leather Helmet instead of this msg.", count = 1, text = "You have found a Leather Helmet.", msg_type = defaultMsg, emptyText = defaultEmptyText, emptyType = defaultMsg},
	[51019] = {item = 11246, count = 1, text = "You have found a First Mount.", msg_type = defaultMsg, emptyText = defaultEmptyText, emptyType = defaultMsg}
}
function onUse(cid, item, frompos, item2, topos)
	if(not questItems[item.uid])then
		return;
	end
	questItem = questItems[item.uid];
	if(type(questItem.item)=="string")then
		print("Error while using a quest system script. UID = ".. item.uid .. ". Error msg: ".. questItem.item);
		return;
	end
	if(getCreatureStorage(cid,item.uid) > 0)then
		doPlayerSendTextMessage(cid, questItem.emptyType, questItem.defaultEmptyText)
	else
		doPlayerSendTextMessage(cid, questItem.msg_type, questItem.text)
		doPlayerAddItem(cid, questItem.item, questItem.count);
		doCreatureSetStorage(cid, item.uid, 1);
	end
	return TRUE
end
 
Last edited:
Old functions are in compat of 0.4 Error's due:
LUA:
doPlayerAddItem(cid, MESSAGE_INFO_DESCR54,1)

and:

LUA:
doPlayerAddItem(cid, MESSAGE_INFO_DESCR MESSAGE_INFO_DESCR,1)


Take this from uncle quas:

LUA:
local defaultMsg = MESSAGE_INFO_DESCR;
local defaultEmptyText = "It's empty.";

local questItems = {
	[51001] = {item = 2461, count = 1, text = "You have found a Chain Armor.", msg_type = defaultMsg, emptyText = defaultEmptyText, emptyType = defaultMsg},
	[51002] = {item = 2160, count = 2, text = "You have found 2 Crystal Coin.", msg_type = defaultMsg, emptyText = defaultEmptyText, emptyType = defaultMsg},
	[51003] = {item = 2120, count = 1, text = "You have found a Rope.", msg_type = defaultMsg, emptyText = defaultEmptyText, emptyType = defaultMsg},
	[51004] = {item = "Put here id of shovel instead of this msg.", count = 1, text = "You have found a Shovel.", msg_type = defaultMsg, emptyText = defaultEmptyText, emptyType = defaultMsg},
	[51005] = {item = 1988, count = 1, text = "You have found a Backpack.", msg_type = defaultMsg, emptyText = defaultEmptyText, emptyType = defaultMsg},
	[51006] = {item = 8820, count = 1, text = "You have found a Mage Hat.", msg_type = defaultMsg, emptyText = defaultEmptyText, emptyType = defaultMsg},
	[51007] = {item = 8819, count = 1, text = "You have found a Mage Armor.", msg_type = defaultMsg, emptyText = defaultEmptyText, emptyType = defaultMsg},
	[51008] = {item = 2643, count = 1, text = "You have found a Boots.", msg_type = defaultMsg, emptyText = defaultEmptyText, emptyType = defaultMsg},
	[51009] = {item = 2175, count = 1, text = "You have found a Spellbook.", msg_type = defaultMsg, emptyText = defaultEmptyText, emptyType = defaultMsg},
	[51010] = {item = 2383, count = 1, text = "You have found a Spike Sword.", msg_type = defaultMsg, emptyText = defaultEmptyText, emptyType = defaultMsg},
	[51011] = {item = "Put here id of Dwarven shield instead of this msg.", count = 1, text = "You have found a Dwarven Shield.", msg_type = defaultMsg, emptyText = defaultEmptyText, emptyType = defaultMsg},
	[51012] = {item = 2182, count = 1, text = "You have found a Rod.", msg_type = defaultMsg, emptyText = defaultEmptyText, emptyType = defaultMsg},
	[51013] = {item = 2190, count = 1, text = "You have found a Wand.", msg_type = defaultMsg, emptyText = defaultEmptyText, emptyType = defaultMsg},
	[51014] = {item = 2389, count = 1, text = "You have found a Spear.", msg_type = defaultMsg, emptyText = defaultEmptyText, emptyType = defaultMsg},
	[51015] = {item = 2173, count = 1, text = "You have found a Aol.", msg_type = defaultMsg, emptyText = defaultEmptyText, emptyType = defaultMsg},
	[51016] = {item = 2468, count = 1, text = "You have found a Chain Legs.", msg_type = defaultMsg, emptyText = defaultEmptyText, emptyType = defaultMsg},
	[51017] = {item = 7618, count = 1, text = "You have found a Health Potion.", msg_type = defaultMsg, emptyText = defaultEmptyText, emptyType = defaultMsg},
	[51018] = {item = "Put here id of Leather Helmet instead of this msg.", count = 1, text = "You have found a Leather Helmet.", msg_type = defaultMsg, emptyText = defaultEmptyText, emptyType = defaultMsg},
	[51019] = {item = 11246, count = 1, text = "You have found a First Mount.", msg_type = defaultMsg, emptyText = defaultEmptyText, emptyType = defaultMsg}
}
function onUse(cid, item, frompos, item2, topos)
	if(not questItems[item.uid])then
		return;
	end
	questItem = questItems[item.uid];
	if(type(questItem.item)=="string")then
		print("Error while using a quest system script. UID = ".. item.uid .. ". Error msg: ".. questItem.item);
		return;
	end
	if(getCreatureStorage(cid,item.uid) > 0)then
		doPlayerSendTextMessage(cid, questItem.emptyType, questItem.defaultEmptyText)
	else
		doPlayerSendTextMessage(cid, questItem.msg_type, questItem.text)
		doPlayerAddItem(cid, questItem.item, questItem.count);
		doCreatureSetStorage(cid, item.uid, 1);
	end
	return TRUE
end

a little reminder though, It's not C++ so it doesn't require a ; everywhere

questItem.item? I'm aware item is an attribute but questItem?..
 
@up
Firstly.
a little reminder though, It's not C++ so it doesn't require a ; everywhere.
Semicolon doesn't change anything in code, but it's a habit and helps me a bit to see a things. If most of known programming/scripting language requies semicolons i am gonna use it in lua either.

Secondly.
questItem.item? I'm aware item is an attribute but questItem?..
Read code.
 
@up Since only programming/scripting language is known for you is LUA, and u don't have any ambitions learn something better than this fucking high level "programming" lang where variables doesn't has even a type. it;s your choice.

If you're lookin' for something ugly then first look into the mirror /b/ro. Semicolons are good.

And nobody has forgotten a letter. He was pointing to that line Evil Mark has missed.
 
@up Since only programming/scripting language is known for you is LUA, and u don't have any ambitions learn something better than this fucking high level "programming" lang where variables doesn't has even a type. it;s your choice.

If you're lookin' for something ugly then first look into the mirror /b/ro. Semicolons are good.

And nobody has forgotten a letter. He was pointing to that line Evil Mark has missed.

Lol dude, I can read C++ from trying to learn it and also had my scripting period with using the ';' at the end but somehow I find it more cleaner without it, everyone has his own style though.
And why the hate with the 'If you're lookin' for something ugly then first look into the mirror /b/ro'? I didn't even insult you for a bit...
And I was trying to be friendly... <_<

And you did miss a letter and a bracket if you want me to show it to you so badly.

You:
LUA:
if(type(questItem.item)=="string")then

Should be:
LUA:
if(type(questItems.item)=="string"))then
 
Great job by finding missing bracket. Nobel prize for u.

"I CAN READ C++". That made my day. Thanks xD

Edit.
Lol dude, I can read C++ from trying to learn it and also had my scripting period with using the ';' at the end but somehow I find it more cleaner without it, everyone has his own style though.
And why the hate with the 'If you're lookin' for something ugly then first look into the mirror /b/ro'? I didn't even insult you for a bit...
And I was trying to be friendly... <_<

And you did miss a letter and a bracket if you want me to show it to you so badly.

You:
LUA:
if(type(questItem.item)=="string")then

Should be:
LUA:
if(type(questItems.item)=="string"))then

Actually There's no missing bracket. Sry, no nobel prize for ya. Anyway it was close.
 
Great job by finding missing bracket. Nobel prize for u.

"I CAN READ C++". That made my day. Thanks xD

Edit.


Actually There's no missing bracket. Sry, no nobel prize for ya. Anyway it was close.

What? I don't know what funny about being able to read C++ a bit and not being able to write it, It's fucking annoying, not funny..
And sorry trying to defend you, I'll never do it again, I'll just go on and dissing you, and there is a missing bracket unless you don't have the ability to do simple math (2x using '(' equals 2x using ')') but w/e, what about the missing letter? didn't hear you about that ;). (You started).

Sorry for being friendly again :( Polish people aren't used to it ofcourse, didn't think about that!
 
What? I don't know what funny about being able to read C++ a bit and not being able to write it, It's fucking annoying, not funny..
And sorry trying to defend you, I'll never do it again, I'll just go on and dissing you, and there is a missing bracket unless you don't have the ability to do simple math (2x using '(' equals 2x using ')') but w/e, what about the missing letter? didn't hear you about that ;). (You started).

Sorry for being friendly again :( Polish people aren't used to it ofcourse, didn't think about that!

If u can read code and u can't write code, it's like reading egyptian book without knowing arabic language. Everybody can do that. But only the one understands thing [c++ code here = can write that], can read that book ;)

You:
if(type(questItem.item)=="string")then

Should be:
if(type(questItems.item)=="string"))then

Seems you're the one without [as u said] "ability to simple math".

There is not any missing letter bro.
 
If u can read code and u can't write code, it's like reading egyptian book without knowing arabic language. Everybody can do that. But only the one understands thing [c++ code here = can write that], can read that book ;)



Seems you're the one without [as u said] "ability to simple math".

There is not any missing letter bro.

Oh wait there's not a bracket missing, my bad, but there still is the letter missing.

You

Code:
if(type([B][COLOR="red"]questItem[/COLOR][/B].item)=="string")then

Should be


Code:
if(type([B][COLOR="green"]questItems[/COLOR][/B].item)=="string")then

And you can compare my C++ writing skill to the ability to write English for a Brazilian, really bad, however a Brazilian can read English and I can read C++ partialy, get it now?
 
Back
Top