-
Jamnyk
- Posts: 28
- Joined: Thu Nov 15, 2012 7:12 am
#1
Post
by Jamnyk » Fri Feb 01, 2013 10:19 am
Hi. I'd like to write addon which call "Chest event!" at 11 am and 7 pm. I tested
and
but that commands don't work
--all code from .lua file is
Code: Select all
function Chest_OnLoad(this)
DEFAULT_CHAT_FRAME:AddMessage("Chest addon loaded.", 0.67, 0, 0.85)
end
function Chest_onEvent(this, event)
player:update()
sendMacro("GetTime()");
if GameTime == 10.59 then
DEFAULT_CHAT_FRAME:AddMessage("Chest event!", 0.67, 0, 0.85)
end
if GameTime == 18.59 then
DEFAULT_CHAT_FRAME:AddMessage("Chest event!", 0.67, 0, 0.85)
end
end
Are there any other commands like "GetTime()" ?
-
lisa
- Posts: 8332
- Joined: Tue Nov 09, 2010 11:46 pm
- Location: Australia
#2
Post
by lisa » Fri Feb 01, 2013 11:36 am
you could probably use the operating system time if using bot, not sure it would work as an addon.
Do a search for d303fix, that is an addon which attempts to get the current server time by looking at sales in the item shop.
This would probably be the best function to use with bot.
http://www.lua.org/manual/5.1/manual.html#pdf-os.date
-
rock5
- Posts: 12173
- Joined: Tue Jan 05, 2010 3:30 am
- Location: Australia
#3
Post
by rock5 » Fri Feb 01, 2013 1:04 pm
If you want the real time why not just use the bot's time.
Code: Select all
Command> print(os.date())
02/02/13 04:58:22
That prints a formated string which is not that much use but you can have it return a table of values
Code: Select all
Command> table.print(os.date("*t"))
table: 0646A0B0
day: 2
isdst: true
year: 2013
month: 2
yday: 33
min: 0
wday: 7
sec: 16
hour: 5
So you could do something like
Code: Select all
checktime = os.date("*t")
if checktime.hour == 7 or checktime.hour == 11 then
- Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
- I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
- How to: copy and paste in micromacro
________________________
Quote:
- “They say hard work never hurt anybody, but I figure, why take the chance.”
-
Jamnyk
- Posts: 28
- Joined: Thu Nov 15, 2012 7:12 am
#4
Post
by Jamnyk » Sat Feb 02, 2013 7:49 am
Yeah, I can do it with bot, but it's a bit uncomfortable to use it with bot

Thank you for help, I give up

Mayby later
-
rock5
- Posts: 12173
- Joined: Tue Jan 05, 2010 3:30 am
- Location: Australia
#5
Post
by rock5 » Sat Feb 02, 2013 8:25 am
Sorry I missed that you wanted an addon. Well with d303Fix installed you should still be able to use os.date("*t")
- Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
- I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
- How to: copy and paste in micromacro
________________________
Quote:
- “They say hard work never hurt anybody, but I figure, why take the chance.”
-
Jamnyk
- Posts: 28
- Joined: Thu Nov 15, 2012 7:12 am
#6
Post
by Jamnyk » Sat Feb 02, 2013 1:33 pm
So, I must rewrite d303fix addon or can i just rewrite my addon?
-
rock5
- Posts: 12173
- Joined: Tue Jan 05, 2010 3:30 am
- Location: Australia
#7
Post
by rock5 » Sat Feb 02, 2013 1:36 pm
With d303fix installed you can use the 'os' functions in your addon.
- Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
- I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
- How to: copy and paste in micromacro
________________________
Quote:
- “They say hard work never hurt anybody, but I figure, why take the chance.”
-
Jamnyk
- Posts: 28
- Joined: Thu Nov 15, 2012 7:12 am
#8
Post
by Jamnyk » Sat Feb 02, 2013 1:51 pm
Ok thanks, i'll test it tonight

-
Jamnyk
- Posts: 28
- Joined: Thu Nov 15, 2012 7:12 am
#9
Post
by Jamnyk » Sat Feb 02, 2013 3:41 pm
Code: Select all
function Chest_OnEvent(this, event)
os.date ([!format [, time]])
checktime = os.date("*t")
if checktime.hour == 11 or checktime.hour == 19 then
SlashCommand("/say Chest event!)
end
end
-- not work... how to do that?

-
lisa
- Posts: 8332
- Joined: Tue Nov 09, 2010 11:46 pm
- Location: Australia
#10
Post
by lisa » Sat Feb 02, 2013 7:16 pm
try not to confuse bot code with in game code.
Code: Select all
function Chest_OnEvent(this, event)
that tells me you have put this as an addon code.
that is bot code.
Try using
or
Code: Select all
SendChatMessage("Chest event!", "SAY")
-
rock5
- Posts: 12173
- Joined: Tue Jan 05, 2010 3:30 am
- Location: Australia
#11
Post
by rock5 » Sun Feb 03, 2013 12:26 am
I thought he was trying to create an addon.
Jamnyk wrote:Yeah, I can do it with bot, but it's a bit uncomfortable to use it with bot
I'm suspecting, Jamnyk, that you just don't know how to create an addon. It's very different to creating a userfunction. It's easy enough to add some functions to the game but if you want something automatically triggered by the update event for example then you need to create a frame in an xml file for your addon and register the event you want to use as a trigger.
- Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
- I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
- How to: copy and paste in micromacro
________________________
Quote:
- “They say hard work never hurt anybody, but I figure, why take the chance.”
-
Jamnyk
- Posts: 28
- Joined: Thu Nov 15, 2012 7:12 am
#12
Post
by Jamnyk » Sun Feb 03, 2013 12:12 pm
Yes, it's my first addon
__
My expectations for this addon are :
-check time
-if time = 11 [am] or 7 [pm] then do [say] "Chest event!" then wait 1[hour] then do check time
-if time > 11 [am] or < 11 [am] then wait 30[seconds] then do check time
-if time > 7 [pm] or < 7 [pm] then wait 30[seconds] then do check time
__
You said it's more difficult than i think...
Code: Select all
<Ui xmlns="http://www.runewaker.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.runewaker.com/UI.xsd">
<Script file="Chest.lua"/>
<Frame name="ChestFrame" parent="UIParent" hidden="true">
<Scripts>
<OnLoad>
Chest_OnLoad(this);
</OnLoad>
<OnEvent>
Chest_OnEvent(this, event);
</OnEvent>
</Scripts>
</Frame>
</Ui>
__
It's my .xml file
__
__
and it's my .toc file ;D
Do you know any addons similar to the one that I want to create? Maybe I could be inspired on it?
-
lisa
- Posts: 8332
- Joined: Tue Nov 09, 2010 11:46 pm
- Location: Australia
#13
Post
by lisa » Sun Feb 03, 2013 6:57 pm
-
Jamnyk
- Posts: 28
- Joined: Thu Nov 15, 2012 7:12 am
#14
Post
by Jamnyk » Mon Feb 04, 2013 12:04 am
Thanks ^^
Who is online
Users browsing this forum: No registered users and 2 guests