Skip to content

Commit 0272f97

Browse files
committed
Add F_MesItemInfo function to show item name with description link
also fix OldGlastHeim ITEMLINK display incorrectly
1 parent 51483b4 commit 0272f97

File tree

3 files changed

+28
-4
lines changed

3 files changed

+28
-4
lines changed

doc/script_commands.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1228,7 +1228,7 @@ you have to set it back to black unless you want all the rest of the text be in
12281228
that color:
12291229

12301230
mes("This is ^FF0000 red ^000000 and this is ^00FF00 green, ^000000 so.");
1231-
mes(callfunc("F_MesColor", C_BLUE) +"This message is now in BLUE");
1231+
mesf("%sThis message is now in BLUE.", F_MesColor(C_BLUE));
12321232

12331233
Notice that the text coloring is handled purely by the client. If you use
12341234
non-English characters, the color codes might get screwed if they stick to
@@ -1252,6 +1252,14 @@ This will allow you to visit 'Google' with the in-game browser using default dim
12521252

12531253
Clicking 'Bing!' will open the in-game browser using the specified dimensions. (800x600)
12541254

1255+
If you're using client from 2013-01-30 onwards, you can also use <ITEMLINK> to show
1256+
the item's description. Gravity changed this into <ITEM> since 2015-07-29 onwards.
1257+
1258+
mes("Bring me an <ITEM>Apple<INFO>512</INFO></ITEM>.");
1259+
mesf("Bring me an %s.", F_MesItemInfo(Apple));
1260+
1261+
This will show the item name and a clickable link for the item description.
1262+
12551263
---------------------------------------
12561264

12571265
*mesf("<format>"{, <param>{, <param>{, ...}}})

npc/other/Global_Functions.txt

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ function script F_ShuffleNumbers {
434434
//== Function F_MesColor ===================================
435435
// Function to colorize npc dialog without having to memorize the color code
436436
// Examples:
437-
// mes callfunc("F_MesColor", C_BLUE) +"This message is now in BLUE";
437+
// mesf("%sThis message is now in BLUE.", F_MesColor(C_BLUE));
438438
function script F_MesColor {
439439
return sprintf("^%06X", min(getarg(0), 0xFFFFFF));
440440
}
@@ -475,3 +475,19 @@ function script F_GetTradeRestriction {
475475
.@trade$ += "NoAuction|";
476476
}
477477
}
478+
479+
//== Function F_MesItemInfo ===================================
480+
// Show the item name and a clickable link for the item description
481+
// Only works with mes and mesf, does not work in menu/select
482+
function script F_MesItemInfo {
483+
.@item = getarg(0);
484+
.@itemname$ = getitemname(.@item);
485+
if (.@itemname$ == "null")
486+
.@itemname$ = "Unknown Item";
487+
if (PACKETVER >= 20150729)
488+
return sprintf("<ITEM>%s<INFO>%d</INFO></ITEM>", .@itemname$, .@item);
489+
else if (PACKETVER >= 20130130)
490+
return sprintf("<ITEMLINK>%s<INFO>%d</INFO></ITEMLINK>", .@itemname$, .@item);
491+
else
492+
return .@itemname$;
493+
}

npc/re/instances/OldGlastHeim.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2744,7 +2744,7 @@ glast_01,188,273,5 script White Knight#1a 4_WHITEKNIGHT,{
27442744
close();
27452745
}
27462746
mes("I exchange you a White Knight Card for ^0000FF3000 Coagulated Spell^000000 or ^FF000070 Contaminated Magic^000000.");
2747-
mes("<ITEMLINK>White Knight Card<INFO>4608</INFO></ITEMLINK>");
2747+
mes(F_MesItemInfo(White_Knightage_Card));
27482748
next();
27492749
setarray(.@item[0], Coagulated_Spell, Corrupted_Charm);
27502750
setarray(.@cost[0], 3000, 70);
@@ -2777,7 +2777,7 @@ glast_01,192,273,3 script Khalitzburg Knight#1a 4_F_KHALITZBURG,{
27772777
close();
27782778
}
27792779
mes("I exchange you a Khalitzburg Knight Card for ^0000FF5000 Coagulated Spell^000000 or ^FF0000100 Contaminated Magic^000000.");
2780-
mes("<ITEMLINK>Khalitzburg Knight Card<INFO>4609</INFO></ITEMLINK>");
2780+
mes(F_MesItemInfo(Khali_Knightage_Card));
27812781
next();
27822782
setarray(.@item[0], Coagulated_Spell, Corrupted_Charm);
27832783
setarray(.@cost[0], 5000, 100);

0 commit comments

Comments
 (0)