wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Warcraft III Modding > Developer's Corner > General Development
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 11-16-2008, 01:02 AM   #1
ClichesAreSt00pid
User
 
Join Date: Jan 2007
Posts: 157

ClichesAreSt00pid has little to show at this moment (4)

Default Host/Single Player Check Problems

Yay new random issues that make no sense.

In single player the SaveGameCache() apparently somehow returns false as if it's multiplayer when it's not, then it just get's stuck at "set t=GetHostId()". I really do not understand it. It was working perfectly before and I don't remember even touching it and now it's totally screwed up and doesn't work at all. I played on LAN and it still does not work.

Here's the trigger:

Collapse JASS:
library CheckHost initializer Init requires GlobalFuncs

    globals
        private gamecache GC
    endglobals
    
    private function GameCache takes nothing returns gamecache
        if (GC == null) then
            set GC = InitGameCache("hostcheck.w3v")
        endif
        
        return GC
    endfunction

    private function GetHostId takes nothing returns integer
        call StoreInteger(GameCache(), "missionKey", "key", GetPlayerId(GetLocalPlayer()) + 1)
        
        call TriggerSyncStart()
        call SyncStoredInteger(GameCache(), "missionKey", "key")
        call TriggerSyncReady()
        
        return GetStoredInteger(GameCache(), "missionKey", "key") - 1
    endfunction

    public function GetHost takes nothing returns nothing
        local integer array id
        local real array latency
        local integer max = 0
        local integer t = 0
        local integer i = 0
        
        local timer T = CreateTimer()
        call TimerStart(T,20.,false,null)
        
        set HOST = null
        
        loop
        exitwhen i > 11
            set id[i] = 0
            set i = i + 1
        endloop
        set i = 0
        
        loop
        exitwhen i > 5
            set latency[i]=TimerGetElapsed(T)
            set t = GetHostId() // Stuck here so it's probably in the GetHostId() function
            set latency[i] = TimerGetElapsed(T)-latency[i]
            
            set id[t] = id[t] + 1
            if id[t] > id[max] then
                set max = t
            endif
            
            set i = i + 1
            call PauseTimer(T)
            call PolledWait2(1.) 
            call ResumeTimer(T)
        endloop
        
        set HOST = Player(max)
        set LATENCY = (latency[1]+latency[2]+latency[3]+latency[4]+latency[5])/5.
        
        call ClearTextMessages()
        call DisplayTimedTextToForce(bj_FORCE_ALL_PLAYERS,10.,"Host: "+GetPlayerName(HOST))
        call DisplayTimedTextToForce(bj_FORCE_ALL_PLAYERS,10.,"Latency: "+I2S(R2I(LATENCY*1000)))
        call StartSound(SOUND_RADIO_FEEDBACK_C_1)
        call TriggerRegisterPlayerChatEvent(CommandKick_T,HOST,"-kick",false)
        
        call FlushStoredMission(GameCache(),"missionKey")
        call PauseTimer(T)
        call DestroyTimer(T)
        set T = null
    endfunction

    private function Actions takes nothing returns nothing
        local gamecache gc=InitGameCache("cheatcheck.w3v")
        call StoreInteger(gc,"test","test",9)
        
        if SaveGameCache(gc) then
            set SINGLE_PLAYER = true
            set HOST = GetLocalPlayer()
            call DisplayTimedTextToForce(bj_FORCE_ALL_PLAYERS,10.,"\nThe current game is single player.")
        else
            call GetHost()
        endif
        
    endfunction

    
    // Initializer
    private function Init takes nothing returns nothing
        local trigger T = CreateTrigger()
        call TriggerRegisterTimerEventSingle(T,3.0)
        call TriggerAddAction(T,function Actions)
    endfunction
    
endlibrary

Last edited by ClichesAreSt00pid : 11-16-2008 at 01:04 AM.
ClichesAreSt00pid is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 11-16-2008, 06:57 PM   #2
ClichesAreSt00pid
User
 
Join Date: Jan 2007
Posts: 157

ClichesAreSt00pid has little to show at this moment (4)

Default

Alright I think it's supposed to stop there in single player. The real problem I think is that SaveGameCache() is returning false in single player for some reason.

So the question I suppose is: Why can't I save a game cache? I don't know why someone wouldn't be able to.

I put the trigger in a test map and it worked fine. Something in another trigger I guess is making it unable to, but I don't know what.

Edit: I did a debug check and apparently the variable is nulled. Any idea why a game cache would be nulled?

