[Log in / Register]
| News | Chat | Pastebin | Donations | Tutorials | Rules | Forums | Starcraft II |
| Maps | Skins | Icons | Models | Spells | Tools | Jass | Packs |
(Keeps Hive Alive)
Go Back   The Hive Workshop > Warcraft III Resources > JASS Functions

JASS Functions Approved JASS functions will be located here.
Remember to submit your own resources to the submission forum.

Reply
 
LinkBack Thread Tools
Old 02-05-2010, 09:08 PM   #1 (permalink)
Forum Moderator TriggerHappy
 
TriggerHappy's Avatar
Development Moderator
 
Join Date: Jun 2007
Posts: 1,202
TriggerHappy is a name known to all (602)
PayPal Donor: This user has donated at least $20 to The Hive. Zephyr Challenge #6 - Winner: Dune Worm 
PreventSave

Introduction
This library is simple enough. It allows you to enable or disabled game saving. It works by showing a dialog instantly before a game is saved. This closes the save screen therefor the game is never actually saved. Nothing visually happens to the game except for maybe a quick open and close of the save dialog, though it's hardly noticeable.

This even works in single player surprisngly without pausing the game which usually happens when a dialog is opened offline. You can toggle allowing or disallowing saving by setting GameAllowSave to true, or false.
Code

Jass:
//====================================
// PreventSave
//====================================
//
//   This library is simple enough. It allows you to enable or
//   disabled game saving. It works by showing a dialog instantly
//   before a game is saved. This closes the save screen therefor
//   the game is never actually saved.
//
//   Nothing visually happens to the game except for maybe a quick open
//   and close of the save dialog, though it's hardly noticeable.
//   This even works in single player surprisngly without pausing the game
//   which usually happens when a dialog is opened offline.
//
//   You can toggle allowing or disallowing saving by setting
//   GameAllowSave to true, or false.
//
//====================================
// Import Instructions
//====================================
//
//   1. Copy this entire script.
//   2. Create a new trigger in your trigger
//      editor and convert it to Jass.
//   3. Paste this in there and save the map.
//
//      This requires JassHelper which is included
//      in JassNewGenPack.
//
//====================================

library PreventSave initializer onInit
    
    globals
        boolean GameAllowSave = false
    endglobals
    
//====================================
// Do not edit below this line
//====================================
    
    globals
        private dialog D = DialogCreate()
        private timer T  = CreateTimer()
        private player p
    endglobals
    
    private function Exit takes nothing returns nothing
        call DialogDisplay(p, D, false)
    endfunction
    
    private function StopSave takes nothing returns nothing
        if not GameAllowSave then
            call DialogDisplay(p, D, true)
            call TimerStart(T, 0.00, false, function Exit)
        endif
    endfunction
    
    private function onInit takes nothing returns nothing
        local trigger t = CreateTrigger()
        call TriggerRegisterGameEvent(t, EVENT_GAME_SAVE)
        call TriggerAddAction(t, function StopSave)
        set p = GetLocalPlayer()
    endfunction

endlibrary
__________________

♥ Moderator since 10-04-2009 ♥

Spending all my money on dope and extreme high price tickets. But in the end, it's all worth it.
I like to live in my own world. I'm told to enjoy every moment, every hour, every minute.
Why should I take life so seriously? I just want to do what I like to do. Be far from reality, because I can't stand society.

It's my own world. I just want to hear the music.

Last edited by TriggerHappy; 02-06-2010 at 08:35 PM.
TriggerHappy is online now   Reply With Quote
Old 02-05-2010, 09:33 PM   #2 (permalink)
Forum Moderator azlier
Made of explodium
JASS Moderator
 
Join Date: Oct 2008
Posts: 277
azlier is on a distinguished road (86)azlier is on a distinguished road (86)
Efficient, and well tested. I myself can verify that it works on both single player and online.

Approved.
azlier is offline   Reply With Quote
Old 02-06-2010, 01:55 AM   #3 (permalink)
Registered User Mooglefrooglian
The Untitled... wait...
 
Mooglefrooglian's Avatar
 
Join Date: Nov 2008
Posts: 644
Mooglefrooglian has little to show at this moment (53)
Every map should have an option to use this, to prevent laming.

Thank you!

Edit: Wait... why are you setting a global variable to GetLocalPlayer()? I'm pretty sure that desyncs.

Jass:
library PreventSave initializer onInit

    globals
        boolean GameAllowSave = false
    endglobals

//====================================
// Do not edit below this line
//====================================

    globals
        private dialog D = DialogCreate()
        private timer T = CreateTimer()
    endglobals

    private function Exit takes nothing returns nothing
        call DialogDisplay(GetLocalPlayer(), D, false)
    endfunction

    private function StopSave takes nothing returns nothing
        if not GameAllowSave then
            call DialogDisplay(GetLocalPlayer(), D, true)
            call TimerStart(T, 0.00, false, function Exit)
        endif
    endfunction

    private function onInit takes nothing returns nothing
        local trigger t = CreateTrigger()
        call TriggerRegisterGameEvent(t, EVENT_GAME_SAVE)
        call TriggerAddAction(t, function StopSave)
    endfunction

endlibrary

Shouldnt it be like that?

Last edited by TriggerHappy; 02-06-2010 at 08:36 PM.
Mooglefrooglian is offline   Reply With Quote
Old 02-06-2010, 03:45 AM   #4 (permalink)
Forum Moderator azlier
Made of explodium
JASS Moderator
 
