Jump to content
happydayz

Bohemia... haha makes me laugh

Recommended Posts

Does this work for you (N.B. braces around the if / then code):

 

Foo = {throw _this};
try {
if (false) then {"U" call Foo};
if (true) then {"V" call Foo};
throw "NOPE";
}catch{
systemChat format["Exception: %1",str _exception];
};
 

Share this post


Link to post
Share on other sites

i would have expected this to throw U & V tho....
 

Foo = {throw _this};
try {
if (true) then {"U" call Foo};
if (true) then {"V" call Foo};
throw "NOPE";
}catch{
systemChat format["Exception: %1",str _exception];
};
 because the opposite (false) will throw nope

I even tried something like this:

Foo = {throw _this;  
false  
};  
try {  
if (true) then {throw "U"};  
if (false) then {throw "V"};  
throw "NOPE";  }
catch{  
systemChat format["Exception: %1",str _exception];  
};

Share this post


Link to post
Share on other sites

Using round brackets always calls the code , at least in the try {}. Which is why I use braces.

I wouldn't have expected U and V as U is thrown to the exception and the code ends there. There is no Else statement.

Why do you want to return a false ?

Edit: Have found that false is never returned from foo, try replacing it with a hint. the throw must go straight to catch, as it is still in scope.

 

Edited by axeman

Share this post


Link to post
Share on other sites

tbh, a throw "U" will do the same. There is scope to do more in Foo so that something more descriptive could be returned as an Exception

Am sure there must be some performance to be gained with using a throw. It's the marriage of exitWith and Switch after a drunken week in Vegas.

Why not 'throw false' and handle the boolean in the catch statement ? 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Similar Content

    • By salival
      Hi guys,
      Quite a few admins asked me to release my Change Code script so here it is, It comes with BattlEye filters, too.
      This will allow players to set the code on placement/upgrade of doors, lockboxes and safes as well as changing them after they are placed.
      https://github.com/oiad/changeCode
    • By NightRain
      Heya, I've been trying to tinker with this issue for a week. Here's the situation:
      I've placed a LHD built in mission editor. I managed to add a Agent there as a trader which functions fine and exists constantly without vanishing into the ocean, right so that functions properly.
      The issue is with purchasing a vehicle. It doesn't function as expected. I have included a HeliHCivil on it with a set position that its height should be about the same as carrier's deck. (I tested it previously that if you increase its Z it will spawn the machine exactly at that height and remain frozen in air until touched.) When purchasing a air vehicle it spawns 500m into the air as title informs, it is unclear to me whether the hitbox of the carrier just happens to be that huge or why it does it, this is beyond my ability to comprehend it.
      This happens if there are a structure on the spawn point, if none exist it spawns precisely how you'd want it. I tested it by making it spawn above ocean it worked and then placed metal floors about it and bought it again. vehicle spawned in the air again.
      I tried to lower the Helipad's height with -X (with X being amount added) but it results in the purchased vehicle spawning in the center of the map.
      Are there any solution to how to make it spawn on the helipad even if the helipad is on top of a building or similar? I might've exhausted all my options. Thank you.
       
      Update on 1.0.6.1
      When purchasing on ocean the vehicle spawns on the bottom of the sea instead of on the helipad.
       
    • By RimBlock
      So, as many will know, there is an issue in A2Epoch (possibily from DayZ) in the unique identifier generation not always producing unique identifiers.
       
      What is the unique identifier and how is it used ?.
       
      Epoch uses two object identifiers.
      ObjectID ObjectUID ObjectID is generated by the MySQL DB backend.  ObjectUID is generated within the ARMA 2 game world via SQF code.
       
      Why two identifiers ?.
       
      For some reason... there is only one HiveExt.dll call to get the ObjectID for an object in the DB.  This call is the one used to load all the DB objects in to ARMA.  The offshoot of this is that when a new object is created and saved to the DB, the DB creates a unique objectID but this objectID cannot get back to the ARMA 2 game world until the ARMA 2 server process is restarted and all the objects are then read from the DB again.
       
      To get around this, the ObjectUID is created when a new object is created in the game world.  This is used to reference the object in the game world and on the DB if the ARMA 2 engine does not know the DB assigned ObjectID.
       
      So, what is the problem ?.
       
      Whilst the code to generate a unique objectUID looks fairly good, it does not always create a unique ID.  THis means that manipulation of any new objects that have not yet got an objectID in the game world (ie. created after the last server restart) but having an objectUID that matches the objectUID of an object currently in the DB will cause all sorts of problems.
       
      How is the objectUID calculated currently ?.
       
      There are three functions used to calculate the objectUID currently (all defined in server_functions.sqf).
      dayz_objectUID - No longer used it seems. dayz_objectUID2 - Used for objects objectUID generation. dayz_objectUID3 - Used for vehicle objectUID generation. dayz_objectUID just works out the required input parameters and then calls dayz_objectUID2.
       
      dayz_objectUID2 generates the objectUID for the object by applying the following calculation.
       x,y,z coords each multiplied by 10. Results made positive if required by multiplying by -10 and rounded to a whole number. 3 numbers are concatenated together (X + Y + Z). The objects direction (in degrees) after rounding is then concatenated to the result. dayz_objectUID3 does the same but adds the mission time (time in seconds since the ARMA 2 mission was started) to the direction value before adding it to the result for the x/y/x/ * 10 part.
       
      Worked example for dayz_objectUID2 
      Worldspace = [351.545[11079.8,11834.3,-0.380997]]
      =
      X = 11079.8 * 10 = 110798 
      Y = 11834.3 * 10 = 118343
      Z = -0.380997 * 10 = -3.80997 * -10 (make positive) = 38.0997 round = 38
      DIR = 351.545 rounded = 352
       
      = concat  110798 + 118343 + 38 + 352
      Calculated objectUID
      11079811834338352
       
      Stored ObjectUID
       
      11079811834338352
       
      So why is it not random ?.
       
      A set of coodinates ( [dir,[x,y,z]] ) for an object of [0,[1,1,10]] will produce the same result as a set of coordinates of [0,[1,10,1]].  The uniqueness plays on the probability of combination resulting in the same onjectUID being generated as unlikely.  The more items you have in your DB then the more likely it is to happen.
       
      Ok, so what can we do about it ?.
       
      So this is the purpose of this thread.  Both to highlight the issues to those who were not aware and to have a discussion on peoples thoughts on a better solution.
       
      I am curious as to why the code does not start at 0 and each time a objectUID is needed it just increments (possibly by 2 / 5 / 10).  A server global variable could hold the current value and be populated on server restart by the highest objectUID found in the loaded objects.  The only issue I can see is if multiple requests for a new objectUID resulted in the same objectUIDs being given out to multiple requestors as the global 'current objectUID' variable cannot be updated quickly enough.  Presumabily that ould be managed by a basic schedualing system enforcing a FIFO queue so each request could be processed one at a time.
       
      Any other thoughts or observations ?.  I am hoping we can all come up with a better solution that does not require any custom .dlls or DB table changes.  Good news is that any new generation system should be pretty easy to plugin to Epoch.
       
      Over to you...
    • By LoneKirov
      R2Clan Gaming Community is looking for skilled individuals that can help script/code missions and events into our A3 Epoch 2.5.1 server.
       
      If anyone here is interested please
      Contact me at [email protected]
      or Join our TS (ts3.R2clan.net) 
      or join our webpage (R2clan.net)
      or even jump in our server (epoch.R2clan.net)
    • By moonunit42
      Hi everyone!
       
      I am currently in the process of setting up an overpoch server and everything worked until I tried to install Plot for Life (follow the tutorial and got the files from here: ). What happens is when someone tries to join it loads everything but fails to authenticate. I know its not just my arma because I have had several people try it and the same thing happened to everyone. To get it to work again I just have to change the init file back to normal and the server works fine again. In the client logs there is this in the end but there are no other errors:
       
      Client: Network message dc9b (update info 317910e0) is pending Client: Network message dc9c (update info 31790fc0) is pending Client: Network message dc9c (update info 31791018) is pending Client: Network message dc9d (update info 317910c8) is pending Client: Network message dc9e (update info 31790f68) is pending "PLOGIN: Retrying Authentication... (76561198044993880)" "PLOGIN: Retrying Authentication... (76561198044993880)" "PLOGIN: Retrying Authentication... (76561198044993880)" "PLOGIN: Retrying Authentication... (76561198044993880)" "PLOGIN: Retrying Authentication... (76561198044993880)" "PLOGIN: Retrying Authentication... (76561198044993880)" "PLOGIN: Authentication Failed (76561198044993880)" "End Mission" I don't know where the server logs are but if someone can point me to them I'll upload them. If there are any other file or any other information let me know and I'll upload it. I appreciate any help I can get, thanks.   P.S. I already have several mods installed but I don't remember what they all are but I can find out if necessary
  • Advertisement
  • Supporters
  • Discord

×
×
  • Create New...