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 > Triggers & Scripts
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 07-13-2010, 04:33 PM   #1
sPyRaLz
User
 
Join Date: Aug 2003
Posts: 71

sPyRaLz is on a distinguished road (12)

Default Dialog box JASS problem

To whomever is able to help, I'll gladly +rep if the forum allows.
I'm trying to create a dialog box that pops up immediately after the map loads,
I originally created the file as a trigger, and modified it to JASS. The Jass version wont load.. It just takes me to a black screen when i try launch my campaign.
Any ideas anyone? Any advice will be greatly appreciated. Thanks in advance.

PS: I've attached the campaign file it might help troubleshoot the error. I'm using NewGen WE pack 5d.

Jass Code:
Collapse JASS:
scope Menu initializer Init
    globals
        public button array ba[5]
    endglobals

    private function Actions takes nothing returns nothing
        local unit h = null
        local dialog d
        local gamecache gc = null
        local location l = GetRectCenter(GetPlayableMapRect())
        
        call TriggerSleepAction( 0.50 )
        call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "Main")
        call DialogSetMessage(d, "Main Menu")
        set ba[0] = DialogAddButton(d, "New Game",0)
        // ----------------------------------------------------------
        set gc = InitGameCache("roti00.w3v")
        set h = RestoreUnit(gc, "Heroes", "Kael", Player(0), GetLocationX(l), GetLocationY(l), 0)
        if ( h != null ) then
            call RemoveUnit( h )
            set ba[1] = DialogAddButton(d, "Autosave: " + "Location" + " - " + "Time",0)
        endif
        // ----------------------------------------------------------
        set gc = InitGameCache("roti01.w3v")
        set h = RestoreUnit(gc, "Heroes", "Kael", Player(0), GetLocationX(l), GetLocationY(l), 0)
        if ( h != null ) then
            call RemoveUnit( h )
            set ba[2] = DialogAddButton(d, "Save 01: " + "Location" + " - " + "Time",0)
        endif
        // ----------------------------------------------------------
        set gc = InitGameCache("roti02.w3v")
        set h = RestoreUnit(gc, "Heroes", "Kael", Player(0), GetLocationX(l), GetLocationY(l), 0)
        if ( h != null ) then
            call RemoveUnit( h )
            set ba[3] = DialogAddButton(d, "Save 02: " + "Location" + " - " + "Time",0)
        endif
        // ----------------------------------------------------------
        set gc = InitGameCache("roti03.w3v")
        set h = RestoreUnit(gc, "Heroes", "Kael", Player(0), GetLocationX(l), GetLocationY(l), 0)
        if ( h != null ) then
            call RemoveUnit( h )
            set ba[4] = DialogAddButton(d, "Save 03: " + "Location" + " - " + "Time",0)
        endif
        // ----------------------------------------------------------
        call DialogDisplay(Player(0), d, true)
    endfunction
//===========================================================================
    private function Init takes nothing returns nothing
        local trigger MenuTrg = CreateTrigger(  )
        call TriggerAddAction( MenuTrg, function Actions )
    endfunction
endscope

Original Working Trigger:
Trigger:
Main Menu BAK
Collapse Events
Map initialization
Conditions
Collapse Actions
Wait 0.50 seconds
Game - Display to (All players) the text: Main
Dialog - Change the title of Dialog to Main Menu
Dialog - Create a dialog button for Dialog labelled New Game
Set DialogButton[0] = (Last created dialog Button)
-------- ---------------------------------------------------------- --------
Game Cache - Create a game cache from roti00.w3v
Game Cache - Restore Kael of Heroes from (Last created game cache) for Player 1 (Red) at (Center of (Playable map area)) facing 0.00
Set Hero = (Last restored unit)
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Hero Not equal to No unit
Collapse Then - Actions
Unit - Remove Hero from the game
Dialog - Create a dialog button for Dialog labelled Continue
Set DialogButton[1] = (Last created dialog Button)
Else - Actions
-------- ---------------------------------------------------------- --------
Game Cache - Create a game cache from roti01.w3v
Game Cache - Restore Kael of Heroes from (Last created game cache) for Player 1 (Red) at (Center of (Playable map area)) facing 0.00
Set Hero = (Last restored unit)
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Hero Not equal to No unit
Collapse Then - Actions
Unit - Remove Hero from the game
Dialog - Create a dialog button for Dialog labelled (Save 01: + (Location + ( - + Time)))
Set DialogButton[2] = (Last created dialog Button)
Else - Actions
-------- ---------------------------------------------------------- --------
Game Cache - Create a game cache from roti02.w3v
Game Cache - Restore Kael of Heroes from (Last created game cache) for Player 1 (Red) at (Center of (Playable map area)) facing 0.00
Set Hero = (Last restored unit)
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Hero Not equal to No unit
Collapse Then - Actions
Unit - Remove Hero from the game
Dialog - Create a dialog button for Dialog labelled (Save 02: + (Location + ( - + Time)))
Set DialogButton[3] = (Last created dialog Button)
Else - Actions
-------- ---------------------------------------------------------- --------
Game Cache - Create a game cache from roti03.w3v
Game Cache - Restore Kael of Heroes from (Last created game cache) for Player 1 (Red) at (Center of (Playable map area)) facing 0.00
Set Hero = (Last restored unit)
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Hero Not equal to No unit
Collapse Then - Actions
Unit - Remove Hero from the game
Dialog - Create a dialog button for Dialog labelled (Save 03: + (Location + ( - + Time)))
Set DialogButton[4] = (Last created dialog Button)
Else - Actions
-------- ---------------------------------------------------------- --------
Dialog - Show Dialog for Player 1 (Red)
Attached Files
File Type: w3n RotI.w3n (62.7 KB, 5 views)

Last edited by sPyRaLz : 07-13-2010 at 04:37 PM. Reason: Added Attachment
sPyRaLz is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 07-13-2010, 05:40 PM   #2
Tot
6
 
Tot's Avatar
 
Join Date: Oct 2008
Posts: 841

Tot will become famous soon enough (53)Tot will become famous soon enough (53)

Default

try
Collapse JASS:
scope Menu initializer Init
    globals
        public button array ba[5]
    endglobals

    private function Actions takes nothing returns nothing
        local unit h = null
        local dialog d
        local gamecache gc = null
        local location l = GetRectCenter(GetPlayableMapRect())
        call DestroyTimer(GetExpiredTimer())
        call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "Main")
        call DialogSetMessage(d, "Main Menu")
        set ba[0] = DialogAddButton(d, "New Game",0)
        // ----------------------------------------------------------
        set gc = InitGameCache("roti00.w3v")
        set h = RestoreUnit(gc, "Heroes", "Kael", Player(0), GetLocationX(l), GetLocationY(l), 0)
        if ( h != null ) then
            call RemoveUnit( h )
            set ba[1] = DialogAddButton(d, "Autosave: " + "Location" + " - " + "Time",0)
        endif
        // ----------------------------------------------------------
        set gc = InitGameCache("roti01.w3v")
        set h = RestoreUnit(gc, "Heroes", "Kael", Player(0), GetLocationX(l), GetLocationY(l), 0)
        if ( h != null ) then
            call RemoveUnit( h )
            set ba[2] = DialogAddButton(d, "Save 01: " + "Location" + " - " + "Time",0)
        endif
        // ----------------------------------------------------------
        set gc = InitGameCache("roti02.w3v")
        set h = RestoreUnit(gc, "Heroes", "Kael", Player(0), GetLocationX(l), GetLocationY(l), 0)
        if ( h != null ) then
            call RemoveUnit( h )
            set ba[3] = DialogAddButton(d, "Save 02: " + "Location" + " - " + "Time",0)
        endif
        // ----------------------------------------------------------
        set gc = InitGameCache("roti03.w3v")
        set h = RestoreUnit(gc, "Heroes", "Kael", Player(0), GetLocationX(l), GetLocationY(l), 0)
        if ( h != null ) then
            call RemoveUnit( h )
            set ba[4] = DialogAddButton(d, "Save 03: " + "Location" + " - " + "Time",0)
        endif
        // ----------------------------------------------------------
        call DialogDisplay(Player(0), d, true)
    endfunction
//===========================================================================
    private function Init takes nothing returns nothing
        call TimerStart(CreateTimer(),0.01,fale,function Actions)
    endfunction
endscope

the timer waits 'till the game actually starts...maybe this fixes your problem, cause dialogs can't be displayed on init and the scope's init-func is run during init.
__________________
Current Projects:
  • Masters Of WarCraft: Some mixture of AoS and RPG
    Terrain: 100%, Coding: 75%, Heroes: 0%, Items: 0%, Creeps: 0%, Upgrades: 0%
  • hunting emos
____________________________________
scheiss kack dreck sausacksau bundeswehr
Tot is offline   Reply With Quote
Old 07-14-2010, 02:00 PM   #3
sPyRaLz
User
 
Join Date: Aug 2003
Posts: 71

sPyRaLz is on a distinguished road (12)

Default

I just gave it a try, still the same bug. Game displays a blacks screen when i try to load the first map of the campaign. : (
I suspect its a problem with the campaign editor failing to compile the map.. When i compiled the map as a standalone, it worked.
I reimported the standalone, and it also worked.

Last edited by sPyRaLz : 07-14-2010 at 02:27 PM.
sPyRaLz is offline   Reply With Quote
Old 07-14-2010, 02:15 PM   #4
Fledermaus
default string
 
Fledermaus's Avatar
 
Join Date: May 2006
Posts: 617

Submissions (1)

Fledermaus has a spectacular aura about (144)

Send a message via MSN to Fledermaus
Default

Try change the initializer to Actions
Fledermaus is offline   Reply With Quote
Old 07-14-2010, 06:53 PM   #5
sPyRaLz
User
 
Join Date: Aug 2003
Posts: 71

sPyRaLz is on a distinguished road (12)

Default

Hm.. I'm pretty convinced that its an issue with the campaign editor, When i save my maps while they are opened via campaign editor, The compile time seems a little shorter. Scopes don't seem to be recognized. I have to compile separately then load the map to the campaign to get things working. Either ways, its lookin good. Thanks for the feedback!
sPyRaLz is offline   Reply With Quote
Old 07-15-2010, 12:15 AM   #6
Fledermaus
default string
 
Fledermaus's Avatar
 
Join Date: May 2006
Posts: 617

Submissions (1)

Fledermaus has a spectacular aura about (144)

Send a message via MSN to Fledermaus
Default

Oh yeah, there's something about JNGP not working well with Campaigns I think.
Fledermaus is offline   Reply With Quote
Old 07-15-2010, 08:26 PM   #7
Bribe
User
 
Bribe's Avatar
 
Join Date: Mar 2010
Posts: 230

Submissions (1)

Bribe will become famous soon enough (26)

Send a message via AIM to Bribe
Default

You have to save the map outside of the campaign in JNGP, then re-import the map back into the campaign. The use of 3rd party programs like JEdit or NotePad++ helps a lot in situations like this.

Last edited by Bribe : 07-15-2010 at 08:26 PM.
Bribe is offline   Reply With Quote
Old 07-16-2010, 04:04 AM   #8
sPyRaLz
User
 
Join Date: Aug 2003
Posts: 71

sPyRaLz is on a distinguished road (12)

Default

Quote:
Originally Posted by Bribe
You have to save the map outside of the campaign in JNGP, then re-import the map back into the campaign. The use of 3rd party programs like JEdit or NotePad++ helps a lot in situations like this.

Thanks for verifying that. I've never used those before. Are they able to compile? Or do they just help you check your syntax errors and stuff? If they can't compile I don't see how it makes any difference as I still have to port the map into the campaign 1 way or another.
sPyRaLz is offline   Reply With Quote
Old 07-16-2010, 04:53 AM   #9
Bribe
User
 
Bribe's Avatar
 
Join Date: Mar 2010
Posts: 230

Submissions (1)

Bribe will become famous soon enough (26)

Send a message via AIM to Bribe
Default

They provide syntax highlighting.

To be perfectly honest, I do about 0.001% of my work in the actual editor (pretty much for debugging or choosing special effects) and the rest I do in JEdit.
Bribe is offline   Reply With Quote
Old 07-16-2010, 01:16 PM   #10
YourName
User
 
Join Date: Jan 2007
Posts: 101

YourName has little to show at this moment (7)

Default

Quote:
Originally Posted by Bribe
They provide syntax highlighting.

To be perfectly honest, I do about 0.001% of my work in the actual editor (pretty much for debugging or choosing special effects) and the rest I do in JEdit.
Eww. I just can't understand why people code outside of the editor. I regularly test my code whenever I write something to keep the problems as small as possible.
__________________
--YourNameHere
YourName is offline   Reply With Quote
Old 07-16-2010, 04:31 PM   #11
Bribe
User
 
Bribe's Avatar
 
Join Date: Mar 2010
Posts: 230

Submissions (1)

Bribe will become famous soon enough (26)

Send a message via AIM to Bribe
Default

I average about 1 syntax error for every 150 lines, not worried about that.
Bribe is offline   Reply With Quote
Old 07-16-2010, 05:42 PM   #12
sPyRaLz
User
 
Join Date: Aug 2003
Posts: 71

sPyRaLz is on a distinguished road (12)

Default

Quote:
Originally Posted by YourName
Eww. I just can't understand why people code outside of the editor. I regularly test my code whenever I write something to keep the problems as small as possible.

Ditto to that. Programming huge text of code without regular testing intervals messes me up real bad. I find its much harder to track down bugs that don't spit out any error messages.
sPyRaLz is offline   Reply With Quote
Old 07-16-2010, 05:55 PM   #13
Bribe
User
 
Bribe's Avatar
 
Join Date: Mar 2010
Posts: 230

Submissions (1)

Bribe will become famous soon enough (26)

Send a message via AIM to Bribe
Default

Open/Save/Close time in sessions is sped up an average of 58,000 %

When you're coding large amounts of script in order to implement features and framework, there's nothing you need more than fast coding. JEdit line-splitting, rectangular selection, syntax highlighting, find & replace blows NewGen out off the face of the earth.

Notepad ++ smart highlighting is amazing.
Bribe is offline   Reply With Quote
Old 07-16-2010, 06:22 PM   #14
YourName
User
 
Join Date: Jan 2007
Posts: 101

YourName has little to show at this moment (7)

Default

It's about testing your stuff ingame regularly, not writing 1000 lines of code outside of the game and afterwards track down each bug you might find.
__________________
--YourNameHere
YourName is offline   Reply With Quote
Old 07-16-2010, 07:21 PM   #15
Bribe
User
 
Bribe's Avatar
 
Join Date: Mar 2010
Posts: 230

Submissions (1)

Bribe will become famous soon enough (26)

Send a message via AIM to Bribe
Default

I'll concede everyone codes differently. This is an example of a system where 99.99% of the work was done in Notepad++ and JEdit. The slow speed and lack of features in NewGen aggrivates me, so I prefer to do it this way.
Bribe 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:16 PM.


Donate

Affiliates
The Hubb http://bylur.com - Warcraft, StarCraft, Diablo and DotA Blog & Forums The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

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