Join Date: Oct 2008
Posts: 277
azlier is on a distinguished road (86)azlier is on a distinguished road (86)
No. Setting a global to the local player works just fine.
azlier is offline   Reply With Quote
Old 02-10-2010, 01:05 AM   #5 (permalink)
Registered User Mooglefrooglian
The Untitled... wait...
 
Mooglefrooglian's Avatar
 
Join Date: Nov 2008
Posts: 644
Mooglefrooglian has little to show at this moment (53)
But dont globals sync, and having them different cause a desync?

Is it just when you try to use that data?
Mooglefrooglian is offline   Reply With Quote
Old 02-10-2010, 02:58 AM   #6 (permalink)
Forum Moderator azlier
Made of explodium
JASS Moderator
 
Join Date: Oct 2008
Posts: 277
azlier is on a distinguished road (86)azlier is on a distinguished road (86)
Globals are not synced.
azlier is offline   Reply With Quote
Old 02-10-2010, 07:44 PM   #7 (permalink)
Registered User kennyman94
User
 
Join Date: Nov 2009
Posts: 181
kennyman94 has little to show at this moment (10)kennyman94 has little to show at this moment (10)
I have no clue about what you guys are talking about but what version of jass is this for?
kennyman94 is offline   Reply With Quote
Old 02-10-2010, 07:46 PM   #8 (permalink)
Forum Moderator TriggerHappy
 
TriggerHappy's Avatar
Development Moderator
 
Join Date: Jun 2007
Posts: 1,202
TriggerHappy is a name known to all (602)
PayPal Donor: This user has donated at least $20 to The Hive. Zephyr Challenge #6 - Winner: Dune Worm 
Do you mean vJass? Blizzard doesn't give Jass patch versions it's just Jass2. If you do mean vJass, just get the newest Jasshelper or download the GUI one in the spells section (check my profile).
__________________

♥ Moderator since 10-04-2009 ♥

Spending all my money on dope and extreme high price tickets. But in the end, it's all worth it.
I like to live in my own world. I'm told to enjoy every moment, every hour, every minute.
Why should I take life so seriously? I just want to do what I like to do. Be far from reality, because I can't stand society.

It's my own world. I just want to hear the music.
TriggerHappy is online now   Reply With Quote
Old 02-10-2010, 07:59 PM   #9 (permalink)
Registered User kennyman94
User
 
Join Date: Nov 2009
Posts: 181
kennyman94 has little to show at this moment (10)kennyman94 has little to show at this moment (10)
I mean like i just got JNGP and i dont know if different editor versions use different forms of jass.
kennyman94 is offline   Reply With Quote
Old 02-12-2010, 04:38 PM   #10 (permalink)
Registered User cookies4you
Mr. Stuck In Time Loop
 
cookies4you's Avatar
 
Join Date: May 2009
Posts: 566
cookies4you has little to show at this moment (50)
finally! i've been looking for something to prevent this! finally! a way to stop seekers from saving and exploiting moving props!
cookies4you is offline   Reply With Quote
Old 03-26-2010, 01:54 PM   #11 (permalink)
Registered User Fanny.Shaver
Vamp Zero God
 
Fanny.Shaver's Avatar
 
Join Date: Oct 2009
Posts: 165
Fanny.Shaver has little to show at this moment (1)
Taken from TheHelper and not even given credits...
__________________
Size is Relative, Energy is Absolute.
Pain is Temporary, Losing is Forever.
Massive Pain is Relatively Short, Powerful Losing is Absolutely Forever.

Vampirism Zero Pro

Site about me
Fanny.Shaver is offline   Reply With Quote
Old 03-26-2010, 02:34 PM   #12 (permalink)
Registered User dead-man-walking
Why so serious?
 
dead-man-walking's Avatar
 
Join Date: Nov 2009
Posts: 1,418
dead-man-walking is a jewel in the rough (154)
Er.... Proof?
__________________
BBCodes|THW Chat|HIVE'S RULES|Art Gallery||
"Ash, for the last time, we don't have harpoons. Harpoons are for lazy asses.
Real men fight with kitchen knives, even in ship-to-ship combat." ~ WILL THE ALMIGHTY
dead-man-walking is offline   Reply With Quote
Old 03-26-2010, 03:29 PM   #13 (permalink)
Registered User Weep
User
 
Join Date: Jul 2009
Posts: 104
Weep has little to show at this moment (47)Weep has little to show at this moment (47)Weep has little to show at this moment (47)Weep has little to show at this moment (47)Weep has little to show at this moment (47)
Quote:
Originally Posted by Fanny.Shaver View Post
Taken from TheHelper and not even given credits...
Wrong - this was posted by its author.

Why is there no facepalm emote?
Weep is offline   Reply With Quote
Old 03-29-2010, 02:24 PM   #14 (permalink)
Registered User Fanny.Shaver
Vamp Zero God
 
Fanny.Shaver's Avatar
 
Join Date: Oct 2009
Posts: 165
Fanny.Shaver has little to show at this moment (1)
Quote:
Originally Posted by dead-man-walking View Post
Er.... Proof?
Proof, is that I have it on my map for about six months...

@up

Well, I knew someone did that on thehelper, didn't knew who did. Strange that long later in here. Honors back.
__________________
Size is Relative, Energy is Absolute.
Pain is Temporary, Losing is Forever.
Massive Pain is Relatively Short, Powerful Losing is Absolutely Forever.

Vampirism Zero Pro

Site about me
Fanny.Shaver is offline   Reply With Quote
Reply

Bookmarks

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 09:13 PM.





Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.1
Copyright©Ralle