User Tag List

Results 1 to 3 of 3

Thread: Problem with custom WorldScript event causing core to crash

  1. #1
    Mad Scientist <span style='color: #008000'><span class='glow_006400'>slp13at420</span></span>'s Avatar



    Join Date
    Dec 2013
    Location
    Idaho
    Posts
    2,484
    XP
    20,134,707
    Level
    500
    Thanks
    1,087
    Thanked 329 Times in 211 Posts

    Problem with custom WorldScript event causing core to crash

    So I Cloned a fresh copy of -> https://github.com/ElunaLuaEngine/ElunaTrinityWotlk
    TrinityCore rev. da3b1486661f+ 2016-09-21

    I added 1 custom script. no custom edits.
    Then started receiving errors as posted in this thread -> http://emudevs.com/showthread.php/59...st-trinityCore
    So I updated all the Gossip Methods as @Tommy did with his tut's and then the errors cleared and the project compiled complete with 0 errors.

    I startup the world and it updates the DB fine. gets to the very end and even belches out:

    World initialized in 0 minutes 22 seconds
    TrinityCore rev. da3b1486661f+ 2016-09-21 22:49:05 +0300 (master branch) (Win32, Release, Static) (worldserver-daemon) ready...
    But then it crashes with this posted to the console:

    ScriptMgr.cpp:922 in SpecializedScriptRegistry(class WorldScript,0)::AddScript ASSERTION FAILED:
    !sScriptMgr->GetCurrentScriptContext().empty() Tried to register a script without being in a valid script context!
    So my custom script has 2 WorldScript's so I `remarked` them out and recompiled and restarted fine. this time no error like above. so with trial and error I narrowed it down to a WorldScript Event block:
    Code:
    
    class GGW_RankTimer : public WorldScript
    {
    public:
    	GGW_RankTimer() : WorldScript("GGW_RankTimer")
    	{
    		events.ScheduleEvent(1, GUILDWARZ_RANKING_TIMER);
    	};
    
    	void OnUpdate(uint32 diff) override
    	{
    		events.Update(diff);
    
    		uint8 id = events.ExecuteEvent();
    
    		if (rank_binary_ticker == true)
    			rank_binary_ticker = false;
    		else
    		{
    			switch (id)
    			{
    			case 1:
    				events.CancelEvent(1);
    				CreateRankList();
    				new GGW_RankTimer();
    				rank_binary_ticker = true;
    				break;
    			};
    		};
    	};
    
    EventMap events;
    };
    
    I narrowed it down to this event causing the crash:
    Code:
    
    	void OnUpdate(uint32 diff) override
    	{
    		events.Update(diff);
    
    		uint8 id = events.ExecuteEvent();
    
    		if (rank_binary_ticker == true)
    			rank_binary_ticker = false;
    		else
    		{
    			switch (id)
    			{
    			case 1:
    				events.CancelEvent(1);
    				CreateRankList();
    				new GGW_RankTimer();
    				rank_binary_ticker = true;
    				break;
    			};
    		};
    	};
    
    i'm just not finding anything with a standalone timed event like this to compare to.
    any ideas?
    Achievements:
    Shopper Got a Sticky! Member 1 year registered Level XL Level D
    Awards:
    Pot Head LOL Raffle Winner Top Tagger Donator Hangman Scripter Repacker Drunk Support Member of Staff Da Bomb!
    "Cuz PvP's better with a bag 'o' weed"
    !! King Spade !!

    -Guild Plot System-
    Grumbo'z Guild Warz


    -VIP System-
    Grumbo'z VIP System

  2. #2
    Moderator / Eluna Dev <span style='color: #FF0000'><span class='glow_8B0000'>Rochet2</span></span>'s Avatar
    Join Date
    Apr 2013
    Location
    Finland
    Posts
    1,859
    XP
    13,487
    Level
    35
    Thanks
    95
    Thanked 591 Times in 418 Posts
    new GGW_RankTimer();
    This is what crashes.
    Why do you do this?

    If you need to call events.ScheduleEvent(1, GUILDWARZ_RANKING_TIMER);
    again, then make a function and call that in the constructor and in where you need to call it again.
    Awards:
    Support LOL Scripter Facepalm! Raffle Winner
    rochet2.github.io - Home of great codes

  3. The Following User Says Thank You to Rochet2 For This Useful Post:


  4. #3
    Original Poster
    Mad Scientist <span style='color: #008000'><span class='glow_006400'>slp13at420</span></span>'s Avatar



    Join Date
    Dec 2013
    Location
    Idaho
    Posts
    2,484
    XP
    20,134,707
    Level
    500
    Thanks
    1,087
    Thanked 329 Times in 211 Posts
    Quote Originally Posted by Rochet2 View Post
    new GGW_RankTimer();
    This is what crashes.
    Why do you do this?

    If you need to call events.ScheduleEvent(1, GUILDWARZ_RANKING_TIMER);
    again, then make a function and call that in the constructor and in where you need to call it again.
    ugh lol yea tnx good eye , dunno what I was thinking there lol
    Code:
    
    if (GUILDWARZ_RANK_TYPE < 2) { events.ScheduleEvent(1, GUILDWARZ_RANKING_TIMER); };
    
    and then I fixed the error by re adding `#include "ScriptMgr.h"`
    Achievements:
    Shopper Got a Sticky! Member 1 year registered Level XL Level D
    Awards:
    Pot Head LOL Raffle Winner Top Tagger Donator Hangman Scripter Repacker Drunk Support Member of Staff Da Bomb!
    "Cuz PvP's better with a bag 'o' weed"
    !! King Spade !!

    -Guild Plot System-
    Grumbo'z Guild Warz


    -VIP System-
    Grumbo'z VIP System

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •