Jump to content

Spinor

Member
  • Content Count

    208
  • Joined

  • Last visited

  • Medals

Posts posted by Spinor


  1. As you used format, _Call02 is nothing but a string, and if you choose _Txt1 to match it, it should, well, match tounge_o.gif.

    Try to check the wording again, e.g. display

    hint format["%1\n%2",_Call02,_Txt1]

    BTW, why do you want to compare the Call sign strings?. I guess, you pass the unitname into the script. If you want to check if a unit takes a specific place in the group, you could also use the unit command,

    ?_Call01 == (units _Call01) select 0: Hint "Is Number One"


  2. Quote[/b] ]Yes, but if I use 'call' to start a preloaded script (i.e. no preprocessed function), won't the main script (from which I call it) wait for the script to finish before continuing, or will this get executed independently (like a script called with the exec instruction)?

    'call' can not be used to start scripts, only functions (i.e. code which is executed immediately).

    Quote[/b] ]@Spinor: I'm making missions, and I'm just trying to optimize performance as much as possible, so making it an addon wouldn't really help me.

    It is not really an addon (you don't need a model or even a config.cpp), but rather a different method to store your scripts.

    I wouldn't worry to much about accessing the HD anyway. I think Suma once mentioned that frequently accessed scripts (or in fact any files) are automatically cached to memory by Windows.


  3. Quote[/b] ]Is it possible to preload (with loadFile) a normal script, so the computer doesn't have to access the harddisk repeatedly (reducing lag if the script is executed with a high frequency), but still having it run as a seperate, independent script (thus allowing for pauses, halts, loops, etc.)?

    I'm not 100% sure but I think when putting a script into an addon, it is preloaded when launching OFP. You don't necessarily have to create a genuine addon for this. Simply put your script(s) into a folder, pbo'it and put into the addons folder. The path is then given by "\ADDONNAME\SCRIPTNAME.sqs". Calling a script with exec should not cause HD access in this case.


  4. Once started with exec, scripts always run independently from everything else and can only "modified" by using global variables (i.e. no underscore). A script can thus be never within the scope of another script.

    The scoping comes into play when using stuff like functions (I think the official Reference is a little misleading mentioning the exec). This should work:

    _NUM = 1

    call {_NUM = 2;}

    format["%1",_NUM] --> 2


  5. </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote </td></tr><tr><td id="QUOTE">it's possible but so there will always be a limit ... <span id='postcolor'>

    AFAIK, there is no hardcoded limit on the number of markers, so you can preplace maybe 1000 markers. In any case, if the "marker database" is cleverly done, you can reuse markers once they were previously removed, e.g. you can put all available markers in an array:

    availableMarkers = ["marker1", "marker2", ...]

    When "creating" a marker, simply grab the first marker from the list and remove it from the list, e.g.:

    availableMarkers = availableMarkers - ["marker1"]

    When you no longer need a given marker, move it offmap or make it "Empty" and put it back into the marker list:

    availableMarkers = availableMarkers + ["marker1"]

    </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote </td></tr><tr><td id="QUOTE">i think that a kind of command or script must be because if it is possible to insert markers manually it must be also possible to insert them by script (automatically) ... maybe Suma knows how<span id='postcolor'>

    Yeah, I guess it wouldn´t have been tooooo hard for BIS to create such a command, but according to the latest ComRef there is no such scripting command (Suma has of course the final word on this  biggrin.gif).

    Spinor


  6. Sadly, there is no command like createMarker to create a marker out of nothing.

    The only workaround I can think of is to put a large number of "standard" markers in the editor, thus forming a database of markers. When you need a new marker, grab the first unused one from the database and adjust its appearence with setMarkerPos, setMarkerColor and setMarkerType.

    Spinor


  7. Thats some useful info. Our mission (I always say our mission, but it was actually created by abomb for CoC) uses a lot of units also.

    Nevertheless, the bug is very strange, as the total number should not be a problem as long as it is below the maximum allowed number. You are probably correct, it may be caused by some strange combination.

    I will try your suggestion and post the findings.

    Anyway, please send me your mission (don´t bother about playability) if you like. At CoC, we have a tool to read a savegame file and we can take a look what '/GameState/Variables/Item12/data.value.Item0' actually is.

    In our (analogous) case, it turned out to be a variable (actually an empty array) used in our scripts. Thats why we thought that our scripting may be erronous.

    Spinor


  8. hi, try this

    </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">#loop

    _groupPos = getPos (leader outpost)

    "outpostmarker" setMarkerPos [_groupPos select 0, _groupPos select 1, 1]

    ~2.5

    ?"alive _x" count (units outpost) == 0: "outpostmarker" setmarkersize [0,0]

    goto "loop"<span id='postcolor'>

    _groupPos is already a position array [x,y,z], so it is not necessary to use getPos on it.

    I also changed the condition for the marker-deletion. Now it becomes true when all units of the group outpost are dead.

    The "alive" command can not be used on groups directly.

    Hope this works,

    Spinor


  9. Properly deleting a marker is not possible, but you can simply move it offmap by using negative xy values like

    "outpostmarker" setMarkerPos [-100, -100, 0]

    Alternatively, you can resize it to zero:

    "outpostmarker" setMarkerSize [0, 0]

    A group as such does not have a well defined position (the units are scattered). Instead, the easiest is to you use the position of the groupleader:

    _groupPos = getPos (leader groupName)


  10. Hi, found no new bug yet, although I went havoc creating, editing, deleting controls smile.gif .

    The layer feature works great and is very useful.

    The Hint control also works fine, although I have to say, inserting a control is now a little slow. Is it possible to combine the two menus (control properties, hint properties) into one? Maybe of the following form:

    Name: _ _ _ _ | x|

    Style: _ _ _ _ | x|

    x: _ _ _ _ | |

    etc.

    The lines represent the editing fields (x,y,h,w are prefilled with the box values). The | | represent a checkbox that determines whether the parameter is to be "hinted" or not.


  11. </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote </td></tr><tr><td id="QUOTE">But as for hints, how about in the insert box I add a little panel that lets you decide what will be added into the hint for that control you're creating?<span id='postcolor'>

    You could also simply display the type (if given) in the hint. In most cases controls are based on sensible base classes like RscButton. This should be enough info.

    Is it possible to make the boxes transparent (so they don´t hide each other), or would this mess up the select´n´drag feature? It is often the case that controls are "stacked" on each other, like buttons over a background.


  12. Hey man, you are faster producing than I can test biggrin.gif

    </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote </td></tr><tr><td id="QUOTE">Actually it not drawing the control if the second click is not lower-right than the first click is intentional. The current method of figuring size and such depends on it working that way. It would spew out negative numbers and such at the moment if I were to allow you to place the second click above the first click. I may work on fixing that if it really is a bother.<span id='postcolor'>

    Its not so bad once you get used to it. At first it is just a little confusing. What about the following algorithm for extracting x,y,h,w from (x1,y1) and (x2,y2) (irrespective of their relative position):

    w= Abs(x2-x1)

    h=Abs(y2-y1)

    x=Min(x1,x2)

    y=Min(y1,y2)

    One suggestion: Could you make the type of a control optional but instead the name mandatory (every control needs a name but it is not necessarily based on a class)?

    Spinor


  13. Version used: 0.10a:

    </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote </td></tr><tr><td id="QUOTE">The ID does already increment, although it does start at 0.<span id='postcolor'>

    One bug report about this: I created two controls (ids = 0,1), then deleted the first, and finally created one, ending with two controls that both had ids = 1.

    </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote </td></tr><tr><td id="QUOTE">As for the styles, I prefer to use defines as that makes the code much clearer. Yes, it does require people use ST_CENTER, but they can change that if they really want to.<span id='postcolor'>

    I also prefer defines but most of the time I already define controls on base classes where most of the properties like the style are already given. I would suggest (but this is really only a suggestion  smile.gif ) to first concentrate on the geometry (so to say), and maybe later add further properties.

    </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote </td></tr><tr><td id="QUOTE">As for selecting the controls with the arrow keys, I don't really see much use for that. Almost all operation with the visual control will be done by mouse, so it would be a little tedious to switch to keyboard and such.<span id='postcolor'>

    I think, uiox just noted that one can cycle through the controls with the arrow keys WITHIN OFP, thus the ordering of the controls is important.

    There is one small problem with placing a control: If the endpoint is not to the lower right of the start point, the control is not drawn and the click recognition gets out of tune.

    BTW, the comma<->period is indeed due to the language settings. I resolved this in the Windows settings.

    Spinor


  14. </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote </td></tr><tr><td id="QUOTE">And no, while I could have worked it to be cross-platform compatible, I saw little point.<span id='postcolor'>

    That was a good decision. Otherwise I would be designing dialogs at university which would be detrimental to my studies biggrin.gif .


  15. </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote </td></tr><tr><td id="QUOTE">As to the commas, does it output commas on all X, Y, W, and H properties? It's putting periods on my end, hm.. <span id='postcolor'>

    Will have to check again (I'm not at home right now). Maybe it has something to do with Windows language settings? I am using German, and I think the default is ',' for numbers.

    </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote </td></tr><tr><td id="QUOTE">. and as to the manual adjusting of properties, I am going to add that in, but as I said, this was just a release of the core features - I.E., ultimate basics, heh.<span id='postcolor'>

    No need to hurry (in fact no need to implement it at all if you think it unessesary). I'm just dumping out ideas and wishes.

    </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote </td></tr><tr><td id="QUOTE">Oh, and just redownload the .zip file, I already added in the named boxes.<span id='postcolor'>

    Yup, I gathered that. Its just that your program probably won't run on the university Linux machine I am sitting in front of right now wink.gif .


  16. Great smile.gif , especially the drag'n'drop feature is very nice. I only tested your todays first version yet, looking forward to the named boxes.

    I only noticed two bugs:

    - In your output, I think you export the numbers with commas 0,1343 rather than dots.

    - Missing snap-to-grid feature tounge.gif

    One other suggestion: What about displaying the dimensions of a control (x,y,h,w) in the popup menu?

    If you make them editable, one could fine adjust them by hand (if one wishes). This could be useful for placing, say, buttons with fixed sizes h,w.

    Great work!

    Spinor


  17. Just an idea (i.e. untested biggrin.gif): Add/remove linefeeds "\n" to your text, e.g.

    titleText["\n\n\nHello!","PLAIN"]

    ~0.1

    titleText["\n\nHello!","PLAIN"]

    ~0.1

    titleText["\nHello!","PLAIN"]

    ~0.1

    titleText["Hello!","PLAIN"]

    ~0.1

    titleText["Hello!\n","PLAIN"]

    etc.

    Maybe this will create the impression of scrolling text.

    Spinor


  18. </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote </td></tr><tr><td id="QUOTE">Alright, just a little news update. Perhaps pointless, but ah well.<span id='postcolor'>

    Absolutely not pointless  smile.gif, thanks alot. I only just discovered your little gem. This is exactly what I just waited for.

    As you asked for any wishes, here they come  biggrin.gif :

    As Gameer said, I think it is not necessary to make the dialog objects functional. It would be nice if one can assign a name to an object (perhaps the .ext class name) that is displayed within the rectangle.

    To create nicely aligned buttons, a snap-to-grid feature would be great.

    Thanks again,

    Spinor


  19. Hi,

    try the following, it should do the trick (I calculate a number ranging 0,...,9 which is equivalent to yours)

    ;;;;;;;;;;;;;;;;;;;

    ;this is a float random number ranging from 0 to 9.99999999

    _mission = random 9.999999999

    ;this should transform it into a integer random number 0,1,...,9

    _mission = _mission - (_mission mod 1)

    ;this then jumps to the appropriate subroutine

    goto format ["mission%1", _mission]

    #mission0

    ....

    exit

    #mission1

    ......

    ;;;;;;;;;;;;;;;;;

    Hope this helps,

    Spinor


  20. I think the problem is, you encased _marker in double-quotes. Try the following instead:

    </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">_Target = _this select 0

    _Marker = _this select 1

    #update

    _Marker setMarkerPos getPos _Target

    ~0.1

    goto "update"<span id='postcolor'>

    and call the script like [this, "markername1"] exec "Target.sqs".

    Names of markers are already strings itself.


  21. When using an invalid object ID for the object command

    _object = object objectID,

    OFP crashes to desktop. Could it be made so that the command returns a NULL-object in this case?

    At CoC, we are trying to do an automated terrain sampler for our strategic AI. One part of this is to determine all map objects for which the object command is quite useful.

    Related to this: What is the type and class structure of trees and bushes? The commands typeOf and countType do not seem to work on them.

    Thanks,

    Spinor

×