| 09-26-2007, 09:41 AM | #1 |
Im just wondering if you can do something like this call TimerStart(timer,0.1,true,method call) I couldn't be bothered to read the manual right now -Av3n |
| 09-26-2007, 09:48 AM | #2 |
You mean something like this? JASS:struct ExampleStruct method DoSomething takes nothing returns nothing call DoSomething endmethod endstruct function ExampleFunc takes nothing returns nothing local ExampleStruct es = ExampleStruct.create() local timer t = CreateTimer() call TimerStart(t, 0.1, true, es.DoSomething()) set t = null endfunction If this example shows what you wanted to ask, then yes, you can do that. |
| 09-26-2007, 10:22 AM | #3 |
I thought you can only call static methods taking nothing via callbacks JASS:struct A static method func takes nothing returns nothing call something() endmethod endstruct function test takes nothing returns nothing //somecalls... call TimerStart(t, 1., true, function A.func) //some other calls... endfunction |
| 09-26-2007, 01:01 PM | #4 |
Hitchhiker is right. Try using TimeLib ... You can just use any typical attach system, attach integer(structvalue) and then when reading use structvalue( storedinteger). |
| 09-26-2007, 01:07 PM | #5 |
JASS:
if (N==0) then
debug call BJDebugMsg("Warning: Event Lib expires with no event")
return
endif
// [0] has expired...
if ((events[0].stop) or (events[0].onExpire()) ) then
call events[0].destroy()
endif
// Reheap the stuff...
set N=N-1
set i=0
if (N==0) then
//nothing to do here.
return
endif
You would be desyncing Mac users with those lines :p |
| 09-26-2007, 01:18 PM | #6 |
so, you think that not returning a boolean on timer expire functions would desync mac players? |
| 09-26-2007, 01:24 PM | #7 | |
I recall seeing something like that awhile ago, I'll try to look for it. EDIT: Found it, I don't know much of these stuff so I'm trying to find out more about them :p Quote:
|
| 09-26-2007, 01:28 PM | #8 | |
Quote:
|
| 09-26-2007, 01:29 PM | #9 |
![]() |
| 09-26-2007, 06:12 PM | #10 |
also cohadar posted that and while he may not be a bad coder him and a few other people (including me) are not always right. There are normally exceptions to EVERY rule in JASS (due to bugs or w/e) so take everything with a grain of salt. Cept maby vex and a few other people who masochistically pour over there code for bugs ect :P |
| 09-26-2007, 07:47 PM | #11 |
Vex, what exactly is that TimeLib thingy and how do you use it? I heard about it a couple of times, but I never bothered to find out what exactly is it. Maybe add a description under that code? |
| 09-26-2007, 08:10 PM | #12 |
Well it is an alternative method to attaching stuff to timers. Instead of attaching it uses array and a heap algorithm. |
| 09-26-2007, 10:43 PM | #13 | |
Quote:
|
| 09-26-2007, 10:54 PM | #14 |
well Vex sorry to break it to ya but it isnt finished yet :P |
| 09-26-2007, 11:17 PM | #15 |
Thx for the info, i needed to run with 2 timers(shield regeneration(secondary timer(local)),shield health(main timer(global))) for a spell or something simliar thx. -Av3n |
