Browse Source

Added CharID as optional param for
* `getchildid({<char_id>})`
* `getmotherid({<char_id>})`
* `getfatherid({<char_id>})`
* `divorce({<char_id>})`
* `ispartneron({<char_id>})`
* `getpartnerid({<char_id>})`
* `getlook(<type>{,<char_id>})`
* `getsavepoint(<information type>{,<char_id>})`
* `getinventorylist {<char_id>}`
* `mergeitem({<item_id>{,<char_id>}})`
* `getgmlevel({<char_id>})`
* `getgroupid({<char_id>})`
* `getskilllist({<char_id>})`
* `skillpointcount({<char_id>})`
* `checkoption(<option number>{,<char_id>})`
* `checkoption1(<option number>{,<char_id>})`
* `checkoption2(<option number>{,<char_id>})`
* `setoption <option number>{,<flag>{,<char_id>}}`
* `setcart {<type>{,<char_id>}}`
* `checkcart({<char_id>})`
* `setfalcon {<flag>{,<char_id>}}`
* `checkfalcon({<char_id>})`
* `setriding {<flag>{,<char_id>}}`
* `checkriding({<char_id>})`
* `setdragon {<color>{,<char_id>}}`
* `checkdragon({<char_id>})`
* `setmadogear {<flag>{,<char_id>}}`
* `checkmadogear({<char_id>})`
* `setmounting {<char_id>}`
* `ismounting({<char_id>})`
* `checkwug({<char_id>})`
* `dispbottom "<message>"{,<color>{,<char_id>}}`
* `savepoint "<map name>",<x>,<y>{,<char_id>}`
* `save "<map name>",<x>,<y>{,<char_id>}`
* `changesex({<char_id>})`
* `countbound({<bound type>{,<char_id>}})`
* `consumeitem <item id>{,<char_id>}`
* `consumeitem "<item name>"{,<char_id>}`
* `makerune <% success bonus>{,<char_id>}`
* `resetlvl <action type>{,<char_id>}`
* `resetstatus({<char_id>})`
* `resetskill({<char_id>})`
* `getstatus(<effect type>{,<type>{,<char_id>}})`
* `nude {<char_id>}`
* `disguise <Monster ID>{,<char_id>}`
* `undisguise {<char_id>}

Signed-off-by: Cydh Ramdh <house.bad@gmail.com>

Cydh Ramdh 10 years ago
parent
commit
12eaced423
2 changed files with 270 additions and 228 deletions
  1. 47 47
      doc/script_commands.txt
  2. 223 181
      src/map/script.c

+ 47 - 47
doc/script_commands.txt

@@ -2372,9 +2372,9 @@ If an invalid type is given or the NPC does not exist, 0 is returned.
 
 
 ---------------------------------------
 ---------------------------------------
 
 
-*getchildid()
-*getmotherid()
-*getfatherid()
+*getchildid({<char_id>})
+*getmotherid({<char_id>})
+*getfatherid({<char_id>})
 
 
 These functions return the character ID of the attached player's child,
 These functions return the character ID of the attached player's child,
 mother, mother, or father, respectively. It returns 0 if no ID is found.
 mother, mother, or father, respectively. It returns 0 if no ID is found.
@@ -2383,14 +2383,14 @@ mother, mother, or father, respectively. It returns 0 if no ID is found.
 
 
 ---------------------------------------
 ---------------------------------------
 
 
-*ispartneron()
+*ispartneron({<char_id>})
 
 
 This function returns 1 if the invoking character's marriage partner is 
 This function returns 1 if the invoking character's marriage partner is 
 currently online and 0 if they are not or if the character has no partner.
 currently online and 0 if they are not or if the character has no partner.
 
 
 ---------------------------------------
 ---------------------------------------
 
 
-*getpartnerid()
+*getpartnerid({<char_id>})
 
 
 This function returns the character ID of the invoking character's marriage 
 This function returns the character ID of the invoking character's marriage 
 partner, if any. If the invoking character is not married, it will return 0, 
 partner, if any. If the invoking character is not married, it will return 0, 
@@ -2401,7 +2401,7 @@ which is a quick way to see if they are married:
 
 
 ---------------------------------------
 ---------------------------------------
 
 
-*getlook(<type>)
+*getlook(<type>{,<char_id>})
 
 
 This function will return the number for the current character look value 
 This function will return the number for the current character look value 
 specified by type. See 'setlook' for valid look types.
 specified by type. See 'setlook' for valid look types.
@@ -2411,7 +2411,7 @@ dressed in black. :)
 
 
 ---------------------------------------
 ---------------------------------------
 
 
-*getsavepoint(<information type>)
+*getsavepoint(<information type>{,<char_id>})
 
 
 This function will return information about the invoking character's save point. 
 This function will return information about the invoking character's save point. 
 You can use it to let a character swap between several recorded save points. 
 You can use it to let a character swap between several recorded save points. 
@@ -2722,7 +2722,7 @@ of possible equipment slots.
 
 
 ---------------------------------------
 ---------------------------------------
 
 
-*getinventorylist;
+*getinventorylist {<char_id>};
 
 
 This command sets a bunch of arrays with a complete list of whatever the 
 This command sets a bunch of arrays with a complete list of whatever the 
 invoking character has in their inventory, including all the data needed to 
 invoking character has in their inventory, including all the data needed to 
@@ -2848,8 +2848,8 @@ It's useful for when you want to check whether an item contains cards or if it's
 
 
 ---------------------------------------
 ---------------------------------------
 
 
-*mergeitem({<item_id>});
-*mergeitem({"<item name>"});
+*mergeitem({<item_id>{,<char_id>}});
+*mergeitem({"<item name>"{,<char_id>}});
 
 
 Merge all stackable items that separated by GUID flags
 Merge all stackable items that separated by GUID flags
 (either by flag 4 item_flag.txt or GUID  in item_group).
 (either by flag 4 item_flag.txt or GUID  in item_group).
@@ -2913,7 +2913,7 @@ Notice that NPC objects disabled with 'disablenpc' will still be located.
 
 
 ---------------------------------------
 ---------------------------------------
 
 
-*getgmlevel()
+*getgmlevel({<char_id>})
 
 
 This function will return the (GM) level associated with the player group to which
 This function will return the (GM) level associated with the player group to which
 the invoking character belongs. If this is somehow executed from a console command,
 the invoking character belongs. If this is somehow executed from a console command,
@@ -2926,7 +2926,7 @@ specially when talked to by GMs.
 
 
 ---------------------------------------
 ---------------------------------------
 
 
-*getgroupid()
+*getgroupid({<char_id>})
 
 
 This function will return the group id to which the invoking player belongs.
 This function will return the group id to which the invoking player belongs.
 
 
@@ -3208,7 +3208,7 @@ Example 2:
 
 
 ---------------------------------------
 ---------------------------------------
 
 
-*getskilllist;
+*getskilllist({<char_id>});
 
 
 This command sets a bunch of arrays with a complete list of skills the
 This command sets a bunch of arrays with a complete list of skills the
 invoking character has. Here's what you get:
 invoking character has. Here's what you get:
@@ -3313,7 +3313,7 @@ Example:
 
 
 ---------------------------------------
 ---------------------------------------
 
 
-*skillpointcount()
+*skillpointcount({<char_id>})
 
 
 Returns the total amount of skill points a character possesses (SkillPoint+SP's used in skills)
 Returns the total amount of skill points a character possesses (SkillPoint+SP's used in skills)
 This command can be used to check the currently attached characters total amount of skill points.
 This command can be used to check the currently attached characters total amount of skill points.
@@ -3417,10 +3417,10 @@ things might in some cases be required.
 
 
 ---------------------------------------
 ---------------------------------------
 
 
-*checkoption(<option number>)
-*checkoption1(<option number>)
-*checkoption2(<option number>)
-*setoption <option number>{,<flag>};
+*checkoption(<option number>{,<char_id>})
+*checkoption1(<option number>{,<char_id>})
+*checkoption2(<option number>{,<char_id>})
+*setoption <option number>{,<flag>{,<char_id>}};
 
 
 The 'setoption' series of functions check for a so-called option that is set on 
 The 'setoption' series of functions check for a so-called option that is set on 
 the invoking character. 'Options' are used to store status conditions and a lot 
 the invoking character. 'Options' are used to store status conditions and a lot 
@@ -3482,8 +3482,8 @@ core developer (or read the source: src/map/status.h) for the full list.
 
 
 ---------------------------------------
 ---------------------------------------
 
 
-*setcart {<type>};
-*checkcart()
+*setcart {<type>{,<char_id>}};
+*checkcart({<char_id>});
 
 
 If <type> is 0 this command will remove the cart from the character.
 If <type> is 0 this command will remove the cart from the character.
 Otherwise it gives the invoking character a cart. The cart given will be 
 Otherwise it gives the invoking character a cart. The cart given will be 
@@ -3498,8 +3498,8 @@ The accompanying function will return 1 if the invoking character has a cart
 
 
 ---------------------------------------
 ---------------------------------------
 
 
-*setfalcon {<flag>};
-*checkfalcon()
+*setfalcon {<flag>{,<char_id>}};
+*checkfalcon({<char_id>});
 
 
 If <flag> is 0 this command will remove the falcon from the character.
 If <flag> is 0 this command will remove the falcon from the character.
 Otherwise it gives the invoking character a falcon. The falcon will be there 
 Otherwise it gives the invoking character a falcon. The falcon will be there 
@@ -3514,8 +3514,8 @@ and 0 if they don't.
 
 
 ---------------------------------------
 ---------------------------------------
 
 
-*setriding {<flag>};
-*checkriding()
+*setriding {<flag>{,<char_id>}};
+*checkriding({<char_id>});
 
 
 If <flag> is 0 this command will remove the mount from the character.
 If <flag> is 0 this command will remove the mount from the character.
 Otherwise it gives the invoking character a PecoPeco (if they are a Knight 
 Otherwise it gives the invoking character a PecoPeco (if they are a Knight 
@@ -3531,8 +3531,8 @@ bird and 0 if they aren't.
 
 
 ---------------------------------------
 ---------------------------------------
 
 
-*setdragon {<color>};
-*checkdragon()
+*setdragon {<color>{,<char_id>}};
+*checkdragon({<char_id>});
 
 
 The 'setdragon' function toggles mounting a dragon for the invoking character.
 The 'setdragon' function toggles mounting a dragon for the invoking character.
 It will return 1 if successful, 0 otherwise.
 It will return 1 if successful, 0 otherwise.
@@ -3551,8 +3551,8 @@ dragon and 0 if they aren't.
 
 
 ---------------------------------------
 ---------------------------------------
 
 
-*setmadogear {<flag>};
-*checkmadogear()
+*setmadogear {<flag>{,<char_id>}};
+*checkmadogear({<char_id>});
 
 
 If <flag> is 0 this command will remove the mount from the character.
 If <flag> is 0 this command will remove the mount from the character.
 Otherwise it gives the invoking character a Mado (if they are a Mechanic).
 Otherwise it gives the invoking character a Mado (if they are a Mechanic).
@@ -3562,8 +3562,8 @@ Mado and 0 if they don't.
 
 
 ---------------------------------------
 ---------------------------------------
 
 
-*setmounting;
-*ismounting()
+*setmounting {<char_id>};
+*ismounting({<char_id>});
 
 
 The 'setmounting' function toggles cash mount for the invoking character.
 The 'setmounting' function toggles cash mount for the invoking character.
 It will return 1 if successful, 0 otherwise.
 It will return 1 if successful, 0 otherwise.
@@ -3575,7 +3575,7 @@ cash mount and 0 if they don't.
 
 
 ---------------------------------------
 ---------------------------------------
 
 
-*checkwug()
+*checkwug({<char_id>});
 
 
 This function will return 1 if the invoking character has a
 This function will return 1 if the invoking character has a
 warg and 0 if they don't.
 warg and 0 if they don't.
@@ -3780,7 +3780,7 @@ be seen by anyone else.
 
 
 ---------------------------------------
 ---------------------------------------
 
 
-*dispbottom "<message>"{,<color>};
+*dispbottom "<message>"{,<color>{,<char_id>}};
 
 
 This command will send the given message with color into the invoking character's chat 
 This command will send the given message with color into the invoking character's chat 
 window. The color format is in RGB (0xRRGGBB). The color is
 window. The color format is in RGB (0xRRGGBB). The color is
@@ -3909,8 +3909,8 @@ normally translate to random coordinates.
 
 
 ---------------------------------------
 ---------------------------------------
 
 
-*savepoint "<map name>",<x>,<y>;
-*save "<map name>",<x>,<y>;
+*savepoint "<map name>",<x>,<y>{,<char_id>};
+*save "<map name>",<x>,<y>{,<char_id>};
 
 
 These commands save where the invoking character will return to upon clicking
 These commands save where the invoking character will return to upon clicking
 "Return to Save Point", after death and in some other cases. The two versions are 
 "Return to Save Point", after death and in some other cases. The two versions are 
@@ -4121,7 +4121,7 @@ do, but this will only happen in a later SVN revision.
 
 
 ---------------------------------------
 ---------------------------------------
 
 
-*changesex;
+*changesex({<char_id>});
 
 
 This command will change the gender for the attached character's account. If it 
 This command will change the gender for the attached character's account. If it 
 was male, it will become female, if it was female, it will become male. The 
 was male, it will become female, if it was female, it will become male. The 
@@ -4591,7 +4591,7 @@ cart or storage. If no cart is mounted, 'cartcountitem2' will return -1.
 
 
 ---------------------------------------
 ---------------------------------------
 
 
-*countbound({<bound type>})
+*countbound({<bound type>{,<char_id>}})
 
 
 This function will return the number of bounded items in the character's
 This function will return the number of bounded items in the character's
 inventory, and sets an array @bound_items[] containing all item IDs of the
 inventory, and sets an array @bound_items[] containing all item IDs of the
@@ -4704,8 +4704,8 @@ target cursor is shown.
 
 
 ---------------------------------------
 ---------------------------------------
 
 
-*consumeitem <item id>;
-*consumeitem "<item name>";
+*consumeitem <item id>{,<char_id>};
+*consumeitem "<item name>"{,<char_id>};
 
 
 This command will run the item script of the specified item on the invoking
 This command will run the item script of the specified item on the invoking
 character. The character does not need to possess the item, and the item will
 character. The character does not need to possess the item, and the item will
@@ -4770,7 +4770,7 @@ to cook the dish the command works.
 
 
 ---------------------------------------
 ---------------------------------------
 
 
-*makerune <% success bonus>;
+*makerune <% success bonus>{,<char_id>};
 
 
 This command will open a rune crafting window on the client connected to the
 This command will open a rune crafting window on the client connected to the
 invoking character. Since this command is officially used in rune ores, a bonus
 invoking character. Since this command is officially used in rune ores, a bonus
@@ -5056,7 +5056,7 @@ a fun quest. (Wasting a level point on that is really annoying :D)
 //
 //
 ---------------------------------------
 ---------------------------------------
 
 
-*resetlvl <action type>;
+*resetlvl <action type>{,<char_id>};
 
 
 This is a character reset command, meant mostly for rebirth script supporting 
 This is a character reset command, meant mostly for rebirth script supporting 
 Advanced jobs, which will reset the invoking character's stats and level 
 Advanced jobs, which will reset the invoking character's stats and level 
@@ -5078,7 +5078,7 @@ rebirth scripts. Ask AppleGirl why.
 
 
 ---------------------------------------
 ---------------------------------------
 
 
-*resetstatus;
+*resetstatus({<char_id>});
 
 
 This is a character reset command, which will reset the stats on the invoking 
 This is a character reset command, which will reset the stats on the invoking 
 character and give back all the stat points used to raise them previously. 
 character and give back all the stat points used to raise them previously. 
@@ -5088,7 +5088,7 @@ Used in reset NPC's (duh!)
 
 
 ---------------------------------------
 ---------------------------------------
 
 
-*resetskill;
+*resetskill({<char_id>});
 
 
 This command takes off all the skill points on the invoking character, so they 
 This command takes off all the skill points on the invoking character, so they 
 only have Basic Skill blanked out (lvl 0) left, and returns the points for them 
 only have Basic Skill blanked out (lvl 0) left, and returns the points for them 
@@ -5162,7 +5162,7 @@ Note: to use SC_NOCHAT you should alter Manner
 
 
 ---------------------------------------
 ---------------------------------------
 
 
-*getstatus(<effect type>{,<type>})
+*getstatus(<effect type>{,<type>{,<char_id>}})
 
 
 Retrieve information about a specific status effect when called. Depending on <type>
 Retrieve information about a specific status effect when called. Depending on <type>
 specified the function will return different information.
 specified the function will return different information.
@@ -5430,7 +5430,7 @@ Flag contants:
 
 
 ---------------------------------------
 ---------------------------------------
 
 
-*nude;
+*nude {<char_id>};
 
 
 This command will unequip anything equipped on the invoking character.
 This command will unequip anything equipped on the invoking character.
 
 
@@ -5447,8 +5447,8 @@ If no character is specified, the command will run for the invoking character.
 
 
 ---------------------------------------
 ---------------------------------------
 
 
-*disguise <Monster ID>;
-*undisguise;
+*disguise <Monster ID>{,<char_id>};
+*undisguise {<char_id>};
 
 
 This command disguises the current player with a monster sprite.
 This command disguises the current player with a monster sprite.
 The disguise lasts until 'undisguise' is issued or the player logs out.
 The disguise lasts until 'undisguise' is issued or the player logs out.
@@ -5494,7 +5494,7 @@ the invoking character. Example can be found in the wedding script.
 
 
 ---------------------------------------
 ---------------------------------------
 
 
-*divorce()
+*divorce({<char_id>})
 
 
 This function will "un-marry" the invoking character from whoever they were 
 This function will "un-marry" the invoking character from whoever they were 
 married to. Both will no longer be each other's marriage partner, (at least in 
 married to. Both will no longer be each other's marriage partner, (at least in 

+ 223 - 181
src/map/script.c

@@ -210,7 +210,7 @@ static void script_charid2sd_(struct script_state *st, uint8 loc, struct map_ses
  * @param loc Location to look nick in script parameter
  * @param loc Location to look nick in script parameter
  * @param sd Variable that will be assigned
  * @param sd Variable that will be assigned
  **/
  **/
-static bool script_nick2sd_(struct script_state *st, uint8 loc, struct map_session_data **sd, const char *func) {
+static void script_nick2sd_(struct script_state *st, uint8 loc, struct map_session_data **sd, const char *func) {
 	if (script_hasdata(st, loc)) {
 	if (script_hasdata(st, loc)) {
 		const char *name_ = script_getstr(st, loc);
 		const char *name_ = script_getstr(st, loc);
 		if (!(*sd = map_nick2sd(name_)))
 		if (!(*sd = map_nick2sd(name_)))
@@ -8760,28 +8760,28 @@ BUILDIN_FUNC(basicskillcheck)
 
 
 /// Returns the GM level of the player.
 /// Returns the GM level of the player.
 ///
 ///
-/// getgmlevel() -> <level>
+/// getgmlevel({<char_id>}) -> <level>
 BUILDIN_FUNC(getgmlevel)
 BUILDIN_FUNC(getgmlevel)
 {
 {
 	TBL_PC* sd;
 	TBL_PC* sd;
 
 
-	sd = script_rid2sd(st);
-	if( sd == NULL )
-		return 0;// no player attached, report source
+	script_charid2sd(2,sd);
+	if (!sd)
+		return SCRIPT_CMD_FAILURE;
 	script_pushint(st, pc_get_group_level(sd));
 	script_pushint(st, pc_get_group_level(sd));
 	return SCRIPT_CMD_SUCCESS;
 	return SCRIPT_CMD_SUCCESS;
 }
 }
 
 
 /// Returns the group ID of the player.
 /// Returns the group ID of the player.
 ///
 ///
-/// getgroupid() -> <int>
+/// getgroupid({<char_id>}) -> <int>
 BUILDIN_FUNC(getgroupid)
 BUILDIN_FUNC(getgroupid)
 {
 {
 	TBL_PC* sd;
 	TBL_PC* sd;
 
 
-	sd = script_rid2sd(st);
-	if (sd == NULL)
-		return 1; // no player attached, report source
+	script_charid2sd(2,sd);
+	if (!sd)
+		return SCRIPT_CMD_FAILURE;
 	script_pushint(st, pc_get_group_id(sd));
 	script_pushint(st, pc_get_group_id(sd));
 	return SCRIPT_CMD_SUCCESS;
 	return SCRIPT_CMD_SUCCESS;
 }
 }
@@ -8808,15 +8808,15 @@ BUILDIN_FUNC(end)
 
 
 /// Checks if the player has that effect state (option).
 /// Checks if the player has that effect state (option).
 ///
 ///
-/// checkoption(<option>) -> <bool>
+/// checkoption(<option>{,<char_id>}) -> <bool>
 BUILDIN_FUNC(checkoption)
 BUILDIN_FUNC(checkoption)
 {
 {
 	int option;
 	int option;
 	TBL_PC* sd;
 	TBL_PC* sd;
 
 
-	sd = script_rid2sd(st);
-	if( sd == NULL )
-		return 0;// no player attached, report source
+	script_charid2sd(3,sd);
+	if (!sd)
+		return SCRIPT_CMD_FAILURE;
 
 
 	option = script_getnum(st,2);
 	option = script_getnum(st,2);
 	if( sd->sc.option&option )
 	if( sd->sc.option&option )
@@ -8829,15 +8829,15 @@ BUILDIN_FUNC(checkoption)
 
 
 /// Checks if the player is in that body state (opt1).
 /// Checks if the player is in that body state (opt1).
 ///
 ///
-/// checkoption1(<opt1>) -> <bool>
+/// checkoption1(<opt1>{,<char_id>}) -> <bool>
 BUILDIN_FUNC(checkoption1)
 BUILDIN_FUNC(checkoption1)
 {
 {
 	int opt1;
 	int opt1;
 	TBL_PC* sd;
 	TBL_PC* sd;
 
 
-	sd = script_rid2sd(st);
-	if( sd == NULL )
-		return 0;// no player attached, report source
+	script_charid2sd(3,sd);
+	if (!sd)
+		return SCRIPT_CMD_FAILURE;
 
 
 	opt1 = script_getnum(st,2);
 	opt1 = script_getnum(st,2);
 	if( sd->sc.opt1 == opt1 )
 	if( sd->sc.opt1 == opt1 )
@@ -8850,15 +8850,15 @@ BUILDIN_FUNC(checkoption1)
 
 
 /// Checks if the player has that health state (opt2).
 /// Checks if the player has that health state (opt2).
 ///
 ///
-/// checkoption2(<opt2>) -> <bool>
+/// checkoption2(<opt2>{,<char_id>}) -> <bool>
 BUILDIN_FUNC(checkoption2)
 BUILDIN_FUNC(checkoption2)
 {
 {
 	int opt2;
 	int opt2;
 	TBL_PC* sd;
 	TBL_PC* sd;
 
 
-	sd = script_rid2sd(st);
-	if( sd == NULL )
-		return 0;// no player attached, report source
+	script_charid2sd(3,sd);
+	if (!sd)
+		return SCRIPT_CMD_FAILURE;
 
 
 	opt2 = script_getnum(st,2);
 	opt2 = script_getnum(st,2);
 	if( sd->sc.opt2&opt2 )
 	if( sd->sc.opt2&opt2 )
@@ -8874,17 +8874,16 @@ BUILDIN_FUNC(checkoption2)
 /// <flag>=0 : removes the option
 /// <flag>=0 : removes the option
 /// <flag>=other : adds the option
 /// <flag>=other : adds the option
 ///
 ///
-/// setoption <option>,<flag>;
-/// setoption <option>;
+/// setoption <option>{,<flag>{,<char_id>}};
 BUILDIN_FUNC(setoption)
 BUILDIN_FUNC(setoption)
 {
 {
 	int option;
 	int option;
 	int flag = 1;
 	int flag = 1;
 	TBL_PC* sd;
 	TBL_PC* sd;
 
 
-	sd = script_rid2sd(st);
-	if( sd == NULL )
-		return 0;// no player attached, report source
+	script_charid2sd(4,sd);
+	if (!sd)
+		return SCRIPT_CMD_FAILURE;
 
 
 	option = script_getnum(st,2);
 	option = script_getnum(st,2);
 	if( script_hasdata(st,3) )
 	if( script_hasdata(st,3) )
@@ -8908,16 +8907,16 @@ BUILDIN_FUNC(setoption)
 
 
 /// Returns if the player has a cart.
 /// Returns if the player has a cart.
 ///
 ///
-/// checkcart() -> <bool>
+/// checkcart({char_id}) -> <bool>
 ///
 ///
 /// @author Valaris
 /// @author Valaris
 BUILDIN_FUNC(checkcart)
 BUILDIN_FUNC(checkcart)
 {
 {
 	TBL_PC* sd;
 	TBL_PC* sd;
 
 
-	sd = script_rid2sd(st);
-	if( sd == NULL )
-		return 0;// no player attached, report source
+	script_charid2sd(2,sd);
+	if (!sd)
+		return SCRIPT_CMD_FAILURE;
 
 
 	if( pc_iscarton(sd) )
 	if( pc_iscarton(sd) )
 		script_pushint(st, 1);
 		script_pushint(st, 1);
@@ -8936,16 +8935,15 @@ BUILDIN_FUNC(checkcart)
 /// <type>=4 : Wooden cart with a Panda doll on the back
 /// <type>=4 : Wooden cart with a Panda doll on the back
 /// <type>=5 : Normal cart with bigger wheels, a roof and a banner on the back
 /// <type>=5 : Normal cart with bigger wheels, a roof and a banner on the back
 ///
 ///
-/// setcart <type>;
-/// setcart;
+/// setcart {<type>{,<char_id>}};
 BUILDIN_FUNC(setcart)
 BUILDIN_FUNC(setcart)
 {
 {
 	int type = 1;
 	int type = 1;
 	TBL_PC* sd;
 	TBL_PC* sd;
 
 
-	sd = script_rid2sd(st);
-	if( sd == NULL )
-		return 0;// no player attached, report source
+	script_charid2sd(2,sd);
+	if (!sd)
+		return SCRIPT_CMD_FAILURE;
 
 
 	if( script_hasdata(st,2) )
 	if( script_hasdata(st,2) )
 		type = script_getnum(st,2);
 		type = script_getnum(st,2);
@@ -8956,16 +8954,16 @@ BUILDIN_FUNC(setcart)
 
 
 /// Returns if the player has a falcon.
 /// Returns if the player has a falcon.
 ///
 ///
-/// checkfalcon() -> <bool>
+/// checkfalcon({char_id}) -> <bool>
 ///
 ///
 /// @author Valaris
 /// @author Valaris
 BUILDIN_FUNC(checkfalcon)
 BUILDIN_FUNC(checkfalcon)
 {
 {
 	TBL_PC* sd;
 	TBL_PC* sd;
 
 
-	sd = script_rid2sd(st);
-	if( sd == NULL )
-		return 0;// no player attached, report source
+	script_charid2sd(2,sd);
+	if (!sd)
+		return SCRIPT_CMD_FAILURE;
 
 
 	if( pc_isfalcon(sd) )
 	if( pc_isfalcon(sd) )
 		script_pushint(st, 1);
 		script_pushint(st, 1);
@@ -8978,16 +8976,15 @@ BUILDIN_FUNC(checkfalcon)
 /// Sets if the player has a falcon or not.
 /// Sets if the player has a falcon or not.
 /// <flag> defaults to 1
 /// <flag> defaults to 1
 ///
 ///
-/// setfalcon <flag>;
-/// setfalcon;
+/// setfalcon {<flag>{,<char_id>}};
 BUILDIN_FUNC(setfalcon)
 BUILDIN_FUNC(setfalcon)
 {
 {
 	int flag = 1;
 	int flag = 1;
 	TBL_PC* sd;
 	TBL_PC* sd;
 
 
-	sd = script_rid2sd(st);
-	if( sd == NULL )
-		return 0;// no player attached, report source
+	script_charid2sd(3,sd);
+	if (!sd)
+		return SCRIPT_CMD_FAILURE;
 
 
 	if( script_hasdata(st,2) )
 	if( script_hasdata(st,2) )
 		flag = script_getnum(st,2);
 		flag = script_getnum(st,2);
@@ -8999,16 +8996,16 @@ BUILDIN_FUNC(setfalcon)
 
 
 /// Returns if the player is riding.
 /// Returns if the player is riding.
 ///
 ///
-/// checkriding() -> <bool>
+/// checkriding({char_id}) -> <bool>
 ///
 ///
 /// @author Valaris
 /// @author Valaris
 BUILDIN_FUNC(checkriding)
 BUILDIN_FUNC(checkriding)
 {
 {
 	TBL_PC* sd;
 	TBL_PC* sd;
 
 
-	sd = script_rid2sd(st);
-	if( sd == NULL )
-		return 0;// no player attached, report source
+	script_charid2sd(2,sd);
+	if (!sd)
+		return SCRIPT_CMD_FAILURE;
 
 
 	if( pc_isriding(sd) )
 	if( pc_isriding(sd) )
 		script_pushint(st, 1);
 		script_pushint(st, 1);
@@ -9021,16 +9018,15 @@ BUILDIN_FUNC(checkriding)
 /// Sets if the player is riding.
 /// Sets if the player is riding.
 /// <flag> defaults to 1
 /// <flag> defaults to 1
 ///
 ///
-/// setriding <flag>;
-/// setriding;
+/// setriding {<flag>{,<char_id>}};
 BUILDIN_FUNC(setriding)
 BUILDIN_FUNC(setriding)
 {
 {
 	int flag = 1;
 	int flag = 1;
 	TBL_PC* sd;
 	TBL_PC* sd;
 
 
-	sd = script_rid2sd(st);
-	if( sd == NULL )
-		return 0;// no player attached, report source
+	script_charid2sd(3,sd);
+	if (!sd)
+		return SCRIPT_CMD_FAILURE;
 
 
 	if( script_hasdata(st,2) )
 	if( script_hasdata(st,2) )
 		flag = script_getnum(st,2);
 		flag = script_getnum(st,2);
@@ -9041,15 +9037,15 @@ BUILDIN_FUNC(setriding)
 
 
 /// Returns if the player has a warg.
 /// Returns if the player has a warg.
 ///
 ///
-/// checkwug() -> <bool>
+/// checkwug({char_id}) -> <bool>
 ///
 ///
 BUILDIN_FUNC(checkwug)
 BUILDIN_FUNC(checkwug)
 {
 {
 	TBL_PC* sd;
 	TBL_PC* sd;
 
 
-	sd = script_rid2sd(st);
-	if( sd == NULL )
-		return 0;// no player attached, report source
+	script_charid2sd(2,sd);
+	if (!sd)
+		return SCRIPT_CMD_FAILURE;
 
 
 	if( pc_iswug(sd) || pc_isridingwug(sd) )
 	if( pc_iswug(sd) || pc_isridingwug(sd) )
 		script_pushint(st, 1);
 		script_pushint(st, 1);
@@ -9061,15 +9057,15 @@ BUILDIN_FUNC(checkwug)
 
 
 /// Returns if the player is wearing MADO Gear.
 /// Returns if the player is wearing MADO Gear.
 ///
 ///
-/// checkmadogear() -> <bool>
+/// checkmadogear({<char_id>}) -> <bool>
 ///
 ///
 BUILDIN_FUNC(checkmadogear)
 BUILDIN_FUNC(checkmadogear)
 {
 {
 	TBL_PC* sd;
 	TBL_PC* sd;
 
 
-	sd = script_rid2sd(st);
-	if( sd == NULL )
-		return 0;// no player attached, report source
+	script_charid2sd(2,sd);
+	if (!sd)
+		return SCRIPT_CMD_FAILURE;
 
 
 	if( pc_ismadogear(sd) )
 	if( pc_ismadogear(sd) )
 		script_pushint(st, 1);
 		script_pushint(st, 1);
@@ -9082,16 +9078,15 @@ BUILDIN_FUNC(checkmadogear)
 /// Sets if the player is riding MADO Gear.
 /// Sets if the player is riding MADO Gear.
 /// <flag> defaults to 1
 /// <flag> defaults to 1
 ///
 ///
-/// setmadogear <flag>;
-/// setmadogear;
+/// setmadogear {<flag>{,<char_id>}};
 BUILDIN_FUNC(setmadogear)
 BUILDIN_FUNC(setmadogear)
 {
 {
 	int flag = 1;
 	int flag = 1;
 	TBL_PC* sd;
 	TBL_PC* sd;
 
 
-	sd = script_rid2sd(st);
-	if( sd == NULL )
-		return 0;// no player attached, report source
+	script_charid2sd(3,sd);
+	if (!sd)
+		return SCRIPT_CMD_FAILURE;
 
 
 	if( script_hasdata(st,2) )
 	if( script_hasdata(st,2) )
 		flag = script_getnum(st,2);
 		flag = script_getnum(st,2);
@@ -9102,8 +9097,8 @@ BUILDIN_FUNC(setmadogear)
 
 
 /// Sets the save point of the player.
 /// Sets the save point of the player.
 ///
 ///
-/// save "<map name>",<x>,<y>
-/// savepoint "<map name>",<x>,<y>
+/// save "<map name>",<x>,<y>{,<char_id>}
+/// savepoint "<map name>",<x>,<y>{,<char_id>}
 BUILDIN_FUNC(savepoint)
 BUILDIN_FUNC(savepoint)
 {
 {
 	int x;
 	int x;
@@ -9112,9 +9107,9 @@ BUILDIN_FUNC(savepoint)
 	const char* str;
 	const char* str;
 	TBL_PC* sd;
 	TBL_PC* sd;
 
 
-	sd = script_rid2sd(st);
+	script_charid2sd(4,sd);
 	if( sd == NULL )
 	if( sd == NULL )
-		return 0;// no player attached, report source
+		return SCRIPT_CMD_FAILURE;// no player attached, report source
 
 
 	str = script_getstr(st, 2);
 	str = script_getstr(st, 2);
 	x   = script_getnum(st,3);
 	x   = script_getnum(st,3);
@@ -10548,17 +10543,16 @@ BUILDIN_FUNC(getscrate)
 }
 }
 
 
 /*==========================================
 /*==========================================
- * getstatus <type>{, <info>};
+ * getstatus(<effect type>{,<type>{,<char_id>}});
  *------------------------------------------*/
  *------------------------------------------*/
 BUILDIN_FUNC(getstatus)
 BUILDIN_FUNC(getstatus)
 {
 {
 	int id, type;
 	int id, type;
-	struct map_session_data* sd = script_rid2sd(st);
+	struct map_session_data* sd;
 
 
-	if( sd == NULL )
-	{// no player attached
-		return 0;
-	}
+	script_charid2sd(3,sd);
+	if (!sd)
+		return SCRIPT_CMD_FAILURE;
 
 
 	id = script_getnum(st, 2);
 	id = script_getnum(st, 2);
 	type = script_hasdata(st, 3) ? script_getnum(st, 3) : 0;
 	type = script_hasdata(st, 3) ? script_getnum(st, 3) : 0;
@@ -10834,9 +10828,9 @@ BUILDIN_FUNC(resetlvl)
 
 
 	int type=script_getnum(st,2);
 	int type=script_getnum(st,2);
 
 
-	sd=script_rid2sd(st);
-	if( sd == NULL )
-		return 0;
+	script_charid2sd(3,sd);
+	if (!sd)
+		return SCRIPT_CMD_FAILURE;
 
 
 	pc_resetlvl(sd,type);
 	pc_resetlvl(sd,type);
 	return SCRIPT_CMD_SUCCESS;
 	return SCRIPT_CMD_SUCCESS;
@@ -10847,7 +10841,9 @@ BUILDIN_FUNC(resetlvl)
 BUILDIN_FUNC(resetstatus)
 BUILDIN_FUNC(resetstatus)
 {
 {
 	TBL_PC *sd;
 	TBL_PC *sd;
-	sd=script_rid2sd(st);
+	script_charid2sd(2,sd);
+	if (!sd)
+		return SCRIPT_CMD_FAILURE;
 	pc_resetstate(sd);
 	pc_resetstate(sd);
 	return SCRIPT_CMD_SUCCESS;
 	return SCRIPT_CMD_SUCCESS;
 }
 }
@@ -10858,7 +10854,9 @@ BUILDIN_FUNC(resetstatus)
 BUILDIN_FUNC(resetskill)
 BUILDIN_FUNC(resetskill)
 {
 {
 	TBL_PC *sd;
 	TBL_PC *sd;
-	sd=script_rid2sd(st);
+	script_charid2sd(2,sd);
+	if (!sd)
+		return SCRIPT_CMD_FAILURE;
 	pc_resetskill(sd,1);
 	pc_resetskill(sd,1);
 	return SCRIPT_CMD_SUCCESS;
 	return SCRIPT_CMD_SUCCESS;
 }
 }
@@ -10869,7 +10867,9 @@ BUILDIN_FUNC(resetskill)
 BUILDIN_FUNC(skillpointcount)
 BUILDIN_FUNC(skillpointcount)
 {
 {
 	TBL_PC *sd;
 	TBL_PC *sd;
-	sd=script_rid2sd(st);
+	script_charid2sd(2,sd);
+	if (!sd)
+		return SCRIPT_CMD_FAILURE;
 	script_pushint(st,sd->status.skill_point + pc_resetskill(sd,2));
 	script_pushint(st,sd->status.skill_point + pc_resetskill(sd,2));
 	return SCRIPT_CMD_SUCCESS;
 	return SCRIPT_CMD_SUCCESS;
 }
 }
@@ -10918,7 +10918,9 @@ BUILDIN_FUNC(changesex)
 {
 {
 	int i;
 	int i;
 	TBL_PC *sd = NULL;
 	TBL_PC *sd = NULL;
-	sd = script_rid2sd(st);
+	script_charid2sd(2,sd);
+	if (!sd)
+		return SCRIPT_CMD_FAILURE;
 
 
 	pc_resetskill(sd,4);
 	pc_resetskill(sd,4);
 	// to avoid any problem with equipment and invalid sex, equipment is unequiped.
 	// to avoid any problem with equipment and invalid sex, equipment is unequiped.
@@ -12323,10 +12325,11 @@ BUILDIN_FUNC(wedding_effect)
 
 
 BUILDIN_FUNC(divorce)
 BUILDIN_FUNC(divorce)
 {
 {
-	TBL_PC *sd=script_rid2sd(st);
-	if(!sd || !pc_divorce(sd)){
+	TBL_PC *sd;
+	script_charid2sd(2,sd);
+	if (!sd || !pc_divorce(sd)) {
 		script_pushint(st,0);
 		script_pushint(st,0);
-		return 0;
+		return SCRIPT_CMD_FAILURE;
 	}
 	}
 	script_pushint(st,1);
 	script_pushint(st,1);
 	return SCRIPT_CMD_SUCCESS;
 	return SCRIPT_CMD_SUCCESS;
@@ -12334,12 +12337,13 @@ BUILDIN_FUNC(divorce)
 
 
 BUILDIN_FUNC(ispartneron)
 BUILDIN_FUNC(ispartneron)
 {
 {
-	TBL_PC *sd=script_rid2sd(st);
-
-	if(sd==NULL || !pc_ismarried(sd) ||
-		map_charid2sd(sd->status.partner_id) == NULL) {
-			script_pushint(st,0);
-			return 0;
+	TBL_PC *sd;
+	script_charid2sd(2,sd);
+	if (!sd || !pc_ismarried(sd) ||
+		map_charid2sd(sd->status.partner_id) == NULL)
+	{
+		script_pushint(st,0);
+		return SCRIPT_CMD_FAILURE;
 	}
 	}
 
 
 	script_pushint(st,1);
 	script_pushint(st,1);
@@ -12348,10 +12352,11 @@ BUILDIN_FUNC(ispartneron)
 
 
 BUILDIN_FUNC(getpartnerid)
 BUILDIN_FUNC(getpartnerid)
 {
 {
-	TBL_PC *sd=script_rid2sd(st);
+	TBL_PC *sd;
+	script_charid2sd(2,sd);
 	if (sd == NULL) {
 	if (sd == NULL) {
 		script_pushint(st,0);
 		script_pushint(st,0);
-		return 0;
+		return SCRIPT_CMD_FAILURE;
 	}
 	}
 
 
 	script_pushint(st,sd->status.partner_id);
 	script_pushint(st,sd->status.partner_id);
@@ -12360,10 +12365,11 @@ BUILDIN_FUNC(getpartnerid)
 
 
 BUILDIN_FUNC(getchildid)
 BUILDIN_FUNC(getchildid)
 {
 {
-	TBL_PC *sd=script_rid2sd(st);
+	TBL_PC *sd;
+	script_charid2sd(2,sd);
 	if (sd == NULL) {
 	if (sd == NULL) {
 		script_pushint(st,0);
 		script_pushint(st,0);
-		return 0;
+		return SCRIPT_CMD_FAILURE;
 	}
 	}
 
 
 	script_pushint(st,sd->status.child);
 	script_pushint(st,sd->status.child);
@@ -12372,10 +12378,11 @@ BUILDIN_FUNC(getchildid)
 
 
 BUILDIN_FUNC(getmotherid)
 BUILDIN_FUNC(getmotherid)
 {
 {
-	TBL_PC *sd=script_rid2sd(st);
+	TBL_PC *sd;
+	script_charid2sd(2,sd);
 	if (sd == NULL) {
 	if (sd == NULL) {
 		script_pushint(st,0);
 		script_pushint(st,0);
-		return 0;
+		return SCRIPT_CMD_FAILURE;
 	}
 	}
 
 
 	script_pushint(st,sd->status.mother);
 	script_pushint(st,sd->status.mother);
@@ -12384,10 +12391,11 @@ BUILDIN_FUNC(getmotherid)
 
 
 BUILDIN_FUNC(getfatherid)
 BUILDIN_FUNC(getfatherid)
 {
 {
-	TBL_PC *sd=script_rid2sd(st);
+	TBL_PC *sd;
+	script_charid2sd(2,sd);
 	if (sd == NULL) {
 	if (sd == NULL) {
 		script_pushint(st,0);
 		script_pushint(st,0);
-		return 0;
+		return SCRIPT_CMD_FAILURE;
 	}
 	}
 
 
 	script_pushint(st,sd->status.father);
 	script_pushint(st,sd->status.father);
@@ -12820,11 +12828,13 @@ BUILDIN_FUNC(petloot)
  *------------------------------------------*/
  *------------------------------------------*/
 BUILDIN_FUNC(getinventorylist)
 BUILDIN_FUNC(getinventorylist)
 {
 {
-	TBL_PC *sd=script_rid2sd(st);
+	TBL_PC *sd;
 	char card_var[NAME_LENGTH];
 	char card_var[NAME_LENGTH];
-
 	int i,j=0,k;
 	int i,j=0,k;
-	if(!sd) return 0;
+
+	script_charid2sd(2,sd);
+	if (!sd)
+		return SCRIPT_CMD_FAILURE;
 	for(i=0;i<MAX_INVENTORY;i++){
 	for(i=0;i<MAX_INVENTORY;i++){
 		if(sd->status.inventory[i].nameid > 0 && sd->status.inventory[i].amount > 0){
 		if(sd->status.inventory[i].nameid > 0 && sd->status.inventory[i].amount > 0){
 			pc_setreg(sd,reference_uid(add_str("@inventorylist_id"), j),sd->status.inventory[i].nameid);
 			pc_setreg(sd,reference_uid(add_str("@inventorylist_id"), j),sd->status.inventory[i].nameid);
@@ -12847,11 +12857,16 @@ BUILDIN_FUNC(getinventorylist)
 	return SCRIPT_CMD_SUCCESS;
 	return SCRIPT_CMD_SUCCESS;
 }
 }
 
 
+/**
+ * getskilllist ({<char_id>});
+ **/
 BUILDIN_FUNC(getskilllist)
 BUILDIN_FUNC(getskilllist)
 {
 {
-	TBL_PC *sd=script_rid2sd(st);
+	TBL_PC *sd;
 	int i,j=0;
 	int i,j=0;
-	if(!sd) return 0;
+	script_charid2sd(2,sd);
+	if (!sd)
+		return SCRIPT_CMD_FAILURE;
 	for(i=0;i<MAX_SKILL;i++){
 	for(i=0;i<MAX_SKILL;i++){
 		if(sd->status.skill[i].id > 0 && sd->status.skill[i].lv > 0){
 		if(sd->status.skill[i].id > 0 && sd->status.skill[i].lv > 0){
 			pc_setreg(sd,reference_uid(add_str("@skilllist_id"), j),sd->status.skill[i].id);
 			pc_setreg(sd,reference_uid(add_str("@skilllist_id"), j),sd->status.skill[i].id);
@@ -12864,6 +12879,9 @@ BUILDIN_FUNC(getskilllist)
 	return SCRIPT_CMD_SUCCESS;
 	return SCRIPT_CMD_SUCCESS;
 }
 }
 
 
+/**
+ * clearitem ({<char_id>});
+ **/
 BUILDIN_FUNC(clearitem)
 BUILDIN_FUNC(clearitem)
 {
 {
 	TBL_PC *sd;
 	TBL_PC *sd;
@@ -12887,8 +12905,10 @@ BUILDIN_FUNC(clearitem)
 BUILDIN_FUNC(disguise)
 BUILDIN_FUNC(disguise)
 {
 {
 	int id;
 	int id;
-	TBL_PC* sd = script_rid2sd(st);
-	if (sd == NULL) return 0;
+	TBL_PC* sd;
+	script_charid2sd(3,sd);
+	if (sd == NULL)
+		return SCRIPT_CMD_FAILURE;
 
 
 	id = script_getnum(st,2);
 	id = script_getnum(st,2);
 
 
@@ -12905,8 +12925,10 @@ BUILDIN_FUNC(disguise)
  *------------------------------------------*/
  *------------------------------------------*/
 BUILDIN_FUNC(undisguise)
 BUILDIN_FUNC(undisguise)
 {
 {
-	TBL_PC* sd = script_rid2sd(st);
-	if (sd == NULL) return 0;
+	TBL_PC* sd;
+	script_charid2sd(2,sd);
+	if (sd == NULL)
+		return SCRIPT_CMD_FAILURE;
 
 
 	if (sd->disguise) {
 	if (sd->disguise) {
 		pc_disguise(sd, 0);
 		pc_disguise(sd, 0);
@@ -13372,11 +13394,12 @@ BUILDIN_FUNC(specialeffect2)
  *------------------------------------------*/
  *------------------------------------------*/
 BUILDIN_FUNC(nude)
 BUILDIN_FUNC(nude)
 {
 {
-	TBL_PC *sd = script_rid2sd(st);
+	TBL_PC *sd;
 	int i, calcflag = 0;
 	int i, calcflag = 0;
 
 
-	if( sd == NULL )
-		return 0;
+	script_charid2sd(2,sd);
+	if (!sd)
+		return SCRIPT_CMD_FAILURE;
 
 
 	for( i = 0 ; i < EQI_MAX; i++ ) {
 	for( i = 0 ; i < EQI_MAX; i++ ) {
 		if( sd->equip_index[ i ] >= 0 ) {
 		if( sd->equip_index[ i ] >= 0 ) {
@@ -13435,15 +13458,20 @@ BUILDIN_FUNC(atcommand) {
 }
 }
 
 
 /** Displays a message for the player only (like system messages like "you got an apple" )
 /** Displays a message for the player only (like system messages like "you got an apple" )
-* dispbottom("<message>"{,<color>})
+* dispbottom("<message>"{,<color>{,<char_id>}})
 * @param message 
 * @param message 
 * @param color Hex color default (Green)
 * @param color Hex color default (Green)
 */
 */
 BUILDIN_FUNC(dispbottom)
 BUILDIN_FUNC(dispbottom)
 {
 {
-	TBL_PC *sd=script_rid2sd(st);
+	TBL_PC *sd;
 	int color = 0;
 	int color = 0;
 	const char *message;
 	const char *message;
+
+	script_charid2sd(3,sd);
+	if (!sd)
+		return SCRIPT_CMD_FAILURE;
+
 	message = script_getstr(st,2);
 	message = script_getstr(st,2);
 
 
 	if (script_hasdata(st,3))
 	if (script_hasdata(st,3))
@@ -13888,7 +13916,11 @@ BUILDIN_FUNC(getlook)
 {
 {
 	int type,val;
 	int type,val;
 	TBL_PC *sd;
 	TBL_PC *sd;
-	sd=script_rid2sd(st);
+	script_charid2sd(3,sd);
+	if (!sd) {
+		script_pushint(st,-1);
+		return SCRIPT_CMD_FAILURE;
+	}
 
 
 	type=script_getnum(st,2);
 	type=script_getnum(st,2);
 	val=-1;
 	val=-1;
@@ -13917,7 +13949,7 @@ BUILDIN_FUNC(getsavepoint)
 	TBL_PC* sd;
 	TBL_PC* sd;
 	int type;
 	int type;
 
 
-	sd = script_rid2sd(st);
+	script_charid2sd(3,sd);
 	if (sd == NULL) {
 	if (sd == NULL) {
 		script_pushint(st,0);
 		script_pushint(st,0);
 		return 0;
 		return 0;
@@ -17905,8 +17937,9 @@ BUILDIN_FUNC(showdigit)
  **/
  **/
 BUILDIN_FUNC(makerune) {
 BUILDIN_FUNC(makerune) {
 	TBL_PC* sd;
 	TBL_PC* sd;
-	if( (sd = script_rid2sd(st)) == NULL )
-		return 0;
+	script_charid2sd(2,sd);
+	if (!sd)
+		return SCRIPT_CMD_FAILURE;
 	clif_skill_produce_mix_list(sd,RK_RUNEMASTERY,24);
 	clif_skill_produce_mix_list(sd,RK_RUNEMASTERY,24);
 	sd->itemid = script_getnum(st,2);
 	sd->itemid = script_getnum(st,2);
 	return SCRIPT_CMD_SUCCESS;
 	return SCRIPT_CMD_SUCCESS;
@@ -17916,8 +17949,9 @@ BUILDIN_FUNC(makerune) {
  **/
  **/
 BUILDIN_FUNC(checkdragon) {
 BUILDIN_FUNC(checkdragon) {
 	TBL_PC* sd;
 	TBL_PC* sd;
-	if( (sd = script_rid2sd(st)) == NULL )
-		return 0;
+	script_charid2sd(2,sd);
+	if (!sd)
+		return SCRIPT_CMD_FAILURE;
 	if( pc_isridingdragon(sd) )
 	if( pc_isridingdragon(sd) )
 		script_pushint(st,1);
 		script_pushint(st,1);
 	else
 	else
@@ -17938,8 +17972,9 @@ BUILDIN_FUNC(setdragon) {
 	TBL_PC* sd;
 	TBL_PC* sd;
 	int color = script_hasdata(st,2) ? script_getnum(st,2) : 0;
 	int color = script_hasdata(st,2) ? script_getnum(st,2) : 0;
 
 
-	if( (sd = script_rid2sd(st)) == NULL )
-		return 0;
+	script_charid2sd(3,sd);
+	if (!sd)
+		return SCRIPT_CMD_FAILURE;
 	if( !pc_checkskill(sd,RK_DRAGONTRAINING) || (sd->class_&MAPID_THIRDMASK) != MAPID_RUNE_KNIGHT )
 	if( !pc_checkskill(sd,RK_DRAGONTRAINING) || (sd->class_&MAPID_THIRDMASK) != MAPID_RUNE_KNIGHT )
 		script_pushint(st,0);//Doesn't have the skill or it's not a Rune Knight
 		script_pushint(st,0);//Doesn't have the skill or it's not a Rune Knight
 	else if ( pc_isridingdragon(sd) ) {//Is mounted; release
 	else if ( pc_isridingdragon(sd) ) {//Is mounted; release
@@ -17969,8 +18004,9 @@ BUILDIN_FUNC(setdragon) {
  **/
  **/
 BUILDIN_FUNC(ismounting) {
 BUILDIN_FUNC(ismounting) {
 	TBL_PC* sd;
 	TBL_PC* sd;
-	if( (sd = script_rid2sd(st)) == NULL )
-		return 0;
+	script_charid2sd(2,sd);
+	if (!sd)
+		return SCRIPT_CMD_FAILURE;
 	if( &sd->sc && sd->sc.data[SC_ALL_RIDING] )
 	if( &sd->sc && sd->sc.data[SC_ALL_RIDING] )
 		script_pushint(st,1);
 		script_pushint(st,1);
 	else
 	else
@@ -17986,8 +18022,9 @@ BUILDIN_FUNC(ismounting) {
  **/
  **/
 BUILDIN_FUNC(setmounting) {
 BUILDIN_FUNC(setmounting) {
 	TBL_PC* sd;
 	TBL_PC* sd;
-	if( (sd = script_rid2sd(st)) == NULL )
-		return 0;
+	script_charid2sd(2,sd);
+	if (!sd)
+		return SCRIPT_CMD_FAILURE;
 	if( &sd->sc && sd->sc.option&(OPTION_WUGRIDER|OPTION_RIDING|OPTION_DRAGON|OPTION_MADOGEAR) ) {
 	if( &sd->sc && sd->sc.option&(OPTION_WUGRIDER|OPTION_RIDING|OPTION_DRAGON|OPTION_MADOGEAR) ) {
 		clif_msgtable(sd->fd, NEED_REINS_OF_MOUNT);
 		clif_msgtable(sd->fd, NEED_REINS_OF_MOUNT);
 		script_pushint(st,0); //can't mount with one of these
 		script_pushint(st,0); //can't mount with one of these
@@ -18424,8 +18461,8 @@ BUILDIN_FUNC(npcskill)
 }
 }
 
 
 /* Consumes an item.
 /* Consumes an item.
- * consumeitem <item id>;
- * consumeitem "<item name>";
+ * consumeitem <item id>{,<char_id>};
+ * consumeitem "<item name>"{,<char_id>};
  * @param item: Item ID or name
  * @param item: Item ID or name
  */
  */
 BUILDIN_FUNC(consumeitem)
 BUILDIN_FUNC(consumeitem)
@@ -18434,7 +18471,9 @@ BUILDIN_FUNC(consumeitem)
 	struct script_data *data;
 	struct script_data *data;
 	struct item_data *item_data;
 	struct item_data *item_data;
 
 
-	nullpo_retr( 1, ( sd = script_rid2sd( st ) ) );
+	script_charid2sd(3, sd);
+	if (!sd)
+		return SCRIPT_CMD_FAILURE;
 
 
 	data = script_getdata( st, 2 );
 	data = script_getdata( st, 2 );
 	get_val( st, data );
 	get_val( st, data );
@@ -18512,7 +18551,7 @@ BUILDIN_FUNC(stand)
 }
 }
 
 
 /** Creates an array of bounded item IDs
 /** Creates an array of bounded item IDs
- * countbound {<type>};
+ * countbound {<type>{,<char_id>}};
  * @param type: 0 - All bound items; 1 - Account Bound; 2 - Guild Bound; 3 - Party Bound
  * @param type: 0 - All bound items; 1 - Account Bound; 2 - Guild Bound; 3 - Party Bound
  * @return amt: Amount of items found
  * @return amt: Amount of items found
  */
  */
@@ -18521,7 +18560,9 @@ BUILDIN_FUNC(countbound)
 	int i, type, j = 0, k = 0;
 	int i, type, j = 0, k = 0;
 	TBL_PC *sd;
 	TBL_PC *sd;
 
 
-	if( (sd = script_rid2sd(st)) == NULL )
+	script_charid2sd(3,sd);
+
+	if (!sd)
 		return SCRIPT_CMD_FAILURE;
 		return SCRIPT_CMD_FAILURE;
 
 
 	type = script_getnum(st,2);
 	type = script_getnum(st,2);
@@ -19156,7 +19197,7 @@ BUILDIN_FUNC(delspiritball) {
 }
 }
 
 
 /** Counts the spirit ball that player has
 /** Counts the spirit ball that player has
-* countspiritball {,<char_id>};
+* countspiritball {<char_id>};
 * @param char_id Target player (Optional)
 * @param char_id Target player (Optional)
 * @author [Cydh]
 * @author [Cydh]
 */
 */
@@ -19178,19 +19219,20 @@ BUILDIN_FUNC(countspiritball) {
 }
 }
 
 
 /** Merges separated stackable items because of guid
 /** Merges separated stackable items because of guid
-* mergeitem {<item_id>};
-* mergeitem {"<item name>"};
+* mergeitem {<item_id>,{<char_id>}};
+* mergeitem {"<item name>",{<char_id>}};
 * @param item Item ID/Name for merging specific item (Optional)
 * @param item Item ID/Name for merging specific item (Optional)
 * @author [Cydh]
 * @author [Cydh]
 */
 */
 BUILDIN_FUNC(mergeitem) {
 BUILDIN_FUNC(mergeitem) {
-	struct map_session_data *sd = script_rid2sd(st);
+	struct map_session_data *sd;
 	struct item *items = NULL;
 	struct item *items = NULL;
 	uint16 i, count = 0;
 	uint16 i, count = 0;
 	int nameid = 0;
 	int nameid = 0;
 
 
+	script_charid2sd(3, sd);
 	if (!sd)
 	if (!sd)
-		return SCRIPT_CMD_SUCCESS;
+		return SCRIPT_CMD_FAILURE;
 
 
 	if (script_hasdata(st, 2)) {
 	if (script_hasdata(st, 2)) {
 		struct script_data *data = script_getdata(st, 2);
 		struct script_data *data = script_getdata(st, 2);
@@ -19416,22 +19458,22 @@ struct script_function buildin_func[] = {
 	BUILDIN_DEF(getskilllv,"v"),
 	BUILDIN_DEF(getskilllv,"v"),
 	BUILDIN_DEF(getgdskilllv,"iv"),
 	BUILDIN_DEF(getgdskilllv,"iv"),
 	BUILDIN_DEF(basicskillcheck,""),
 	BUILDIN_DEF(basicskillcheck,""),
-	BUILDIN_DEF(getgmlevel,""),
-	BUILDIN_DEF(getgroupid,""),
+	BUILDIN_DEF(getgmlevel,"?"),
+	BUILDIN_DEF(getgroupid,"?"),
 	BUILDIN_DEF(end,""),
 	BUILDIN_DEF(end,""),
-	BUILDIN_DEF(checkoption,"i"),
-	BUILDIN_DEF(setoption,"i?"),
-	BUILDIN_DEF(setcart,"?"),
-	BUILDIN_DEF(checkcart,""),
-	BUILDIN_DEF(setfalcon,"?"),
-	BUILDIN_DEF(checkfalcon,""),
-	BUILDIN_DEF(setriding,"?"),
-	BUILDIN_DEF(checkriding,""),
-	BUILDIN_DEF(checkwug,""),
-	BUILDIN_DEF(checkmadogear,""),
-	BUILDIN_DEF(setmadogear,"?"),
-	BUILDIN_DEF2(savepoint,"save","sii"),
-	BUILDIN_DEF(savepoint,"sii"),
+	BUILDIN_DEF(checkoption,"i?"),
+	BUILDIN_DEF(setoption,"i??"),
+	BUILDIN_DEF(setcart,"??"),
+	BUILDIN_DEF(checkcart,"?"),
+	BUILDIN_DEF(setfalcon,"??"),
+	BUILDIN_DEF(checkfalcon,"?"),
+	BUILDIN_DEF(setriding,"??"),
+	BUILDIN_DEF(checkriding,"?"),
+	BUILDIN_DEF(checkwug,"?"),
+	BUILDIN_DEF(checkmadogear,"?"),
+	BUILDIN_DEF(setmadogear,"??"),
+	BUILDIN_DEF2(savepoint,"save","sii?"),
+	BUILDIN_DEF(savepoint,"sii?"),
 	BUILDIN_DEF(gettimetick,"i"),
 	BUILDIN_DEF(gettimetick,"i"),
 	BUILDIN_DEF(gettime,"i"),
 	BUILDIN_DEF(gettime,"i"),
 	BUILDIN_DEF(gettimestr,"si"),
 	BUILDIN_DEF(gettimestr,"si"),
@@ -19476,17 +19518,17 @@ struct script_function buildin_func[] = {
 	BUILDIN_DEF2(sc_start,"sc_start2","iiii???"),
 	BUILDIN_DEF2(sc_start,"sc_start2","iiii???"),
 	BUILDIN_DEF2(sc_start,"sc_start4","iiiiii???"),
 	BUILDIN_DEF2(sc_start,"sc_start4","iiiiii???"),
 	BUILDIN_DEF(sc_end,"i?"),
 	BUILDIN_DEF(sc_end,"i?"),
-	BUILDIN_DEF(getstatus, "i?"),
+	BUILDIN_DEF(getstatus, "i??"),
 	BUILDIN_DEF(getscrate,"ii?"),
 	BUILDIN_DEF(getscrate,"ii?"),
 	BUILDIN_DEF(debugmes,"s"),
 	BUILDIN_DEF(debugmes,"s"),
 	BUILDIN_DEF2(catchpet,"pet","i"),
 	BUILDIN_DEF2(catchpet,"pet","i"),
 	BUILDIN_DEF2(birthpet,"bpet",""),
 	BUILDIN_DEF2(birthpet,"bpet",""),
-	BUILDIN_DEF(resetlvl,"i"),
-	BUILDIN_DEF(resetstatus,""),
-	BUILDIN_DEF(resetskill,""),
-	BUILDIN_DEF(skillpointcount,""),
+	BUILDIN_DEF(resetlvl,"i?"),
+	BUILDIN_DEF(resetstatus,"?"),
+	BUILDIN_DEF(resetskill,"?"),
+	BUILDIN_DEF(skillpointcount,"?"),
 	BUILDIN_DEF(changebase,"i?"),
 	BUILDIN_DEF(changebase,"i?"),
-	BUILDIN_DEF(changesex,""),
+	BUILDIN_DEF(changesex,"?"),
 	BUILDIN_DEF(waitingroom,"si?????"),
 	BUILDIN_DEF(waitingroom,"si?????"),
 	BUILDIN_DEF(delwaitingroom,"?"),
 	BUILDIN_DEF(delwaitingroom,"?"),
 	BUILDIN_DEF2(waitingroomkickall,"kickwaitingroomall","?"),
 	BUILDIN_DEF2(waitingroomkickall,"kickwaitingroomall","?"),
@@ -19523,19 +19565,19 @@ struct script_function buildin_func[] = {
 	BUILDIN_DEF(failedremovecards,"ii"),
 	BUILDIN_DEF(failedremovecards,"ii"),
 	BUILDIN_DEF(marriage,"s"),
 	BUILDIN_DEF(marriage,"s"),
 	BUILDIN_DEF2(wedding_effect,"wedding",""),
 	BUILDIN_DEF2(wedding_effect,"wedding",""),
-	BUILDIN_DEF(divorce,""),
-	BUILDIN_DEF(ispartneron,""),
-	BUILDIN_DEF(getpartnerid,""),
-	BUILDIN_DEF(getchildid,""),
-	BUILDIN_DEF(getmotherid,""),
-	BUILDIN_DEF(getfatherid,""),
+	BUILDIN_DEF(divorce,"?"),
+	BUILDIN_DEF(ispartneron,"?"),
+	BUILDIN_DEF(getpartnerid,"?"),
+	BUILDIN_DEF(getchildid,"?"),
+	BUILDIN_DEF(getmotherid,"?"),
+	BUILDIN_DEF(getfatherid,"?"),
 	BUILDIN_DEF(warppartner,"sii"),
 	BUILDIN_DEF(warppartner,"sii"),
 	BUILDIN_DEF(getitemname,"v"),
 	BUILDIN_DEF(getitemname,"v"),
 	BUILDIN_DEF(getitemslots,"i"),
 	BUILDIN_DEF(getitemslots,"i"),
 	BUILDIN_DEF(makepet,"i"),
 	BUILDIN_DEF(makepet,"i"),
 	BUILDIN_DEF(getexp,"ii?"),
 	BUILDIN_DEF(getexp,"ii?"),
-	BUILDIN_DEF(getinventorylist,""),
-	BUILDIN_DEF(getskilllist,""),
+	BUILDIN_DEF(getinventorylist,"?"),
+	BUILDIN_DEF(getskilllist,"?"),
 	BUILDIN_DEF(clearitem,"?"),
 	BUILDIN_DEF(clearitem,"?"),
 	BUILDIN_DEF(classchange,"ii"),
 	BUILDIN_DEF(classchange,"ii"),
 	BUILDIN_DEF(misceffect,"i"),
 	BUILDIN_DEF(misceffect,"i"),
@@ -19557,7 +19599,7 @@ struct script_function buildin_func[] = {
 	BUILDIN_DEF(npcskilleffect,"viii"), // npc skill effect [Valaris]
 	BUILDIN_DEF(npcskilleffect,"viii"), // npc skill effect [Valaris]
 	BUILDIN_DEF(specialeffect,"i??"), // npc skill effect [Valaris]
 	BUILDIN_DEF(specialeffect,"i??"), // npc skill effect [Valaris]
 	BUILDIN_DEF(specialeffect2,"i??"), // skill effect on players[Valaris]
 	BUILDIN_DEF(specialeffect2,"i??"), // skill effect on players[Valaris]
-	BUILDIN_DEF(nude,""), // nude command [Valaris]
+	BUILDIN_DEF(nude,"?"), // nude command [Valaris]
 	BUILDIN_DEF(mapwarp,"ssii??"),		// Added by RoVeRT
 	BUILDIN_DEF(mapwarp,"ssii??"),		// Added by RoVeRT
 	BUILDIN_DEF(atcommand,"s"), // [MouseJstr]
 	BUILDIN_DEF(atcommand,"s"), // [MouseJstr]
 	BUILDIN_DEF2(atcommand,"charcommand","s"), // [MouseJstr]
 	BUILDIN_DEF2(atcommand,"charcommand","s"), // [MouseJstr]
@@ -19565,14 +19607,14 @@ struct script_function buildin_func[] = {
 	BUILDIN_DEF(message,"ss"), // [MouseJstr]
 	BUILDIN_DEF(message,"ss"), // [MouseJstr]
 	BUILDIN_DEF(npctalk,"s"), // [Valaris]
 	BUILDIN_DEF(npctalk,"s"), // [Valaris]
 	BUILDIN_DEF(mobcount,"ss"),
 	BUILDIN_DEF(mobcount,"ss"),
-	BUILDIN_DEF(getlook,"i"),
-	BUILDIN_DEF(getsavepoint,"i"),
+	BUILDIN_DEF(getlook,"i?"),
+	BUILDIN_DEF(getsavepoint,"i?"),
 	BUILDIN_DEF(npcspeed,"i"), // [Valaris]
 	BUILDIN_DEF(npcspeed,"i"), // [Valaris]
 	BUILDIN_DEF(npcwalkto,"ii"), // [Valaris]
 	BUILDIN_DEF(npcwalkto,"ii"), // [Valaris]
 	BUILDIN_DEF(npcstop,""), // [Valaris]
 	BUILDIN_DEF(npcstop,""), // [Valaris]
 	BUILDIN_DEF(getmapxy,"rrri?"),	//by Lorky [Lupus]
 	BUILDIN_DEF(getmapxy,"rrri?"),	//by Lorky [Lupus]
-	BUILDIN_DEF(checkoption1,"i"),
-	BUILDIN_DEF(checkoption2,"i"),
+	BUILDIN_DEF(checkoption1,"i?"),
+	BUILDIN_DEF(checkoption2,"i?"),
 	BUILDIN_DEF(guildgetexp,"i"),
 	BUILDIN_DEF(guildgetexp,"i"),
 	BUILDIN_DEF(guildchangegm,"is"),
 	BUILDIN_DEF(guildchangegm,"is"),
 	BUILDIN_DEF(logmes,"s"), //this command actls as MES but rints info into LOG file either SQL/TXT [Lupus]
 	BUILDIN_DEF(logmes,"s"), //this command actls as MES but rints info into LOG file either SQL/TXT [Lupus]
@@ -19592,7 +19634,7 @@ struct script_function buildin_func[] = {
 	BUILDIN_DEF(deletepset,"i"), // Delete a pattern set [MouseJstr]
 	BUILDIN_DEF(deletepset,"i"), // Delete a pattern set [MouseJstr]
 #endif
 #endif
 	BUILDIN_DEF(preg_match,"ss?"),
 	BUILDIN_DEF(preg_match,"ss?"),
-	BUILDIN_DEF(dispbottom,"s?"), //added from jA [Lupus]
+	BUILDIN_DEF(dispbottom,"s??"), //added from jA [Lupus]
 	BUILDIN_DEF(recovery,"i???"),
 	BUILDIN_DEF(recovery,"i???"),
 	BUILDIN_DEF(getpetinfo,"i"),
 	BUILDIN_DEF(getpetinfo,"i"),
 	BUILDIN_DEF(gethominfo,"i"),
 	BUILDIN_DEF(gethominfo,"i"),
@@ -19644,8 +19686,8 @@ struct script_function buildin_func[] = {
 	BUILDIN_DEF(setbattleflag,"si"),
 	BUILDIN_DEF(setbattleflag,"si"),
 	BUILDIN_DEF(getbattleflag,"s"),
 	BUILDIN_DEF(getbattleflag,"s"),
 	BUILDIN_DEF(setitemscript,"is?"), //Set NEW item bonus script. Lupus
 	BUILDIN_DEF(setitemscript,"is?"), //Set NEW item bonus script. Lupus
-	BUILDIN_DEF(disguise,"i"), //disguise player. Lupus
-	BUILDIN_DEF(undisguise,""), //undisguise player. Lupus
+	BUILDIN_DEF(disguise,"i?"), //disguise player. Lupus
+	BUILDIN_DEF(undisguise,"?"), //undisguise player. Lupus
 	BUILDIN_DEF(getmonsterinfo,"ii"), //Lupus
 	BUILDIN_DEF(getmonsterinfo,"ii"), //Lupus
 	BUILDIN_DEF(addmonsterdrop,"vii"), //Akinari [Lupus]
 	BUILDIN_DEF(addmonsterdrop,"vii"), //Akinari [Lupus]
 	BUILDIN_DEF(delmonsterdrop,"vi"), //Akinari [Lupus]
 	BUILDIN_DEF(delmonsterdrop,"vi"), //Akinari [Lupus]
@@ -19740,11 +19782,11 @@ struct script_function buildin_func[] = {
 	/**
 	/**
 	 * 3rd-related
 	 * 3rd-related
 	 **/
 	 **/
-	BUILDIN_DEF(makerune,"i"),
-	BUILDIN_DEF(checkdragon,""),//[Ind]
-	BUILDIN_DEF(setdragon,"?"),//[Ind]
-	BUILDIN_DEF(ismounting,""),//[Ind]
-	BUILDIN_DEF(setmounting,""),//[Ind]
+	BUILDIN_DEF(makerune,"i?"),
+	BUILDIN_DEF(checkdragon,"?"),//[Ind]
+	BUILDIN_DEF(setdragon,"??"),//[Ind]
+	BUILDIN_DEF(ismounting,"?"),//[Ind]
+	BUILDIN_DEF(setmounting,"?"),//[Ind]
 	BUILDIN_DEF(checkre,"i"),
 	BUILDIN_DEF(checkre,"i"),
 	/**
 	/**
 	 * rAthena and beyond!
 	 * rAthena and beyond!
@@ -19759,7 +19801,7 @@ struct script_function buildin_func[] = {
 	BUILDIN_DEF(cleanmap,"s"),
 	BUILDIN_DEF(cleanmap,"s"),
 	BUILDIN_DEF2(cleanmap,"cleanarea","siiii"),
 	BUILDIN_DEF2(cleanmap,"cleanarea","siiii"),
 	BUILDIN_DEF(npcskill,"viii"),
 	BUILDIN_DEF(npcskill,"viii"),
-	BUILDIN_DEF(consumeitem,"v"),
+	BUILDIN_DEF(consumeitem,"v?"),
 	BUILDIN_DEF(delequip,"i?"),
 	BUILDIN_DEF(delequip,"i?"),
 	BUILDIN_DEF(breakequip,"i?"),
 	BUILDIN_DEF(breakequip,"i?"),
 	BUILDIN_DEF(sit,"?"),
 	BUILDIN_DEF(sit,"?"),
@@ -19782,7 +19824,7 @@ struct script_function buildin_func[] = {
 	//Bound items [Xantara] & [Akinari]
 	//Bound items [Xantara] & [Akinari]
 	BUILDIN_DEF2(getitem,"getitembound","vii?"),
 	BUILDIN_DEF2(getitem,"getitembound","vii?"),
 	BUILDIN_DEF2(getitem2,"getitembound2","viiiiiiiii?"),
 	BUILDIN_DEF2(getitem2,"getitembound2","viiiiiiiii?"),
-	BUILDIN_DEF(countbound, "?"),
+	BUILDIN_DEF(countbound, "??"),
 
 
 	// Party related
 	// Party related
 	BUILDIN_DEF(party_create,"s???"),
 	BUILDIN_DEF(party_create,"s???"),
@@ -19805,7 +19847,7 @@ struct script_function buildin_func[] = {
 	BUILDIN_DEF(addspiritball,"ii?"),
 	BUILDIN_DEF(addspiritball,"ii?"),
 	BUILDIN_DEF(delspiritball,"i?"),
 	BUILDIN_DEF(delspiritball,"i?"),
 	BUILDIN_DEF(countspiritball,"?"),
 	BUILDIN_DEF(countspiritball,"?"),
-	BUILDIN_DEF(mergeitem,"?"),
+	BUILDIN_DEF(mergeitem,"??"),
 
 
 #include "../custom/script_def.inc"
 #include "../custom/script_def.inc"