• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] Imprecision

Status
Not open for further replies.
Level 15
Joined
Jan 16, 2008
Messages
1,244
I heard some people saying that PolledWait is imprecise. Since i do not know timers and don't have enough time to study them now, i was wondering if you can answer this. Is it more imprecise if you use multiple but shorter waits or just one big wait?

JASS:
function example_1 takes real duration returns nothing
   local real d = duration/100
   local integer loopcount = 0
   loop
      set loopcount = loopcount + 1
      exitwhen loopcount = 100
      call PolledWait(d)
   endloop
endfunction

function example_2 takes real duration returns nothing
   call PolledWait(duration)
endfunction
My guess is that using multiple waits creates more imprecision but i thought it would be best if i check.
 
Level 17
Joined
Apr 13, 2008
Messages
1,608
There was a thread about this around 5-7 days ago. Yes, polled waits are not precise. Using a timer is the best way to solve your problems. Studying timers should take approximately... 10 seconds?
By the way, multiple shorter polled waits are less precise than one bigger. Go do some searching for the rest.
 
Level 13
Joined
Nov 22, 2006
Messages
1,260
Studying timers should take approximately... 10 seconds?

Not really. If you want to fully understand timers, their usage and the other tricks, you need to take some time, but it's always worth it. There is a really good tutorial on timers on wc3campaigns, it shows you practically everything you need to know about them.

Timers are also really useful for transferring locals (handle vars), which most people have really trouble understanding (I had too :p).
 
Level 14
Joined
Nov 20, 2005
Messages
1,156
Not really. If you want to fully understand timers, their usage and the other tricks, you need to take some time, but it's always worth it. There is a really good tutorial on timers on wc3campaigns, it shows you practically everything you need to know about them.

Timers are also really useful for transferring locals (handle vars), which most people have really trouble understanding (I had too :p).

PolledWaits, meanwhile, mean that you don't HAVE to transfer locals. And handle vars are so out of date...
 
The reason why PolledWait isn't used much is because it leaks. The modified unleaking polled wait creates and runs a global timer instead of creating one each time. Since runs practically forever it doesn't really need to be worried about. The only time it will recreate the timer is after 1000000 seconds past, which is about 277.77 hours or w/e...

http://wc3jass.com/viewtopic.php?t=206

Well, timers are the best though. Like if you were to do some sort of slide, it is extremely better to use a timer rather than to loop through and use TSA or PolledWait.
 
Level 13
Joined
Nov 22, 2006
Messages
1,260
Silv is referring to old days, he is using pure vJass now from what I know :p

Exactly. I am using pure vJass, but if I say that timers are useful for PandaMine's HSAS library, he won't understand much of it, will he......

You should always learn Handle Vars first because they are the core you need to understand first before starting to learn vJass, because you can't understand vJass if you can't understand Handle Vars, that's just how the life goes.....
 
Level 9
Joined
Mar 25, 2005
Messages
252
You should always learn Handle Vars first because they are the core you need to understand first before starting to learn vJass, because you can't understand vJass if you can't understand Handle Vars, that's just how the life goes.....

but you don't have to understand Handle Vars in order to understand vJass. I'd say that if you can skip a phase like that then do it. Just like it is best to go from GUI to jass as fast as possible.
 
Level 13
Joined
Nov 22, 2006
Messages
1,260
but you don't have to understand Handle Vars in order to understand vJass. I'd say that if you can skip a phase like that then do it. Just like it is best to go from GUI to jass as fast as possible.

I know, I didn't say that. But Handle Vars are so damn simple and if you can't understand them, you probably won't be able to understand some more complex vJass transferring system (HSAS and such) which contain stuff that some people never heard of and have no basic idea how to deal with them. It is good for vJass starters to use structs + handle vars and then move to a more efficient (and probably more complex) system.
 
Level 9
Joined
Mar 25, 2005
Messages
252
I know, I didn't say that.
I know, that's why I said it.

It is good for vJass starters to use structs + handle vars and then move to a more efficient (and probably more complex) system.

JASS:
call SetHandleInt(handle, string, integer)
call AttachStruct(handle, integer)

When you start using vJass you can just aswell forget that Handle Vars ever existed. If you want to learn about game cache you can take a look at Handle Vars whether or not you use them.
 
Status
Not open for further replies.
Top