Problem with # in sharp scripts
Somehow i cant use sharp scripts. It think the Cocomud don't accept the #-symbol for the process cause the mud sending me messages as it would be a command.
Do i have to activate the sharp script somewhere in a configuration? Or is it another problem with the language configuration?
Or are there two different keys for the #-symbol and i am only using the wrong symbol?
#1 Updated by Vincent Le Goff over 1 year ago
- Tracker changed from Feature to Bug
- Status changed from Open to Feedback
- Assignee set to Vincent Le Goff
SharpScript uses the
# symbol as its beginning, to indicate what follows is a SharpScript instruction. You can bypass this behavior by entering two symbols
##. This will be ignored by the SharpScript engine and will allow a simple
# symbol. Using symbols in triggers shouldn't confuse the engine, however, except if the
# symbol is at the beginning of the line (which is possible, but not likely). Could you provide more context on when the situation occurs? It's not impossible something is wrong with the engine at all, of course!
#3 Updated by Vincent Le Goff over 1 year ago
Ho, that is correct! SharpScript isn't accessible through the input field anymore. Users complained it interfered with their commands to send to the MUD, and it seemed logical. I will offer a quick toggle checkbox to decide to use SharpScript in the input field, or to send it anyway to the MUD server. The documentation should be updated, indeed.
In the meantime, to create macros, I'm afraid you will have to go through the interface. But it shouldn't be too complicated, just not as time-effective.
#7 Updated by Francisco Del Roio 5 months ago
I was investigating this with a breakpoint put in line 254 of client.py and I found that if you execute
self.factory.sharp_engine.client == self it returns False, indicating that the sharp engine sends all commands to the incorrect client, not only macros but aliases too.
I will take a look to sharp engine and see if I can solve this.
#8 Updated by Vincent Le Goff 5 months ago
This might be tied to #136 more, as a matter of fact. Since in most cases SharpScript is executed from the client itself, I guess I didn't properly check the bound client was correctly tied. If you look at the logs, they should indicate that, on opening a world and connecting, a client is created, then a sharp engine with a specific ID. This sharp engine should be unique for each client. So that's probably where it goes haywire.
#11 Updated by Vincent Le Goff 5 months ago
- Category set to Customization
- Status changed from Feedback to Closed
- % Done changed from 0 to 100
It has been some time! We're going to offer an alternative (in beta) for the next version. Instead of writing SharpScript directly in the input window (which created problems for other users), I created a SharpScript console, identical to the Python console. Basically you open it and can type the SharpScript examples that were given in the documentation. The documentation itself will be updated. For now, this feature isn't stable yet and we'll need feedback from users to know how good it is, but I believe this would make configuration much easier. The SharpScript console is actually able to handle multi-line triggers, if you want to type in Python code for instance.
This was introduced in Feature #138: Add a SharpScript editor in the menu bar. It will be accessible in a few days with the next version of CocoMUD.
Please register to edit this issue