Soo, I come up with another problem. Also, I'm sorry if it's not clear enough. I'm bad at explaining things.
First of all, here is what I'm trying to do:
JS.setCustomStatus ("Party:" + player.party)
player.party = NewObjectList()
I tried to switch the order but it became messed up. The code above is also not working when I tried to do it last time.
(Most of the posts mention HTML. I think I really should learn it soon lol)
I'm sorry for the troubles and the many questions. Just wish I don't have to create new topics many times. (._.)
Either way, I'm sorry if I can't check or reply anytime soon due to my current schedule. Wish the holiday is a bit longer~
Hmm, I don't know enough about JScript to help with this, sorry.
Also, I'm not SURE, but I don't know if object attributes can be object lists? The game doesn't give it as an option, I know that much.
JS.setCustomStatus ("Party:" + player.party) player.party = NewObjectList()
The first thing I notice is that you're casting an objectlist to a string. This will probably make your status pane look something like: "Party: List: Object: Dave, Object: John, Object: Rick". - I'm pretty sure that isn't what you want.
Secondly, do you really want to set player.party
to an empty list every time it's displayed?
Oh, you're doing this in the start script. Are you calling setCustomStatus
again when a party member is added or removed later? The contents of the custom status pane only change when you call it manually.
Next, I also plan to have the GetInput being limited. I mean, related to my previous post, I wanted to have the players input only alphabets for their name and not including symbols or numbers.
if (IsRegexMatch ("[^A-Za-z ]", result)) {
msg ("That isn't a valid name!")
}
Or if you want to be a little more fancy, you could use the jquery mask plugin, which allows you to put restrictions on the textbox so that disallowed characters don't even appear.
Not really important, but can I actually imitate the status pane? Like, making it a drop-down-list-like...
Do you mean putting party members in a different box that works like the "inventory" and "placesobjects" panes?
I wrote a script a while back to make a 3rd pane for a spellbook, which I think should be adaptable.
It's a pretty large chunk of code, though.
A little thought about restricting input.
How about:
JS.eval("$('#txtCommand').on('input', function () {$(this).val($(this).val().replace(/[^A-Za-z ]/, ''));});")
Removes all characters except from A-Z, a-z, and space from the command bar every time the user changes its contents.
Can be reverted by using:
JS.eval("$('#txtCommand').off('input')");
if you want to allow numbers at some point.
Sorry for the late reply.
@mrangel thanks for the help, though. It's all working. Just a little question, though, for the list in the JS.setCustomStatus. I did try recalling the javascript every time I want it to update, but it doesn't seem to be working, as expected. Any idea about adding the list of party members in the status pane?
Also, what should I do if I want to convert library code in notepad into a format readable by Quest?