[QUE] Object 0..5 has no method 'split'

Now i have real problem, this is my source code

http://pastebin.com/KxThtsNB

And when i start new game or whatever in GDT it spits the error i mentioned in the title. It seems that problem is with

var company = GameManager.company;

cuz i need this split method to shows the notification immediately in option 0. Can someone review the code and see what is wrong? I cant find the issue, everything seems to be written correctly. Thanks in advance for help.

edit there is an error in the code instead of n.addjustCash should be m.addjustCash its just a type but it does not change anything with an error.

date should be a string, not a number. turn 1/2/1 into '1/2/1'. the next thing you will notice is that when the event fires there is likely no game in development so accessing game.title will error out. Seems from the text that it doesn’t make sense to use a game title anyway but if you want to do that then you should check some of the example events, particularly the trigger methods.

haha now i have an error "Cannot read property ‘title’ of undefined so i guess this is a problem with .localize().format(game.title);

Meh i dont like to debug it like that to bad there is no compiler or sth for javascript :smile:, when i use this How To debugging method i see no useful info for me.

see my edit… was just typing that.

debugging is really quite straight forward:

http://forum.greenheartgames.com/t/howto-debug-game-dev-tycoon/8847

once you have it open you can easily go through the errors (bottom right corner) and see where exactly they occur.

Ok that make sense now :)…im a lazy man and i like a compiler to thorw the stack trace :)…and this is my first time with javascript, im mostly c++ programmer :grin:

It takes a lot to get used to JavaScript but once you are over some oddities it’s a surprisingly powerful language.

Is there any way to delay the notification? I know it is added to an array (on stack :D), but since the stack at the start of the game is empty my notifications pops immediately and it make no sense especially in “Sponsorship” case :). There might be some trick to add empty notifications or etc, but i don’t want to start with that if it doesnt work like that :smiley:

you set the date yourself so that’s why it fires on ‘1/2/1’. You can either change the date to be later or define a custom trigger function on the event where you can control precisely when this event will trigger. I recommend you take a look at the event example in modAPI where I use this technique to make sure that the event only triggers when a game is in development.

It is not what i was asking for but doesn’t matter :D, thanks for help.

i was asking about the complete: section when we pop notifications based on our decisions etc., not the overall start of the event :slight_smile: