Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

UMS Shortcut Feature, Syntax Errors...

Status
Not open for further replies.
I'm trying to use ccoa's UMS's Shortcut feature...

Shortcuts

This is maybe the most fun part of the script. If there is a message code, or series of message codes, you're using a lot, you can define a shortcut to use instead of typing them out. To define a shortcut, use the following code in a Script:

$game_system.set_shortcut('shortcutcode', 'messagecode')

Note that you must use the single quotes ('), not double quotes (").

For example, I might be having a conversationg between two characters, Bob and Rex. Both have face graphics, and I want to switch the justification when each one talks. I could do this:

text: \nm[Bob]\face[bob]\flHi, Rex.
text: \nm[Rex]\face[rex]\frHey, Bob.
text: \nm[Bob]\face[bob]\flWhat shall we do today, Rex?
text: \nm[Rex]\face[rex]\frDunno.

And so on. Or I could do this:

Script: $game_system.set_shortcut('\c1', '\nm[Bob]\face[bob]\fl')
$game_system.add_shortcut('\c2', '\nm[Rex]\face[rex]\fr')
text: \c1Hi, Rex.
text: \c2Hey, Bob.
text: \c1What shall we do today, Rex?
text: \c2Dunno.

Much better.

Note that you cannot use any of the reserved codes as a shortcut. The reserved codes are:

'\v', '\n', '\c', '\g', '\skip', '\m', '\height', '\width',
'\jr', '\jc', '\jl', '\face', '\fl', '\fr', '\b', '\i', '\s',
'\e', '\t1', '\t2', '\th', '\nm', '\font', '\p', '\w', '\ws',
'\oa', '\oi', '\os', '\ow', '\tl', '\tr', '\tc', '\ignr',
'\shk', '\slv', '\ind', '\inc'

And I have put a script into an event on a bookcase that has a lot of text...
The script is the FIRST thing on my event...

It reads like this:
$game_system.set_shortcut('\bt','\nm[Briar]\i')

And when I activate that event in game, it says "SyntaxError occurred while running script."

What am I doing wrong?

Thank you!
 
arsieiuni;238583 said:
$game_system.set_shortcut('\bt','\nm[Briar]\i')

I'm no expert, butI think that this line should be:

Code:
$game_system.set_shortcut('[B]\b1[/B]','\nm[Briar]\i')

Check out the bold part. I think there has to be a number in the shortcut in order to work.

If that doesn't work for you then I suggest you put the script in a new project. If it works there then you probably have a script conflicting with it. If it doesn't work for you there then the UMS script is defective and I suggest you download a new copy of it and try that one.
 
---------------------------
I tried copying that line instead and I got this:
---------------------------
NoMethodError occurred while running script.

undefined method `set_shortcut' for #<Game_System:0x1505f00>
---------------------------
So no idea now... does that shed light or put us further in the dark?
---------------------------
 
You might have to reinstall the script. I suggest trying it on a new project [start a new project]. If the script does the same thing then you'll have to talk to ccoa about it. If it doesn't do that in the new project then there's something wrong with your project. It might be conflicting with a script you added.


Do you use SDK?
 

Jonny

Member

Ok, it's not set_shortcut it's add_shortcut. So instead of
Code:
$game_system.set_shortcut('\b1','\nm[Briar]\i')

It should be:
Code:
$game_system.add_shortcut('\b1','\nm[Briar]\i')
 
Oh thank goodness! That fixed it!

Just one question here... Do you need to insert the shortcut definition script on each map for them to work? Where do I place this script in order to get the shortcuts to run throughout the game?


And no, you have it say set twice and add once... I missed that it ever said add because I had stopped reading word for word and skimmed once I read the first sentence's syntax.


Thanks so much! :)
 
This topic has been resolved. If arsieiuni or any other users have any questions or further problems regarding this topic, please create a new thread about them.

Thank you!
 
Status
Not open for further replies.

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top