• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Action Message from the Item

ZionOt

New Member
Joined
Aug 8, 2010
Messages
178
Reaction score
1
Well i just started scripting, This is my first script i made. Thanks to Evil Hero's Scripting Guild, i understood it pretty well.

As he said, "Now you know the Basics of Scripting. Now you should be able to build a proper structure and explain what it does." Enjoy!

This script is to make it so when you use whatever the item is, it will say some sort of message. Yes, this can be modified to any item :), as long as its not used already... then you will have to play around with it :p. Anyways back to the script!

Tested with TFS 8.60

First what you need to do is open up your data/actions/actions.xml

Make a new line and add this:
Code:
<action itemid="XXX" event="script" value="XXX.lua"/>

Now that you have that added, make sure you have the item you want to use, and the ID of that item. Add the ID were the first 3 "XXX" are. Keep this file open but save it. Now we will make the script!

Open your actions/actions, and copy one of the files already made and rename it. Once you have renamed it, go back to your actions.xml and replace the last three "XXX" with the name that you named your script.

Now Open your script and copy this:
Code:
  --[[
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        Message from the Item by ZionOt
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
]]--

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == XXX then --Id of the item
	doPlayerSendTextMessage(cid, 21, "XXX") --Items Message
	end
	return TRUE 
end

Now, with the first "XXX" put the item ID there. Then Insert whatever you want the item to say when you use it. Save it.
MAKE SURE THIS ITEM DOES NOT ALREADY HAVE A ACTION TEXT WHEN USE OR YOU WILL DEBUG!

Thats it your done! Now you should Reload or Restart your OT and use the item. It should work :), If you need any help i will try my best to help you solve the problem. :)
 
Last edited:
Well i just started scripting, This is my first script i made. Thanks to Evil Hero's Scripting Guild, i understood it pretty well.

As he said, "Now you know the Basics of Scripting. Now you should be able to build a proper structure and explain what it does." Enjoy!

This script is to make it so when you use whatever the item is, it will say some sort of message. Yes, this can be modified to any item :), as long as its not used already... then you will have to play around with it :p. Anyways back to the script!

Tested with TFS 8.60

First what you need to do is open up your data/actions/actions.xml

Make a new line and add this:
Code:
<action itemid="XXX" event="script" value="XXX.lua"/>

Now that you have that added, make sure you have the item you want to use, and the ID of that item. Add the ID were the first 3 "XXX" are. Keep this file open but save it. Now we will make the script!

Open your actions/actions, and copy one of the files already made and rename it. Once you have renamed it, go back to your actions.xml and replace the last three "XXX" with the name that you named your script.

Now Open your script and copy this:
Code:
  --[[
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        Message from the Item by ZionOt
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
]]--

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == XXX then --Id of the item
	[COLOR="red"]doPlayerSendTextMessage(cid,21, "XXX")[/COLOR] --Items Message
	end
	return TRUE 
end

Now, with the first "XXX" put the item ID there. Then Insert whatever you want the item to say when you use it. Save it.
MAKE SURE THIS ITEM DOES NOT ALREADY HAVE A ACTION TEXT WHEN USE OR YOU WILL DEBUG!

Thats it your done! Now you should Reload or Restart your OT and use the item. It should work :), If you need any help i will try my best to help you solve the problem. :)

Only problem I can find with this script is the red marked line.

Should be:

from:
doPlayerSendTextMessage(cid,21, "XXX")
to:
doPlayerSendTextMessage(cid, 21, "XXX")

You forgot a space after ,
Other than that Good job! ;)
 
Only problem I can find with this script is the red marked line.

Should be:

from:
doPlayerSendTextMessage(cid,21, "XXX")
to:
doPlayerSendTextMessage(cid, 21, "XXX")

You forgot a space after .

Other than that Good job! ;)
It doesnt matter.
 
Fixed it :)

Thanks guys, i would love to learn more, are there any tutorials about more? Cause i really want to learn more! I would love to learn advanced stuff as well.
 
Last edited:
For this case, this is not necessary...
--[[
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Message from the Item by ZionOt
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
]]--

function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.itemid == XXX then --Id of the item
doPlayerSendTextMessage(cid, 21, "XXX") --Items Message
end
return TRUE
end
 
For this case, this is not necessary...

What are you on about?

He made the script intending it to be executed while using a certain item, then it needs to be there. Just to check if its that item
 
True, but if the script is only for 1 ITEM why does he need to redeclare it? Since it's declared at the .xml line

Code:
<action [COLOR=red][B]itemid="XXX"[/B][/COLOR] event="script" value="XXX.lua"/>
Where is the need to do it twice??
 
True, but if the script is only for 1 ITEM why does he need to redeclare it? Since it's declared at the .xml line

Code:
<action [COLOR=red][B]itemid="XXX"[/B][/COLOR] event="script" value="XXX.lua"/>
Where is the need to do it twice??

True.. I just checked the script though.. not the xml
 
What has happened to Otland. Its all retarted Trash scripts being made, No good releases anymore because this community is Garbage. holy.... lol
 
Wow, This is my first script...Thanks for the flame/spam. Gtfo. kthxbye.
 
ITT: oldfags complaining about OtLand turning into shit.
 
I think it's nice that new scripters also can share something, who knows one day this guy is a great scripter. and a very very beautiful day I maybe learn to spell...

Otland turning to shit... in like 10 years. Maybe...
 
Thanks for the support guys,
Can anyone direct me to a good tutorial on how do "Level Up" in my scripting? :p
 
Thanks for the support guys,
Can anyone direct me to a good tutorial on how do "Level Up" in my scripting? :p

Well best way to learn is to observe / try...
Try make your own scripts, look at lua section, see how they are built, try understand what is doing what and mix... xD
 
Thanks barker, i will go do that now, but i don't understand what i would look for, for the things that i would like to make.
 
Thanks barker, i will go do that now, but i don't understand what i would look for, for the things that i would like to make.

what do you want to makexD, if you want to make a quest chest, I suggest you look at a quest chest script? XD
 
Back
Top