• 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.

TalkAction Posting tweets on twitter in game

Mock

Mock the bear (MTB)
Joined
Jul 29, 2008
Messages
619
Reaction score
109
Location
Brazil

Authr: Mock
bearpaw.png

Tested on: TFS 0.3.6 (Win XP i think it work on vista)
Require: Lua modules (http://otland.net/f163/lua-modules-otserv-socket-luasql-74836/) and lua curl (Attached)

When i tested this script at the first time i came to the edge of orgasm :o

So you can enter on your GM and say:
!tweet UPDATE TOMOROW
and will apear on your twitter it
grin.gif


Well first you need instal lua modules.
next you download all attacked DLL files and put it on you server folder (the same folder of config.lua and .exe not data folder)
Now add it on modules.xml
Code:
<module name="curl"/>
NOW open your server (or reload) if it got an erro sorry guy =x
try find a way here LuaForge: LuaCURL: Project Filelist

if it works lets do it!
Add this tag on talkactions.xml:
Code:
<talkaction log="yes" words="!tweet" access="4" event="script" value="tweet.lua"/>
Now create tweet.lua and add it:
LUA:
--[[
Script to post on twitter by Mock the bear (MTB)
Using luaCurl
]]
tweet = {
c= curl.easy_init(),
check='http://www.twitter.com/statuses/update.xml',
user='username', -- here you put your username
password='yourpass', -- here you put password
}

function onSay(cid, words, param, channel)
	if not tweet.c then
		return doPlayerSendTextMessage(cid,25,'Could not create cURL state.')
	else
		tweet.c:setopt(curl.OPT_URL, tweet.check)
		tweet.c:setopt(curl.OPT_CONNECTTIMEOUT, 10)
		tweet.c:setopt(curl.OPT_POSTFIELDS, "status="..param);
		tweet.c:setopt(curl.OPT_POST, 1)
		tweet.c:setopt(curl.OPT_USERPWD, tweet.user..":"..tweet.password);
		if tweet.c:perform() then
			doPlayerSendTextMessage(cid,25,'Tweet sent! (I think)')
			doSendMagicEffect(getCreaturePosition(cid),30)
		else
			doPlayerSendTextMessage(cid,25,'Error on send tweet.')
			doSendMagicEffect(getCreaturePosition(cid),2)
		end
	end
return TRUE
end

reload and test
wink.gif


if it work enjoy!
if dont work try post here all erros and we try fix it ^^

If you want see my tests folow-me on twitter:
mockotnet
 

Attachments

Last edited:
Thx :P
if you want use on linux you need download the lib source and compile it on linux
 
i tested it and it works amazingly perfect, here is a link to my twitter to prove it proof of his awesome work
this type of script opens possibilities to even making an ingame IM to outside the game. I'll probably try to add the pics to prove it furthermore :D I used TFS 0.3.5 for this.

@Grehy
This is not useless you just don't see the value in the script, this opens for many other custom script that can be done for OTServers.
P.S. I know you didn't say useless but what's not useful is called useless, right?
 
Last edited:
@bolero
you can post tweets on twitter saing this:
!tweet now i am on my otserver!
 
If you make a command to players, example: !twitterlogin user password and after post twetts.
 
Back
Top