Home   Help Search Login Register  

Author Topic: menu for 1 player  (Read 1604 times)

0 Members and 1 Guest are viewing this topic.

Offline FiLL2d

  • Members
  • *
  • X.x
menu for 1 player
« on: 10 May 2004, 18:39:47 »
?(side player == west): goto "Menu-allies"
?(side player == east): goto "Menu-axis"

#null

boolean = false
@ boolean

#Menu-allies

?(local player):[] exec "spawn/alliesmenu.sqs"

boolean = false
@ boolean

#Menu-axis

?(local player):[] exec "spawn/axismenu.sqs"

boolean = false
@ boolean


--------------------
alliesmenu.sqs
--------------------
Menu1 = createDialog "Menuwest"
--------------------
need help, how can i make it so only the player that activates this script can see the menu
« Last Edit: 10 May 2004, 18:40:56 by FiLL2d »

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:menu for 1 player
« Reply #1 on: 12 May 2004, 16:29:19 »
Script seems a little odd to me

If a player was  Side WEST
he would instantly run the following blue lines, wait for the red line to become true and not run the green lines at all



?(side player == west): goto "Menu-allies"
?(side player == east): goto "Menu-axis"

#null
myboolean = false
@ myboolean

#Menu-allies
?(local player):[] exec "spawn/alliesmenu.sqs"
myboolean = false


wait at the following line until the boolean becomes true again
@ myboolean

then run the following blue lines instantly

#Menu-axis
?(local player):[] exec "spawn/axismenu.sqs"
myboolean = false

wait at the following line until the boolean becomes true again
@ myboolean

the following makes more sense

******************************************************************
Quote
?!(local player): exit
#START
myboolean = false
@ myboolean
?(side player == west): goto "Menu-allies"
?(side player == east): goto "Menu-axis"

#Menu-allies
[] exec "spawn/alliesmenu.sqs"
myboolean = false
goto "START"

#Menu-axis
[] exec "spawn/axismenu.sqs"
myboolean = false
goto "START"

**************************************************

If the boolean is not public variabled, or made true by a trigger global to all then only the client where the boolean became true would get past the @ statement

In addition, a more efficient way of running the boolean check would be to remove the @ stament which refreshes at the fps and instead use a slow loop like the following example

Quote
#START
~1
myboolean = false

?(myboolean) && (side player == west): goto "Menu-allies"
?(myboolean) && (side player == east): goto "Menu-axis"
goto "START"

Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

Offline Pathy

  • Former Staff
  • ****
  • I'm not a F***in llama!
    • Volcbat.
Re:menu for 1 player
« Reply #2 on: 12 May 2004, 19:32:47 »
So this would mean you can set seperate objectives for 2 sides and niether could see the other sides?

Unnamed

  • Guest
Re:menu for 1 player
« Reply #3 on: 13 May 2004, 08:53:05 »
Dont be afraid of using the @ with a boolean variable, in fact there is an argument to say it's more efficent that using the ~ in a loop. For starters there is more code in the ~ loop for OFP to compile. If you check it every second, OFP has to keep track of the time between each call.

But remember it's a boolean variable and not a command that returns a boolean as a result. I have 200+ @ conditions checking a single boolean variable without any ill effect.

PsyWarrior

  • Guest
Re:menu for 1 player
« Reply #4 on: 13 May 2004, 15:20:18 »
Greetings,

Indeed, Unnamed, a good point. However, the difficulty comes when you want to check for more than one condition (such as boolean1 or !alive player). Then you have to use a loop to test for all the conditions. As in

Code: [Select]
#loop4576
? !(alive player): exit
? boolean1: goto "detonate"
? x == y: a=b+x
~0.5
goto "loop4576"

-Supr. Cmdr. PsyWarrior
-Psychic Productions

Unnamed

  • Guest
Re:menu for 1 player
« Reply #5 on: 13 May 2004, 19:35:52 »
Yeah, I can only guess at what OFP does behind the scenes and whats involved with things like the Alive command.

Another side effect of using the @ command is the scripts run at the current frame rate. I have not had chance to test if this is the same when using ~, although I do know if you tried say ~0.0004 it would never run any faster than the @ command, which on my PC executes every ~0.03 (on the desert island).

I will stick my neck out ::) and say as a rule of thumb only use it on variables, and then nothing  more complex than:

Code: [Select]
@(Call {Boolean1 Or Boolean2})
But then, it wont be the first or last time I get it wrong  :) :-X