Jump to content

Recommended Posts

Posted (edited)

Replies can be posted here: http://rathena.org/board/topic/91431-re-script-commands-additionsupdates/


This topic serves the purpose of informing everyone of new and updated script commands.  This topic will not include updates to the scripting system (commits posted here might contain some though).
 
Command: addrid
Bug Report or Suggestion - Topic #84892
Revision Added/Updated - 6572a9f
Notes - Added addrid command for management of attaching more RIDs.
 
Command: party* commands
Bug Report or Suggestion - Topic #82922
Revision Added/Updated - r17414r17415
Notes - Added party related script commands for party management.
 
Command: countbound
Bug Report or Suggestion - Topic #70372
Revision Added/Updated - r17351
Notes - Counts number of bounded items on a character.  Also builds a list using @bound_items.
 
Command: getitembound and getitembound2
Bug Report or Suggestion - Topic #70372
Revision Added/Updated - r17351
Notes - Gives a character a bounded item.

Command: getequipisidentify
Bug Report or Suggestion - N/A
Revision Added/Updated - r17341
Notes - Command removed because it was useless.

Command: addmonsterdrop and delmonsterdrop
Bug Report or Suggestion - N/A
Revision Added/Updated - r17326
Notes - Temporarily add or delete drops from mobs.  Will be overwritten on server restart or mob db reload.  Check script_commands.txt documentation for usage.
 
Command: sc_start#
Bug Report or Suggestion - bugreport:7664
Revision Added/Updated - r17326
Notes - sc_start in scripting now offers much more versatility.  Check script_commands.txt documentation for more information.
 
Command: recovery
Bug Report or Suggestion -Topic #82374
Revision Added/Updated - r17321
Notes - Recovery command now allows for a multitude of healing options.  Check script_commands.txt documentation for more information.
 
Command: unitwalk
Bug Report or Suggestion - bugreport:7626
Revision Added/Updated - r17311
Notes - Command was updated from a non-working state.

 

Undocumented changes can be looked up in GitHub commit history.

Edited by Secrets
Added commit log
  • Upvote 7
  • 1 month later...
  • 3 months later...
Posted

bonus_script "<script code>",<duration>{,<flag>{,<type>{,<char_id>}}}

This command will attach a script to a player for a given duration, in seconds.

After that time, the script will automatically expire. The same bonus cannot be
stacked.
 
Note that the maximum number of 'bonus_script' commands that can run simultaneously
for a player is 20 (MAX_PC_BONUS_SCRIPT in 'src/map/pc.h').
 
Flags:
&1: Remove when dead.
&2: Removable by Dispell.
&4: Removable by Clearance.
&8: Remove when logout.
 
Types:
0: Buff
1: Debuff
 
Example:
  // Apple gives you +5 Str bonus for 1 minute when it's consumed.

  512,Apple,Apple,0,15,,20,,,,,0xFFFFFFFF,63,2,,,,,,{ bonus_script "{ bonus bStr,5; }",60; },{},{}

  • Upvote 5
  • 1 month later...
Posted
getgroupitem(group_id)

commit: 51074a0
Gives item(s) to the attached player based on item group's contents.
This is not working like 'getrandgroupitem' which only give 1 item for specified item group.
Can use const data for 'group_id', see db/const.txt at 'Item Group ID' section
The item(s) that will be gained depends on the probability and random group for each item group, see db/[pre-]re/item_group_db.txt for available item group.
More info, about this script command and new item group structure, please read doc/item_group.txt


 
updated 'grouprandomitem'

commit: 51074a0
Added 1 optional param 'sub_group' to support new item group structure.
groupranditem(group_num{,sub_group})


 
updated 'getrandgroupitem'

commit: 51074a0
Added 1 optional param 'sub_group' to support new item group structure.
getrandgroupitem(group_id{,quantity{,sub_group}})

  • Upvote 1
  • 2 weeks later...
Posted

EDIT: includes some additional changes in 834f3ba.

