Spin Khan

Using _addTemplateToast

5 posts in this topic

Searching here brings little on using the newest notification system but I'm trying to use this line,

["InfoTitleAndText", ["This is my Title Text!", "This is my simple message"]] call ExileClient_gui_toaster_addTemplateToast;

Which I took simply from,

["InfoTitleAndText", ["Incoming party invite!", format ["You have been invited to join the party '%1'. Use your XM8 party app to respond.", _groupName]]] call ExileClient_gui_toaster_addTemplateToast;

but it leads to a plethora of errors,

File exile_client\code\ExileClient_gui_toaster_addToast.sqf, line 52
23:38:51 Error in expression <, _status, _statusChangeAt]];
}
forEach ExileClientToasts;>
23:38:51   Error position: <ExileClientToasts;>
23:38:51   Error Undefined variable in expression: exileclienttoasts
23:38:51 File exile_client\code\ExileClient_gui_toaster_pushToBottom.sqf, line 40
23:38:51 Error in expression <ePosition"];
disableSerialization;
if !(ExileClientToastAreaVisible) exitWith { >
23:38:51   Error position: <ExileClientToastAreaVisible) exitWith { >
23:38:51   Error Undefined variable in expression: exileclienttoastareavisible
23:38:51 File exile_client\code\ExileClient_gui_toaster_addToast.sqf, line 14

 

Obvious the Party Invite example works, so I'm thinking... well I don't know what to think.  For context this is being run in the callback for a ExileClient_system_thread_addtask;  

It surely sounds like I've got a scoping problem here but I'm not versed enough yet in the internals to see it.  Any thoughts? 

 

TIA

 

Share this post


Link to post
Share on other sites
Advertisement

As I said, it's being called from the callback to an ExileClient_system_thread_addtask(), which works fine btw, except for this call to send the client a toast message. 

Now the callback chain initiates from initServer, in which all the default exile stuff is handled and I add the thread task at the end.

Interestingly,

["toastRequest", ["InfoTitleAndText", ["This is my Title Text!", "This is my simple message"]]] call ExileServer_system_network_send_broadcast;

works perfectly but I was concerned with sending a message back to the server to broadcast back out to the client so I tried just staying with the client and having it display its own message.  Hence my attempt to use the ExileClient_...() function.

Share this post


Link to post
Share on other sites
On 16.2.2018 at 7:03 AM, Spin Khan said:

newest notification system

That would be the baguettes not the toasts :)

arma3_x64_2017-05-18_21-40-01.png

///////////////////////////////
// Server side usage
///////////////////////////////

// Broadcasting a messsage
["baguetteRequest", [format["Server is going to restart in %1 min!",_time]]] call ExileServer_system_network_send_broadcast;

// Sending to a certain client
[_sessionID, "baguetteRequest", ["Welcome to Exile, Inmate!"]] call ExileServer_system_network_send_to;

///////////////////////////////
// Client side usage
///////////////////////////////

// You MUST spawn the function, calls DO NOT WORK
["Welcome! God mode enabled."] spawn ExileClient_gui_baguette_show;

That might help, if lookin into toast usage:

 

Could you put up the whole modified code, so we get a feeling what you tryin exactly. Cheers

Edited by WURSTKETTE

Share this post


Link to post
Share on other sites

I'm still trying to get my head around the difference between baguettes and toast.  Are there any cannolis?

Given the size and look of the message, seems to me I like the toast idea better, this is more a simple update message to the client.

As far as the code goes, I don't know how much seeing what I've got in script is any more helpful than what I've written it's really small as its just a proofing framework at the moment.  Still I'll paste it below.  At the moment, I'm just trying to get a message to the client every minute.  Which as I said, works when I use the call to ExileServer....send_broadcast; but not when I use ExileClient.. addTemplateToast;  I think my problem is that I'm still a bit foggy on the boundaries between some of the distinct subsystems.  For example, the problem may be that the timer is going off within the context of the server and I'm not using or creating the proper context for the call to the ExileClient... service.   Again, using the server broadcast works, and this may be the way I need to do this but I DID read that thread to which you referred and it was what made me think I needed to use toasts as I thought they were the "new" system replacing baguettes, but I'm not yet clear on these matters.

But, now I'm thinking I do need to keep this in a server context, I have a related question.  How can I put each player's name in the message.  Say I wanted each player's message to be addressed to them directly, like,

"Bob, This is my message tickle, tickle"

Seems to me the server context is the right place, what's the best way to get the player name and send a custom message to that player, to each player inside the timing loop.  Any additional thoughts on that are appreciated.  TIA.

At the end of initServer.sqf

[] spawn {
  TIMEOF_NEXT_NOTIFICATION = 0;
  _code = {
    _this_time = time;
    if(_this_time > TIMEOF_NEXT_NOTIFICATION)then {
      _timetostart = 60;
      if(time > _timetostart)then {


      ["toastRequest", ["InfoTitleAndText", ["Message Title", "My Message Tickle Tickle"]]] call ExileServer_system_network_send_broadcast;    
      //["InfoTitleAndText", ["Message Title", "My Message Tickle Tickle"]] call ExileClient_gui_toaster_addTemplateToast; 
      //["My Message Tickle Tickle"] spawn ExileClient_gui_baguette_show;

      TIMEOF_NEXT_NOTIFICATION = time + 60;
    }; // if time to show
  }; // code
  msgthreadid = [0.5, _code, [], true] call ExileClient_system_thread_addtask;
};

 

 

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.