• 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] And again an ill minded idea that surely cannot work by definition...

Status
Not open for further replies.
Level 5
Joined
May 22, 2006
Messages
150
As those of you, who came from wc3sear.ch may remember, I always tried to avoid the use of game cache whereever and whenever possible...
Well, thus, my ultimate enemy is the function "TriggerSleepAction", whose inconsistent functionality is well known...
Now the ill minded idea:
On map initialisation, I start a trigger, that does this:
JASS:
function Trig_TimeAdjustment_Actions takes nothing returns nothing
  local timer clock = CreateTimer()
  call TimerStart(clock, 600, false, null)
  call TriggerSleepAction(10)
  set udg_WaitTimeDelay = TimerGetElapsed(clock)
  call DestroyTimer(clock)
  set clock = null
endfunction

Now, I have a value, that should be "equal" to ten seconds...
So, every wait time divided through this value should make the "TriggerSleepAction" wait as long as it is supposed to...
But, hey, that sounds too easily, does it not?

Potential problems:
Is the delay between supposed wait time and real wait time constant (per game) or relative to the amount of supposed wait time?
If it is constant, this code will not work.
If it is relative, what kind of (mathematical) function does it follow?
Is it linear, exponential, or something else?
If it is anything than linear, this code will not work.
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
Problems;

-No, it isn't constant, especially with leaks and delay (seems to be random..)
-It can't handle small intervals



Yeah, I remember you, haven't seen you in awhile ;)

Anyways, check this out. It basically replaces GameCache anyways, among other things.

Read the readme and stuff, then there're tutorials floating around if you still don't get it.

It's really useful, though, for all sorts of things. (OOP and much much more)
 
Level 5
Joined
May 22, 2006
Messages
150
You know, I really hate to use other people's code...

Well, I suppose just something alike that will not do it:
JASS:
function TriggerFixedSleepAction takes real sleepTime returns nothing
  local integer counter = 0
  loop
    if GetLocalPlayer() == Player(counter)
      call TriggerSleepAction(sleepTime)
    endif
    set counter = counter + 1
    exitwhen counter >= 11
  endloop
endfunction
(Remember, in singleplayer mode, TriggerSleepAction works well, so if I avoid net traffic, maybe...
Ah, it's still crap, i guess.)

... See all these posts, in which people use non-native code and wonder, why it does not work?
I am even importing (nearly) empty "blizzard.j"-files into my maps, so that I get rid of all these unnecessary variables, constants and functions...
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
It's more of a preprocessor than anything. I normally hate using other peoples' code, but this is an exception ;)

Half of the stuff just involves manipulating the .j script (copying your code with replacements, moving it around, merging global blocks) that has nothing to do with anyone else's code anyways.

Also, it has a better compiler that doesn't crash all the time.
 
Level 5
Joined
May 22, 2006
Messages
150
I am troubled enough to get this "AMAI"-thing to work (somehow readme does not fit reality... but that's a different story ^^), but alright, I'll give it a try. ~~

... Oh my, how deep I am sunken over time...
 
Level 13
Joined
Nov 22, 2006
Messages
1,260
Yeah, it prevents many kinds of crashes (though still not the lightning ones), and it sometimes say what function would normally crash the game, and it disables that so the crash doesn't happen. Pretty useful, and I don't know what you're talking about "using other people's code", this is not like that at all. It also has useful stuff, a better version of ExecuteFunc for example (it's faster, it can take parameters and it can use the return value) and many more.....
 
Level 5
Joined
May 22, 2006
Messages
150
Which part of "them" is "it"?
I do not need, for example, a parser, do I!? (Of course, if that thing is not a "parser" by definition, I have no idea.)

... Hell, with such very... "custom" stuff I really feel the urge of calling for help of some native german, who already has the knowledge and understandment, that I need. ~~
Some theory lessons whould be nice - always better than reading a manual.
 
Level 14
Joined
Nov 20, 2005
Messages
1,156
You know, I really hate to use other people's code...

Well, I suppose just something alike that will not do it:
JASS:
function TriggerFixedSleepAction takes real sleepTime returns nothing
  local integer counter = 0
  loop
    if GetLocalPlayer() == Player(counter)
      call TriggerSleepAction(sleepTime)
    endif
    set counter = counter + 1
    exitwhen counter >= 11
  endloop
endfunction
(Remember, in singleplayer mode, TriggerSleepAction works well, so if I avoid net traffic, maybe...
Ah, it's still crap, i guess.)

... See all these posts, in which people use non-native code and wonder, why it does not work?
I am even importing (nearly) empty "blizzard.j"-files into my maps, so that I get rid of all these unnecessary variables, constants and functions...

That code would cause desyncs, since the waits wouldn't be synced.
 
Status
Not open for further replies.
Top