Executing commands with quotes
I've been trying to figure this one out for a while. I've been wanting to make my click to cast buttons support quotes without having to relog, but to no avail.
I'm not really sure where the code interpreter is screwing up though. Think about this happening during runtime, not in code before the game is excuted, because that's not where the problems happen. Method 1: An input field is filled out and saved to a variable: useability Lucan's PactSo.... Abilities.cmd1 = useability Lucan's Pact Now I want to take that command and stick it on a button so it can execute the command. So I make a physical button that when pressed pulls the correct code and puts it in another button and then presses that (so it can run the command). So inside Button1: Parent.Button2.onpress = Parent.Abilities.cmd1 Press the button in-game, nothing happens..... Change it to an ability WITHOUT an apostrophe and it works fine. Method 2: Okay, lets change the original text to Abilities.cmd1 = Lucan's Pact (so there's no more command in front of it) And lets changed Button1 to: useability Parent.Abilities.cmd1 Okay, that works perectly... But why can't method 1 work?! Where is it failing to execute properly? It should be reading: Button2.onpress="useability Lucan's Pact" within the game, but it's apparently not :mad: Does anyone have any ideas? |
Oooh that is frustrating. I'm going to have to think on that a minute. :confused:
|
Are you sure that Abilities.cmd1 = useability Lucan's Pact does actually get executed like that in your m1? Try to change the command in method 1 to a beginchatinput (or say) to see if that works at all (and if the part after the apostrophe is included).
|
That was the other strange part, I actually use the say command to debug a lot, too.
I tried doing a: say Parent.Abilities.cmd1And: say Parent.Button2.onpressBoth wit the same results, showing the full string with the apostrophe. Drumstixx says, "useability Lucan's Pact" When the button fails, I get nothing ingame. Usually if the spell is incorrectly typed, it would just say "This ability does not exist" but I don't even get that. |
Yeah but what I meant was try to change the usability to a say and see what happens then. Although you might not see what's happening, might be some encoding issue with the usability code choking on the Apostrophe and the parser not interpreting it right when loaded into a variable along with the command. You could also try to set
var1 = usability var2 = Lucan's Pact OnPress = var1 ## var2 and see what happens then. |
Method 1 is what I currently use in my UI now btw.
I went and tried what you said. Without an apostrophe it'll do a say command perfectly. Soon as I add the apostrophe in, I get nothing. No text, no say, and no error/feedback. I can populate the tooltip just fine with the apostrophe, which boggles me further. |
Just one of the bugs with the parser then, at least I don't have an idea around it (except the other part of my previous post but that's no real solution I guess even if it works).
edit: maybe you could try to add an extraneous single quote at the end of the command ## " '", dunno if that executes then even if it does get parsed correctly (which I don't know either). |
Yeah, if I change the text from:
useability Lucan's Pact To: Lucan's Pact And then in button 1 just put: useability Parent.Abilities.cmd1 It works... But the point of the mod was to have complete control over the commands without having to do things step by step. It just seems like a parser error to me too :( Everything works otherwise, multiple lines, multiple commands. It's just the single apostrophes that kill it. I can wrap things like an exclamation point in single quotes '!' and it works fine. *edit* Adding a random quote to the end of the Useability command will think it's part of the spell name and spit back the "Ability not found". Though I didn't try it within the code yet, so we'll see. I have my doubts. And adding a random quote at the end of my normal edit window just makes it show up as: Drumstixx says, "Lucans Pact" |
haha, I figured out a solution. But it's gotta be done during runtime in that "editing text" step.
I tried wrapping the single quote in double quotes, but that made a space. So I tried putting the second double quote at the end of the command and that works fine. But it also works fine if I just put the quote after the slash command portion. So the text editing part ultimately becomes: useability "Lucan's Pact" And since it's saving that to an element, it doesn't read the double quotes on executed (which would normally break the slash command functionality) WOOT This is a better solution than having to relog to fix single quotes! Nice thing about that is I can just recommend to wrap everything in double quotes and players won't have to worry about special characters like exclamation points and apostrophes in their messages. say "drum's testing! special# characters?" |
Quote:
|
lol tell them not to use "? People read?
|
Quote:
|
All times are GMT -5. The time now is 07:08 PM. |
vBulletin® - Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
© MMOUI