There's a way to import choices from files?

Login or register to post comments
Thu, 2009-11-26 11:07
Parduz
Parduz's picture

I'd like to be able to import a file to add new choices in field for a card set i'm building for a miniature skirmish game. This way adding new/custom rules from other player will not require to tamper the set.
There's any way to do this?

Thu, 2009-11-26 16:52
Pichoro
Pichoro's picture

No - you have to modify the game and/or style files to do this. What you're seeking isn't possible.

Thu, 2009-11-26 17:19
Parduz
Parduz's picture

Ok... i'm still very ignorant about the MSE templates, so maybe i'm asking something stupid: there's a way to keep that list of choices "away" from the "core" files?
Something like "including" a file containing only that choices (or only that choice field) in the main "Game" or "Style" files?
Just to keep it separated from all the other stuffs...

Thu, 2009-11-26 21:16
Pichoro
Pichoro's picture

There is an "include" key, but here's the thing - you have to edit the game or style to add the "include" line. So its really just for organizing the game and files and breaking them into smaller more manageable pieces, not for adding custom stuff.

There is no way to package template additions in a set file for distributing. That just isn't how it works.

Sat, 2009-11-28 15:29
Parduz
Parduz's picture

Ok, i got it:
from here: http://magicseteditor.sourceforge.net/node/2136 i learned the word list.
Now i have it in a included file, and it is the closest situation to what i wanted.

Now, new question arises:

  1. there's a way to add the choice i click from that wordlist to a text field? so i can have a text field saying "Choice01, Choice33, Choice12" (suppose that "Choicexx" is what i have in my wordlist)?
  2. There's a way to associate a cost to each choice, and have the sum of the choosen ones?
  3. Not really related to this, but i dunno if it's better to open another thread: How can i use variables (or Constants) to set Top, width and other field properties? It will make easy to do multiple styles where the only things that changes are field placement...
    And: can i build arrays? I'm a C programmer, but MSE template confuses me...
Thanks for your help.

Sat, 2009-11-28 16:23
Liosan
Liosan's picture

Hi,

1. could you be more specific? It would probably be possible to do something along the lines of "when a user selects a value from the word list, add it to a text field and reset the choice", but MSE isn't really built for this kind of behaviour, so it might by quirky.
2. Maybe a literal map would help? http://magicseteditor.sourceforge.net/doc/type/map
3a. something along the lines of top: script: if (whatever())) then 100 else 50 ? I'm not sure about variables and constants, but you can extend card objects in your game file (card.var). You can also extend the style using "styling field:", which allows a per-card setting of style-level variables inside of MSE.
3b. no arrays AFAIK, but there are lists - a literal list is "[a,b,c]", an empty list is "[]", and you can concatenate lists with + (this one isn't in the docs, but I asked Twan about it Winking smiley). Works like any functional language (not quite like C, though... Winking smiley but random access is allowed, so you should be fine).

One more thing about using the MSE scripting language - it uses dynamic scoping. Other than that, it's more or less straightforward.

Liosan

Sat, 2009-11-28 17:24
Parduz
Parduz's picture

  1. Exactly what i need.
  2. Interesting.... So, joining points [1] and [2], what i'd like to do when a user pick one word from the wordlist is:
    1. Add the picked word (call it "Ability") to the text field, separating the words by a comma
    2. Sum the cost value of that Ability (having it from the Abilties Map) to a variable (TotalCost). BUT, since a user should be able to remove a choosen Ability, and i see it only possible by manually deleting it from the text field, the TotalCost computation should become:
      1. Reset TotalCost
      2. Take the text field string and split it using the comma as separator, stripping spaces at the beginning and at the end of the (now isolated) Ability name
      3. Loop through this array of Ability names to retrieve the related cost from the Abilities Map, and add this value to TotalCost
      4. Update the TotalCost text field
    3. Now, if someone can help me to traslate this in MSE scripts....
  3. Even more simple than this: suppose to have some variables called Field1Top,Field1Left,Field2Top... and a file, included, which defines the fields position using that variables. When i want to do another style, i (may) have just to set that variables to a new value, and include the fields definition file....
Thanks for your help, and sorry if i'm not clear about what i want... as you may have guessed Big smile english is not my native language.