io.open and os.date

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
Tooney
Posts: 26
Joined: Fri Oct 07, 2011 12:48 am

io.open and os.date

#1 Post by Tooney »

Hi all,

Standing on the shoulder of giants I often tweak someone elses code to suit my needs. If I use io.open and os.date in any rombot related script it works fine but if I use them in code that used in interface\addons such as PetAutoEvent the code just doesn't get executed. I've put chat window messages before and after the code and it's like the script aborts at that point. I use exactly the same code in both cases.....

Code: Select all

local filename = getExecutionPath() .. "/logs/PetEvents.log";
				local file, err = io.open(filename, "a+");
I've also tried putting explicit paths in for the filename, such ""PetEvents.log" and "C:\PetEvents.log".

Any tips?
Thanks.
User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: io.open and os.date

#2 Post by lisa »

Yes unfortunately there is nothing wrong with the code, it is the game itself that has the issue.

Over the years they have removed functions you would normally have in LUA.

Even something as simple as os.time() won't work, there is an addon called d303fix which added back in a function for using os.time() by getting the time from items in itemshop with a timer for when it is available.


So long story short not all functions work in addons for RoM.
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
Tooney
Posts: 26
Joined: Fri Oct 07, 2011 12:48 am

Re: io.open and os.date

#3 Post by Tooney »

Thanks for the reply. I ended up doing something a bit rubbish with GetTime() but it's usable for what I wanted.
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: io.open and os.date

#4 Post by rock5 »

Also I think you can only read files form an addon but you can't write. The only way to save anything is using the games savevariables.
  • 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.”
          • Ronald Reagan
Post Reply