It's untested, but it should work :)
*** PLEASE NOTE ***
This macro is not for generating links, it is to store existing links for later.
So you cannot use this script to generate a link of some obscure item, merely by knowing either name or id of said item.
What you can use this script for, is if you see a really cool link, that you want to be able to look at anytime, without having to ask a person for a link. You just store the link with this macro, and when you then later wants to view it, or show someone else the link, you just pull it out again with this macro.
The syntax is rather simple (and also explained within the macro, simply by typing "/macro link"):
Syntax: /macro link <add|edit|list> ["link"|key] ["link"]
Example: /macro link add "Some Item Link"
Example: /macro link edit 5 "Some Item Link"
Example: /macro link list
Step by step example to store a link is:
1. Open the link so you have the link window, with the link you wish to store open.
2. Type: /macro link add " do NOT press enter yet.
3. Click the item graphics in the link window, to paste a link to the area where you have allready typed the beginning of the command.
4. Now you should have a line looking something like this:
/macro link add "Some Item Link
5. End the line with another quote "
6. Your line should now look something like this:
/macro link add "Some Item Link"
7. Press enter to save the link.
Now you just retrieve a list of all your stored links by typing /macro link list
Edit:
Fixed the $defined parameter check, thanks Wishbringer :)
2003.10.15: Updated and tested.
Code: Select all
#turbo
#define INIPATH "d:\games\mq\ini\links.ini"
Sub Main
/if "@Param0"=="add" {
/if "$defined(Param1)"=="FALSE" /call Syntax
/call ListKeys empty
/if n $return==0 {
/echo No empty keys were found.
/endmacro
}
/ini "INIPATH" "Links" "$int($return)" "- @Param1 -"
/echo Added: Key: $return - Value: @Param1
} else /if "@Param0"=="edit" {
/if n $strlen("@Param1")>3 /call Syntax
/if "$defined(Param2)"=="FALSE" /call Syntax
/ini "INIPATH" "Links" "$int(@Param1)" "- @Param2 -"
/echo Updated: Key: @Param1 - Value: @Param2
} else /if "@Param0"=="list" {
/call ListKeys echo
} else {
/call Syntax
}
/return
Sub ListKeys
/if "@Param0"!="echo" /if "@Param0"!="empty" {
/echo Syntax: /call ListKeys <echo|empty>
/endmacro
}
/declare l0 local
/varset l0 0
:Loop
/varadd l0 1
/if "@Param0"=="echo" /if n $strlen("$ini("INIPATH","Links","$int(@l0)")")>8 /echo Key: $int(@l0) // $ini("INIPATH","Links","$int(@l0)")
/if "@Param0"=="empty" /if n $strlen("$ini("INIPATH","Links","$int(@l0)")")==8 /return $int(@l0)
/if n @l0<100 /goto :Loop
/return 0
Sub Syntax
/echo Syntax: /macro link <add|edit|list> ["link"|key] ["link"]
/echo Example: /macro link add "Some Item Link"
/echo Example: /macro link edit 5 "Some Item Link"
/echo Example: /macro link list
/endmacro
/return



