Archived copy of war3source.com, the War3Source forum (2009–2020), rebuilt from the Internet Archive by wc3mods.net. This page was captured on 2016-08-04 (original capture). Forum · All archived topics · Wiki · Bug tracker · Blog

Author Topic: How are multiple calls to the same event handled?  (Read 868 times)

Remy Lebeau

  • Sr. Member
  • ****
  • Posts: 488
    • View Profile
    • Seven Sins Gaming
How are multiple calls to the same event handled?
« on: July 30, 2014, 09:32:52 PM »
In war3source_addon_xpmultiplier the OnPreGiveXPGold event is modified as such:

Code: [Select]
public OnWar3Event(W3EVENT:event,client)
{
    if(event==OnPreGiveXPGold)
    {
        W3SetVar(EventArg2,FloatMul(W3GetVar(EventArg2),GetConVarFloat(MultiplierCVars[0])));
        W3SetVar(EventArg3,FloatMul(W3GetVar(EventArg3),GetConVarFloat(MultiplierCVars[1])));
    }
}

I have a race that has built into it an XP cap (since the race has 1200 levels), the code for which is:

Code: [Select]

public OnWar3Event(W3EVENT:event,client)
{
    if(event==OnPreGiveXPGold && g_bKilledTimewaster[client] == true )
    {
        PrintToChat(client, "Normal XP |%d|",W3GetVar(EventArg2));
        W3SetVar(EventArg2,FloatDiv(W3GetVar(EventArg2),5.0));
        PrintToChat(client, "Modified XP |%d|",W3GetVar(EventArg2));
        g_bKilledTimewaster[client] = false;
    }
}

In the past this has seemed to work fine.  However we have changed the XP multiplier for a few weeks, and since I've done that it seems to be playing up as to whether the cap is enforced or not...  How does the system determine which of the two functions to use?  Is there a conflict between them such that it will only call one of them?

STEAM PROFILE

NEW CS:GO SERVER:

Ownz

  • Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2428
  • chmod -R 777 *
    • View Profile
    • OwnageClan
Re: How are multiple calls to the same event handled?
« Reply #1 on: July 30, 2014, 09:49:21 PM »
all plugins that implement the forward will be called, but no guarantee of order across loads or platforms

if its a float, shouldn't it be %f?

Remy Lebeau

  • Sr. Member
  • ****
  • Posts: 488
    • View Profile
    • Seven Sins Gaming
Re: How are multiple calls to the same event handled?
« Reply #2 on: August 08, 2014, 05:26:42 PM »
Cheers, that's a helpful suggestion - I hadn't thought about tightening up the rounding / var type issues.
STEAM PROFILE

NEW CS:GO SERVER:

Ownz

  • Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2428
  • chmod -R 777 *
    • View Profile
    • OwnageClan
Re: How are multiple calls to the same event handled?
« Reply #3 on: August 09, 2014, 08:57:33 AM »
sourcepawn always had issues with typing floats, sometimes u just had to make it explict, or force a FloatMul instead of just * for multiplication