var announcePacks = {
id: packid,
date: '23/7/3',
ignoreGameLengthModifier: false,
getNotification: function (company) {
return new Notification({
sourceId: packid,
header: "Unknown PM".localize("heading"),
text: "Hello. After some years of hard work, we, some professional fans who happen to have a Research lab, are finally glad to tell you that we are awarding you some research packs for your awesome games! These packs contain lots of different kinds of researches that you can use to your benefit.".localize()
});
},
complete: function(decision) {
if (decision === 0) {
dataStore.data.resPacksAnnounced = true
}
}
};
The complete: method isn’t triggering at all. If the default OK button is pressed, it doesn’t trigger. I have another notification like this, with multiple options, and it still doesn’t trigger.
Also, you are checking for a decision yet you do not provide any options for the player. I’m not sure if a notification with just an OK button will call the complete method.
I knew there was something really wrong in that code, but I couldn’t see it. That’s what I get for not touching javascript for ages, I guess. Also, correct me if I’m wrong, but complete only works with events, and that’s basically a notification. If not, I can’t see what effect the event has. Must be that I need glasses or something.
Also, correct me if I’m wrong, but complete only works with events, and that’s basically a notification. If not, I can’t see what effect the event has. Must be that I need glasses or something. BTW sorry for double post, but edit keeps telling me an error has occured for some reason, and I can’t edit my post…
as an event. I just forgot to add that piece of code. I have something almost similar, but it doesn’t seem to trigger it.
var dataStore = GDT.getDataStore("extendedgdtfire");
dataStore.data.pwAnnounceFunctionAnnouncedResetDATA2 = false;
var shortvar = dataStore.data.pwAnnounceFunctionAnnouncedResetDATA2;
//Notification
var id = "exGDT_pwAnnounceFunctionID.RESET.1.2.3";
var pwAnnounceFunctionRemadeReset = {
id: id,
date: '17/7/3',
isRandomEvent: false,
ignoreGameLengthModifier: false,
trigger: function (company) {
var company = GameManager.company;
return company.currentLevel == 4 && company.isLaterOrEqualThan(17,7,3);
},
getNotification: function (company) {
return new Notification({
sourceId: id,
header: "Gaming News".localize(),
text: "Dear Developers,\n from now on, you can contact us to release info about your in-progress games! To begin with, you must send an e-mail here: pixelware@support.gdt and we will grant you access to Private Messages.".localize(),
image: [exGDT_FireChaos.modPath + "/images/notifications/pixelwareUpdated.png"],
options: ["Accept", "Decline"]
});
},
complete: function (decision) {
var company = GameManager.company;
if (decision === 0) {
dataStore.data.pwAnnounceFunctionAnnouncedResetDATA2 = true;
console.log("First call reached. (pwAnnFunc)");
var n = new Notification({
header: "PixelWare PM".localize(),
text: "Thank you for participating in our program! And you were among other companies which replied immediately! We'll go on informing our fans about this."
});
return;
}
if (decision === 1) {
dataStore.data.pwAnnounceFunctionAnnouncedResetDATA2 = true;
console.log("First-2 call reached. (pwAnnFunc)");
var n = new Notification({
header: "PixelWare PM".localize(),
text: "You don't have to use it! We feel that you might use it someday, so here you go."
});
return;
}
}
}
GDT.addEvent(pwAnnounceFunctionRemadeReset);
This is a copy of the event but with options, and the full code. It’s the same thing, won’t work.
It once happened to me. I tried every debugging method I know but it couldn’t be fixed. But for some reason when I rewrote the code from scratch it didn’t happen. And it is worth noting that I was experimenting with events like yours: complex, multi-option and roughly the same style of coding.
Patrick, just a question, is it possible to create notifications which also have multiple options? (Notifications, not events) Because when I tried to do this the event wouldn’t appear altogether.
The main difference between a notification and a event is that the notification only shows a message, while the event allows for a callback to respond to a selected option.
A notification (not a event) with multiple options would be pointless, since you wouldn’t be able to respond to the options.
I copy pasted the example, and this one worked. and I found my problem. I didn’t use .localize() at the end of the text: value in the complete: method.
Hi Patrick, I’ve been trying to make my own simple mod based on examples.js. I am unable to get anything to trigger. I’ve even set isRandom: false, in examples.js, but it won’t show me any dialogues.
I simply made a package.json file for examples.js and moved the entire example package as is into the mods folder so it would launch as a mod. I set isRandom: false to force it to launch as soon as the first game is being developed, but nothing happens. I’m able to load the mod, but I don’t know if it’s working properly.