Last edited by ClichesAreSt00pid : 11-16-2008 at 08:05 PM.
ClichesAreSt00pid is offline   Reply With Quote
Old 11-16-2008, 09:33 PM   #3
Jazradel
Superuser
 
Jazradel's Avatar
 
Join Date: Dec 2005
Posts: 651

Submissions (1)

Jazradel has a spectacular aura about (110)Jazradel has a spectacular aura about (110)Jazradel has a spectacular aura about (110)Jazradel has a spectacular aura about (110)

Send a message via AIM to Jazradel Send a message via MSN to Jazradel
Default

There are bugs that are caused by having 256 saved gamecaches in single player.

I don't know if thats one of them, but it seems likely.


Couldn't you just check if there's only one player, rather than using SaveGameCache()?
SaveGameCache() probably just returns false.
__________________


Table:
Jump Map
Point System
Warcraft III Model Archive

W3 Model Archive should be available from https://www.mediafire.com/folder/cd5..._III_Resources, PM me if it doesn't work.

Last edited by Jazradel : 11-16-2008 at 09:37 PM.
Jazradel is offline   Reply With Quote
Old 11-16-2008, 10:01 PM   #4
ClichesAreSt00pid
User
 
Join Date: Jan 2007
Posts: 157

ClichesAreSt00pid has little to show at this moment (4)

Default

Then you can't play alone on LAN/bnet.

I'm pretty sure I don't have more than 5 game caches including the ones in the trigger.
ClichesAreSt00pid is offline   Reply With Quote
Old 11-16-2008, 10:44 PM   #5
Captain Griffen
Dread Lord of the Cookies
 
Captain Griffen's Avatar


Content Director
 
Join Date: Sep 2003
Posts: 5,375

Submissions (2)

Captain Griffen is a glorious beacon of light (497)Captain Griffen is a glorious beacon of light (497)Captain Griffen is a glorious beacon of light (497)Captain Griffen is a glorious beacon of light (497)Captain Griffen is a glorious beacon of light (497)

Approved Map: Warlords[Quicksilver #2] - 1st Place

Default

Try:

Collapse JASS:
    private function GameCache takes nothing returns gamecache
        if (GC == null) then
            call FlushGameCache(InitGameCache("hostcheck.w3v"))
            set GC = InitGameCache("hostcheck.w3v")
        endif
        
        return GC
    endfunction
__________________
Quote:
Originally Posted by Earth-Fury
Griffen is correct, you are not.
Quote:
[13:32] <Akolyt0r> hmm.. stil i want to have some unused women
Captain Griffen is offline   Reply With Quote
Old 11-17-2008, 01:08 AM   #6
ClichesAreSt00pid
User
 
Join Date: Jan 2007
Posts: 157

ClichesAreSt00pid has little to show at this moment (4)

Default

Thanks for the tip but it didn't work. Same outcome.

I tried replacing gc with GameCache() and it would just cut off completely at the "storeinteger" part. I tried flushing gc before initializing it and that did nothing.

Edit: Okay the problem has to do with all the game caches simply not working period. I recall this happening 1-2 years ago but I don't remember what the cause and fix was. If you know any reasons why game caches could be screwed up like this then let me know.

Last edited by ClichesAreSt00pid : 11-17-2008 at 01:37 AM.
ClichesAreSt00pid is offline   Reply With Quote
Old 11-17-2008, 12:06 PM   #7
Captain Griffen
Dread Lord of the Cookies
 
Captain Griffen's Avatar


Content Director
 
Join Date: Sep 2003
Posts: 5,375

Submissions (2)

Captain Griffen is a glorious beacon of light (497)Captain Griffen is a glorious beacon of light (497)Captain Griffen is a glorious beacon of light (497)Captain Griffen is a glorious beacon of light (497)Captain Griffen is a glorious beacon of light (497)

Approved Map: Warlords[Quicksilver #2] - 1st Place

Default

256 limit. Across the profile.
__________________
Quote:
Originally Posted by Earth-Fury
Griffen is correct, you are not.
Quote:
[13:32] <Akolyt0r> hmm.. stil i want to have some unused women
Captain Griffen is offline   Reply With Quote
Old 11-17-2008, 09:21 PM   #8
ClichesAreSt00pid
User
 
Join Date: Jan 2007
Posts: 157

ClichesAreSt00pid has little to show at this moment (4)

Default

What's across the profile?

And there's only like 5 game caches. Is there anything that could cause problems with them?

This is bugging me :o.
ClichesAreSt00pid is offline   Reply With Quote
Old 11-17-2008, 09:39 PM   #9
Captain Griffen
Dread Lord of the Cookies
 
Captain Griffen's Avatar


Content Director
 
Join Date: Sep 2003
Posts: 5,375

Submissions (2)

Captain Griffen is a glorious beacon of light (497)Captain Griffen is a glorious beacon of light (497)Captain Griffen is a glorious beacon of light (497)Captain Griffen is a glorious beacon of light (497)Captain Griffen is a glorious beacon of light (497)

Approved Map: Warlords[Quicksilver #2] - 1st Place

Default

For the profile, not for the map.
__________________
Quote:
Originally Posted by Earth-Fury
Griffen is correct, you are not.
Quote:
[13:32] <Akolyt0r> hmm.. stil i want to have some unused women
Captain Griffen is offline   Reply With Quote
Old 11-17-2008, 10:42 PM   #10
Jazradel
Superuser
 
Jazradel's Avatar
 
Join Date: Dec 2005
Posts: 651

Submissions (1)

Jazradel has a spectacular aura about (110)Jazradel has a spectacular aura about (110)Jazradel has a spectacular aura about (110)Jazradel has a spectacular aura about (110)

Send a message via AIM to Jazradel Send a message via MSN to Jazradel
Default

Everytime you play a map single player that uses InitGameCache('X'), it creates a new game cache in your profile.

Your profile can only have 256 game caches before things bug.
__________________


Table:
Jump Map
Point System
Warcraft III Model Archive

W3 Model Archive should be available from https://www.mediafire.com/folder/cd5..._III_Resources, PM me if it doesn't work.

Last edited by Jazradel : 11-17-2008 at 10:43 PM.
Jazradel is offline   Reply With Quote
Old 11-18-2008, 12:09 AM   #11
ClichesAreSt00pid
User
 
Join Date: Jan 2007
Posts: 157

ClichesAreSt00pid has little to show at this moment (4)

Default

So I just gotta make sure I flush them all?

And how do I clear it now then?

Last edited by ClichesAreSt00pid : 11-18-2008 at 12:12 AM.
ClichesAreSt00pid is offline   Reply With Quote
Old 11-18-2008, 12:29 AM   #12
Captain Griffen
Dread Lord of the Cookies
 
Captain Griffen's Avatar


Content Director
 
Join Date: Sep 2003
Posts: 5,375

Submissions (2)

Captain Griffen is a glorious beacon of light (497)Captain Griffen is a glorious beacon of light (497)Captain Griffen is a glorious beacon of light (497)Captain Griffen is a glorious beacon of light (497)Captain Griffen is a glorious beacon of light (497)

Approved Map: Warlords[Quicksilver #2] - 1st Place

Default

Try it with a new profile, see if that is the problem.
__________________
Quote:
Originally Posted by Earth-Fury
Griffen is correct, you are not.
Quote:
[13:32] <Akolyt0r> hmm.. stil i want to have some unused women
Captain Griffen is offline   Reply With Quote
Old 11-18-2008, 12:46 AM   #13
ClichesAreSt00pid
User
 
Join Date: Jan 2007
Posts: 157

ClichesAreSt00pid has little to show at this moment (4)

Default

Yeah I tested it on LAN and the game caches seem to be working there.

YES it's working now! Thank god I love you guys. I wish I could +100 rep and give cookies.

Thanks for your patience especially ^.^. I've learned a good amount today.
ClichesAreSt00pid is offline   Reply With Quote
Old 12-18-2008, 05:03 PM   #14
Themis
User
 
Join Date: Nov 2006
Posts: 36

Themis has little to show at this moment (5)

Default

Collapse JASS:
    globals
        private gamecache GC
    endglobals
    
    private function GameCache takes nothing returns gamecache
        if (GC == null) then
            call DisplayTextToPlayer( GetLocalPlayer(), 0, 0, "GC == null" )
            set GC = InitGameCache("hostcheck.w3v")
        else
            call DisplayTextToPlayer( GetLocalPlayer(), 0, 0, "GC != null" )
        endif
        
        return GC
    endfunction

The issue here in your code is that you should do:

Collapse JASS:
    globals
        private gamecache GC = null
    endglobals

Last edited by Themis : 12-18-2008 at 05:04 PM.
Themis is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 11:32 PM.


Affiliates
The Hubb The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2019, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services