Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- proc(_extractValue, @stringToCheck, @key,
- msg(concat('String to check: ', @stringToCheck))
- @regx_header = "\\@"; # Regular expression header
- @regx_footer = "([\\w\\d\\s\\n.]+[^\\@])"; # Regular expression footer
- @regx_pattern = concat(@regx_header, @key, @regx_footer); # Create the regular expression using the supplied key
- msg(concat('Regex Pattern Used: ', @regx_pattern))
- @result = reg_match(@regx_pattern, @stringToCheck); # Check the string for results
- if (array_size(@result) > 1){ # Check to see if the result of the match is greater than 1 which means we found the pattern and the capture group
- msg(@result[1])
- return (@result[1]); # Return the capture group
- }
- msg('no results');
- msg(concat('Result Returned: ', @result))
- return (null); # No results found
- )
- register_command(createhero,
- array(
- description: 'Generates a Hero using parameters within a book',
- usage: '/createhero',
- permission: 'essentials.copybook',
- noPermMsg: 'Sorry you don\'t have permission to use this command.',
- executor: closure(@alias, @sender, @args) {
- @hero_name = null;
- @playerThatRanCmd = player(); # Create a player object
- @slotHighlighted = pheld_slot(@playerThatRanCmd)
- @itemInHand = pinv(@playerThatRanCmd, @slotHighlighted); # Grab the ID of the item in the players hand
- @itemMeta = get_itemmeta(@slotHighlighted); # Grab the meta data
- @pages = @itemMeta['pages']; # Grab all the pages of the book
- @hero_name = _extractValue(@pages, "name:");
- msg(@hero_name);
- }
- )
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement