Understanding this code in torquescript

55 views Asked by At

I'm trying to understand how this piece of code works:

in the .cs file, these lines appear first :

addTooltipTemplate("tooltipInventory", 666, "createAlchemyTooltip");
addTooltipTemplate("tooltipInventory", 669, "createAlchemyTooltip");
addTooltipTemplate("tooltipInventory", 529, "createAlchemyTooltip");

Shortly followed by this :

function createAlchemyTooltip(%informer)
{
echo("createAlchemyTooltip");
createBaseTooltip();
createObjectsTypesName(%informer);
createItemsQQW(%informer);

%pnl = createVerticalStackControl();
%pnl.padding = 0;
TooltipMainControl.add(%pnl);

%textCtrl = createTextCtrl("GuiGrayTextTooltipProfile");
%textCtrl.setText(GetMessageIDText(2561) @ ":");
%pnl.add(%textCtrl);

%index = 0;
for(%index = 0; %index < 3; %index++)
{
    %effect = %informer.getDataByIndex("objects_types", "Effect", %index);
    if (%effect !$= "")
    {
        %positive = %informer.getDataByIndex("objects_types", "EffectPositive", %index);
        createEffectCtrl(%pnl, %effect, 0, %positive);
    }
}

addItemDescription(%informer);

}

In a database, there as a column called "AlchemyHash" which has data in it that looks like this

0x2A1503003D2522143A092D172E0D0E071224100B37192F0A29231E31111B0205280C2C163F32404133062B20361D0F1C38013E353B3404083C27211830391A26131F090500040B060201030A08070B040A060501030700020908

which is someway translated into the code above to decide which of 66 herbs gets a certain tooltip.

Can anyone think how this could be done?

0

There are 0 answers