GetSavingPlayer(), Testers Needed

Azlier

Old World Ghost
Reaction score
461
So, now that I've gone totally insane, I would like one more thing to be tested.

Online (LAN or Battle.net doesn't matter) would be nice, because I want to test if this desyncs. Or works at all.

Save the game, it's supposed to display the name of the player who saved it. If you get syntax errors, report them with the errors you get and which line it's on.

Note: This is terribly inefficient with some unnecessary handles. But it should work. Hopefully.

[lJASS]requires[/lJASS] Event
JASS:
library GetSavingPlayer initializer Init requires Event //Note to self: needs polishing.

globals
    private Event Ev
    private player SavingPlayer = null
    private unit array U
    private integer LocalId
endglobals

constant function GetSavingPlayer takes nothing returns player
    return SavingPlayer
endfunction

function TriggerRegisterGameSaved takes trigger t returns nothing
    call Ev.register(t)
endfunction

private function OnClick takes nothing returns boolean
    set SavingPlayer = GetOwningPlayer(GetTriggerUnit())
    call Ev.fire()
    ////////////////////////////////////////////
    call BJDebugMsg(GetPlayerName(SavingPlayer))
    ////////////////////////////////////////////
    set SavingPlayer = null
    return false
endfunction

private function OnSave takes nothing returns boolean
    call SelectUnit(U[LocalId], true)
    call SelectUnit(U[LocalId], false)
    return false
endfunction

private function Init takes nothing returns nothing
    local trigger t
    local integer i = 11
    set LocalId = GetPlayerId(GetLocalPlayer())
    set Ev = Event.create()
    loop
        set t = CreateTrigger()
        call TriggerRegisterGameEvent(t, EVENT_GAME_SAVE)
        call TriggerAddCondition(t, Condition(function OnSave))
        if GetLocalPlayer() != Player(i) then
            call DisableTrigger(t)
        endif

        set t = CreateTrigger()
        set U<i> = CreateUnit(Player(i), &#039;hfoo&#039;, 10000, 10000, 270)
        call PauseUnit(U<i>, true)
        call TriggerRegisterUnitEvent(t, U<i>, EVENT_UNIT_SELECTED)
        call TriggerAddCondition(t, Condition(function OnClick))
        exitwhen i == 0
        set i = i - 1
    endloop
endfunction

endlibrary</i></i></i>
 

Renendaru

(Evol)ution is nothing without love.
Reaction score
309
It seems to be returning the right player, but I haven't had a chance to get more than 1 person to test with.
 

ZakkWylde-

New Member
Reaction score
14
:D:D

Thanks! I'll try this out...
I'll also try to get results of your other test back...

And uh...what does this need? Are you using KT2? (I'm noob at the extension languages)
 

Azlier

Old World Ghost
Reaction score
461
This needs Event. I gotta update the first post.

Just save the game in-game online, and tell me if it displays your name.

Have the other players save, too.
 

ZakkWylde-

New Member
Reaction score
14
Zzzz...
Where do I get Event?

I'm assuming that'll fix the problem of this saving...and returning

Missing Requirement: Event (libraries cannot require scopes)
 

Azlier

Old World Ghost
Reaction score
461
I linked it, you know. Twice.
 

ZakkWylde-

New Member
Reaction score
14
QQQQQ.

Yeah I found it...i was testing it :D
As it turns out, when Player 1 (blue) saved the game, it displayed both Player 0 and 1's names...So .... not quite working...I'll try and run a few more tests.
 

Azlier

Old World Ghost
Reaction score
461
Method 2 it is, then. Please stand by.

EDIT: Try it now.
 

ZakkWylde-

New Member
Reaction score
14
Unfortunately, it continues to display the names of all the players...

If 3 people are in the game, it displays all three from player 0 to player 2
...it always displays player 0's name first (if he's in the game)

EDIT: WRONG INFO...posting again.
 

Azlier

Old World Ghost
Reaction score
461
It needs a rewrite, yes it does. I need to try my third method. It'll be done in an hour or so.
 

ZakkWylde-

New Member
Reaction score
14
Ok, 3 people...

3 slots (2 people are on Force 1, one person is on Force 2) Red, Blue, Teal, respectively

Blue (second slot) saves. It shows Red's name, Blue's name, Teal's name.
Red (first slot) saves. It shows Red's name, Teal's name, Blue's name.
Teal (third slot) saves. It shows Red's name, Teal's name, Blue's name.

I'm not sure if it is the case that whoever saves has their name in second? (Unless its red?!?) :confused:

If so, that info could be used as well...

EDIT/Addition: Yo, Az, I'll be back later tonight...maybe in about 3-4 hours...so I'll be able to test once again at that time. Thanks again for the help. I really appreciate it.

EDIT #2: I figured it out -- its on the next page...I made sense of the information (a little bit of educated guessing, but the thought-pattern seems to follow sequentially and coherently)
 

Azlier

Old World Ghost
Reaction score
461
I now realize that... this won't work. :(

I can't come up with another method that would work.

This study can be postponed until further notice.
 

Lyerae

I keep popping up on this site from time to time.
Reaction score
105
Just a random thought, but try using the GetDelay thing to calculate the ping, and base it off of that.

It's a completely random thought, and I'm thinking it won't work, but meh.
 

Lyerae

I keep popping up on this site from time to time.
Reaction score
105
Bah I'm an idiot. That's what I get, posting half-awake. >.<
 

ZakkWylde-

New Member
Reaction score
14
Ok, 3 people...

3 slots (2 people are on Force 1, one person is on Force 2) Red, Blue, Teal, respectively

Blue (second slot) saves. It shows Red's name, Blue's name, Teal's name.
Red (first slot) saves. It shows Red's name, Teal's name, Blue's name.
Teal (third slot) saves. It shows Red's name, Teal's name, Blue's name.

I'm not sure if it is the case that whoever saves has their name in second? (Unless its red?!?) :confused:

If so, that info could be used as well...

EDIT/Addition: Yo, Az, I'll be back later tonight...maybe in about 3-4 hours...so I'll be able to test once again at that time. Thanks again for the help. I really appreciate it.

Uh...I figured it out...
Your script does work. It just has to differentiate between the person who INITIATED the save and everyone (who saves the game). Because everyone gets the save file, everyone's name shows up. And it shows up in the order that people save it (i.e., the names show up sequentially...about every .5 seconds...)

It seems the host saves it first and the person who initiated the save saves it second. Then the order (probably) goes from player 0 to player 11 excluding the two (or one, if host = saver) people who already have the save file.

Maybe this insight will help you out...if I totally understood your script, I could probably fiddle around with it to get it right.
 

Azlier

Old World Ghost
Reaction score
461
Fiddle away. I don't know how to act on "information" like that.
 

ZakkWylde-

New Member
Reaction score
14
...if I totally understood your script, I could probably fiddle around with it to get it right.

And there is the problem. I could spend some time going through Event I guess...but could you explain the basics OR could I come to ask you if I run into trouble?

But anyways, I was thinking along the lines of kicking the second name that shows, unlessssssss someway to figure out that is or isn't host who is saving...
This method doesn't make sense to you? =P I don't know if its possible or how many conditions it will require....if then if then?
 

Azlier

Old World Ghost
Reaction score
461
Well, Event doesn't really have anything to do with the script. Remove it, if you want.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • WildTurkey WildTurkey:
    is there a stephen green in the house?
    +1
  • The Helper The Helper:
    What is up WildTurkey?
  • The Helper The Helper:
    Looks like Google fixed whatever mistake that made the recipes on the site go crazy and we are no longer trending towards a recipe site lol - I don't care though because it motivated me to spend alot of time on the site improving it and at least now the content people are looking at is not stupid and embarrassing like it was when I first got back into this like 5 years ago.
  • The Helper The Helper:
    Plus - I have a pretty bad ass recipe collection now! That section of the site is 10 thousand times better than it was before
  • The Helper The Helper:
    We now have a web designer at my job. A legit talented professional! I am going to get him to redesign the site theme. It is time.
  • Varine Varine:
    I got one more day of community service and then I'm free from this nonsense! I polished a cop car today for a funeral or something I guess
  • Varine Varine:
    They also were digging threw old shit at the sheriff's office and I tried to get them to give me the old electronic stuff, but they said no. They can't give it to people because they might use it to impersonate a cop or break into their network or some shit? idk but it was a shame to see them take a whole bunch of radios and shit to get shredded and landfilled
  • The Helper The Helper:
    whatever at least you are free
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top