Not technically script commands, but anyway~ With the intent of making npc/other/Global_Functions.txt more useful, I've added the following functions in 97687ca:

  • "F_GetPlural": Returns the plural of a noun - only follows basic rules, with few exceptions!

    callfunc "F_GetPlural","<noun>"{,<0:normal/1:uppercase>}
    
    // Examples:
    callfunc("F_GetPlural","dog")    // returns "dogs"
    callfunc("F_GetPlural","fox",1)  // returns "FOXES"
    callfunc("F_GetPlural","knife")  // returns "knives"
  • "F_InsertPlural": Returns the plural of a noun if the given number is not 1. <format string> uses sprintf(), and MUST contain %d (arg0) and %s (arg1), in that order.

    callfunc "F_InsertPlural",<number>,"<noun>"{,<0:normal/1:uppercase>{,"<format string>"}}
    
    // Examples:
    callfunc("F_InsertPlural",1,"dog")    // returns "1 dog"
    callfunc("F_InsertPlural",3,"fox",1)  // returns "3 FOXES"
    callfunc("F_InsertPlural",5,"knife",0,"^FF0000%d^000000 %s")  // returns "^FF00005^000000 knives"
  • "F_InsertArticle": Returns 'a' or 'an' based on a word - only follows basic rules, without exceptions!

    callfunc "F_InsertArticle","<word>"{,<0:lowercase a/1:uppercase A>}
    
    // Examples:
    callfunc("F_InsertArticle","apple")  // returns "an apple"
    callfunc("F_InsertArticle","dog",1)  // returns "A dog"
  • "F_InsertComma": Returns a number with commas between every three digits.

    callfunc "F_InsertComma",<number>
    
    // Examples:
    callfunc("F_InsertComma",7777777)  // returns "7,777,777"
  • "F_GetNumSuffix": Returns a number with a '-st', '-nd', '-rd', or '-th' suffix.

    callfunc "F_GetNumSuffix",<number>
    
    // Examples:
    callfunc("F_GetNumSuffix",1)   // returns "1st"
    callfunc("F_GetNumSuffix",11)  // returns "11th"
    callfunc("F_GetNumSuffix",32)  // returns "32nd"
  • Upvote 3
  • 2 weeks later...
Posted
isbegin_quest(<ID>)

commit: a3dbbe2
Return the state of the quest:
0 = Quest not started (not in quest log)
1 = Quest has been given (state is either "inactive" or "active")
2 = Quest completed

Not very significant, but an alternative to Checkquest(ID,HASQUEST) that's better in most situations.
  • Upvote 1
Posted
strcmp("<string>","<string>")

commit: d569d28
This command compares two strings are returns a value:
1: string 1 > string 2
0: strings are equal
-1: string 1 < string 2

Don't know how this wasn't in the emulator for so long - it should open up a lot more scripting possibilities. ^^
  • Upvote 1
  • 3 weeks later...
Posted
preg_match(<regex pattern>,<string>{,<offset>})

commit: 957f495
Searches a string for a match to the regular expression provided. The offset parameter indicates the index of the string to start searching. Returns offsets to captured substrings, or 0 if no match is found.


This command is only available if the server is compiled with the regular expressions library enabled.For some examples, read the "F_GetArticle" function in 957f495#diff-1.
Posted
enable_command()

commit: 0310870
Player can use atcommand while interacting with NPC


disable_command()

commit: 0310870
Player cannot use atcommand while interacting with NPC

  • 3 months later...
Posted

updated instance_enter

commit: 1f426bc, d068dff, 233d7ac
Added 2 optional parameters 'x' and 'y'
instance_enter("<instance name>"{,<x>,<y>});

cartdelitem <item id>,<amount>{,<account ID>}

commit: 01c30bf
Delete item from player's inventory

storagedelitem <item id>,<amount>{,<account ID>}

commit: 01c30bf
Delete item from player's storage

cartcountitem <item id&gt

commit: 01c30bf
Count item from player's inventory

storagecountitem <item id&gt

commit: 01c30bf
Count item from player's storage

Well, also the cartdelitem2, storagedelitem2, cartcountitem2, and storagecountitem2.
  • Upvote 3
  • 2 years later...
Posted

petheal

commit: d20cbca
Deprecated 'petheal' script command has been removed. Please update your pets with the appropriate petskillsupport command.

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...