Browse Source

Restore periodicalEvent function

* and typo fixes
Eduardo Bart 8 years ago
parent
commit
d39ca7de10
3 changed files with 21 additions and 2 deletions
  1. 1
    1
      README.md
  2. 19
    0
      modules/corelib/globals.lua
  3. 1
    1
      src/framework/core/resourcemanager.cpp

+ 1
- 1
README.md View File

@@ -13,7 +13,7 @@ Beyond of it's flexibility with scripts, otclient comes with tons of other featu
13 13
 the creation of new client side stuff in otserv that was not possible before. These include,
14 14
 sound system, graphics effects with shaders, particle engines, modules/addons system, animated textures,
15 15
 styleable user interface, transparency, multi language, in game lua terminal, an OpenGL 1.1/2.0 ES engine that make possible to
16
-run on mobile platforms like Androi/iPhon/iPad and much more. Otclient is also flexible enough to
16
+run on mobile platforms like Android/iPhone/iPad and much more. Otclient is also flexible enough to
17 17
 create tibia tools like map editors just using scripts, because it wasn't designed to be just a
18 18
 client, instead otclient was designed to be a combination of a framework and tibia APIs.
19 19
 

+ 19
- 0
modules/corelib/globals.lua View File

@@ -31,6 +31,25 @@ function cycleEvent(callback, front)
31 31
   return event
32 32
 end
33 33
 
34
+function periodicalEvent(eventFunc, conditionFunc, delay, autoRepeatDelay)
35
+  delay = delay or 30
36
+  autoRepeatDelay = autoRepeatDelay or delay
37
+
38
+  local func
39
+  func = function()
40
+    if conditionFunc and not conditionFunc() then
41
+      func = nil
42
+      return
43
+    end
44
+    eventFunc()
45
+    scheduleEvent(func, delay)
46
+  end
47
+
48
+  scheduleEvent(function()
49
+    func()
50
+  end, autoRepeatDelay)
51
+end
52
+
34 53
 function removeEvent(event)
35 54
   if event then
36 55
     event:cancel()

+ 1
- 1
src/framework/core/resourcemanager.cpp View File

@@ -62,7 +62,7 @@ void ResourceManager::discoverWorkDir(const std::string& appName, const std::str
62 62
     }
63 63
 
64 64
     if(!found)
65
-        g_logger.fatal("Unable to find application work directory.");
65
+        g_logger.fatal(stdext::format("Unable to find %s, the application cannot be initialized.", existentFile));
66 66
 }
67 67
 
68 68
 bool ResourceManager::setupWriteDir(const std::string& appWriteDirName)

Loading…
Cancel
Save