Page 1 of 1

Omega GATE SCRIPT

Posted: Tue Jun 04, 2013 2:42 am
by matias
I dont know the non equal symbol but i think its !=

Code: Select all

EVENT("accessbuilding", "8")
{
	if ( $gBuildingOwnerID != $gPlayerID  )  
{
	osdcreate(OSDBUILDING, "Statusgate", "sysGetBuildingName")
	osdadditem(OSDBIGTEXT, " ", "You must be the owner to get access")
	osdadditem(OSDBIGTEXT, " ", "")
	osdadditem(OSDBIGTEXT, " ", "")
	osdadditem(OSDEXITBUTTON, "exit", "OK")
	osdactivate()
}
	Else if ( $gBuildingOwnerID = $gPlayerID ) ) 
{
	osdcreate(OSDBUILDING, "Statusgate", "GATE")
	osdadditem(OSDBIGTEXT, "", "Choose Here the Gate Status")
	osdadditem(OSDBIGTEXT, " ", "")
	osdadditem(OSDBIGTEXT, " ", "")
	osdadditem(OSDEXITBUTTON,"1", "OPEN")
	osdadditem(OSDEXITBUTTON,"2", "CLOSE")
	osdactivate()
}
}
EVENT("OSDSELECT", "Statusgate:1")
	{
	EVENT("&command","Animation")
	{
	*changebuilding $gBuildingAccessNum,13
	sleep(80)
	*changebuilding $gBuildingAccessNum,12
	}
}


EVENT("accessbuilding", "12")
{
	$GA = sysPlayerInventory("Gate Pass")
	
	If ($GA < 1) 
{
	osdcreate(OSDBUILDING, "Statusgate", "GATE")
	osdadditem(OSDBIGTEXT, " ", "You need a Gate Pass to get access")
	osdadditem(OSDBIGTEXT, " ", "")
	osdadditem(OSDBIGTEXT, " ", "")
	osdadditem(OSDEXITBUTTON, "exit", "OK")
	osdactivate()
}
	ELSE IF ($GA = 1) 
{
	osdcreate(OSDBUILDING, "Statusgate", "GATE")
	osdadditem(OSDBIGTEXT, "", "Choose Here the Gate Status")
	osdadditem(OSDBIGTEXT, " ", "")
	osdadditem(OSDBIGTEXT, " ", "")
	osdadditem(OSDEXITBUTTON,"1", "OPEN")
	osdadditem(OSDEXITBUTTON,"2", "CLOSE")
	osdactivate()
}
}
EVENT("OSDSELECT", "Statusgate:2")
	{
	EVENT("&command","Animation")
	{
	*changebuilding $gBuildingAccessNum,14
	sleep(80)
	*changebuilding $gBuildingAccessNum,8
	}
}

Posted: Tue Jun 04, 2013 10:07 pm
by zaroba
theoretically non equal would be ><

if that doesn't work, you could swap the two things in the first script

IF ($gBuildingOwnerID=$gPlayerID)
{
-owner stuff here
}

ELSE
{
-stuff for everybody else
}

Posted: Tue Jun 04, 2013 10:22 pm
by Mit
!= is correct.. i don't see any problems with the script as posted (other than a superfluous else if that could equally be an else).
Nice use of changebuilding ;)

Posted: Tue Jun 04, 2013 10:45 pm
by matias
Corrected script

Code: Select all

EVENT("accessbuilding", "8")
{
	if ( $gBuildingOwnerID != $gPlayerID  )  
{
	osdcreate(OSDBUILDING, "Statusgate", "sysGetBuildingName")
	osdadditem(OSDBIGTEXT, " ", "You must be the owner to get access")
	osdadditem(OSDBIGTEXT, " ", "")
	osdadditem(OSDBIGTEXT, " ", "")
	osdadditem(OSDEXITBUTTON, "exit", "OK")
	osdactivate()
}
	Else ( $gBuildingOwnerID = $gPlayerID ) ) 
{
	osdcreate(OSDBUILDING, "Statusgate", "sysGetBuildingName")
	osdadditem(OSDBIGTEXT, "", "Choose Here the Gate Status")
	osdadditem(OSDBIGTEXT, " ", "")
	osdadditem(OSDBIGTEXT, " ", "")
	osdadditem(OSDEXITBUTTON,"1", "OPEN")
	osdadditem(OSDEXITBUTTON,"2", "CLOSE")
	osdactivate()
}
}

	EVENT("OSDSELECT", "Statusgate:1")
{
	EVENT("&command","Animation")
	{
	*changebuilding $gBuildingAccessNum,13
	sleep(80)
	*changebuilding $gBuildingAccessNum,12
	}
}


EVENT("accessbuilding", "12")
{
	if ( $gBuildingOwnerID != $gPlayerID  )
{
	osdcreate(OSDBUILDING, "Statusgate", "sysGetBuildingName")
	osdadditem(OSDBIGTEXT, " ", "You must be the owner to get access")
	osdadditem(OSDBIGTEXT, " ", "")
	osdadditem(OSDBIGTEXT, " ", "")
	osdadditem(OSDEXITBUTTON, "exit", "OK")
	osdactivate()
}
	Else ( $gBuildingOwnerID = $gPlayerID ) )
{
	osdcreate(OSDBUILDING, "Statusgate", "sysGetBuildingName")
	osdadditem(OSDBIGTEXT, "", "Choose Here the Gate Status")
	osdadditem(OSDBIGTEXT, " ", "")
	osdadditem(OSDBIGTEXT, " ", "")
	osdadditem(OSDEXITBUTTON,"1", "OPEN")
	osdadditem(OSDEXITBUTTON,"2", "CLOSE")
	osdactivate()
}
}

EVENT("OSDSELECT", "Statusgate:2")
{
	EVENT("&command","Animation")
	{
	*changebuilding $gBuildingAccessNum,14
	sleep(80)
	*changebuilding $gBuildingAccessNum,8
	}
}

Posted: Tue Jun 04, 2013 10:49 pm
by Mit
btw, those nested events work? I never expected that to happen ;)

Posted: Tue Jun 04, 2013 11:13 pm
by matias

Posted: Tue Jun 04, 2013 11:33 pm
by zaroba
nested events? odd. didn't notice them in the script.

does typing &animation work to play the animation as well?

Posted: Wed Jun 05, 2013 12:56 am
by Mit
As i couldnt resist.. :] here's a slightly compressed version done using a function and rearranging the logic a little..

Code: Select all

Function     ShowGateOSD()
{
    $name = sysGetBuildingName( $gBuildingNum )
    osdcreate(OSDBUILDING, "Statusgate", "$name") 
    if ( $gBuildingOwnerID != $gPlayerID  )  
    { 
       osdaddat(OSDBIGTEXT,  20, 20, 0, 0, " ", "You must be the owner to get access") 
       osdaddat(OSDEXITBUTTON, 200, 100, 200, 30, "exit", "OK") 
    } 
    else 
    { 
       osdaddat(OSDBIGTEXT,  20, 20, 0, 0, " ", "Choose Here the Gate Status") 
       osdaddat(OSDEXITBUTTON, 200, 100, 200, 30, "1", "OPEN") 
       osdaddat(OSDEXITBUTTON, 200, 140, 200, 30, "2", "CLOSE") 
    }
   osdactivate() 
} 

EVENT("accessbuilding", "8") 
{ 
    $ret = ShowGateOSD()
} 

EVENT("accessbuilding", "12") 
{ 
    $ret = ShowGateOSD()
} 

EVENT("OSDSELECT", "Statusgate:1") 
{ 
   EVENT("&command","Animation") 
   { 
   *changebuilding $gBuildingNum,13 
   sleep(80) 
   *changebuilding $gBuildingNum,12 
   } 
}

EVENT("OSDSELECT", "Statusgate:2") 
{ 
   EVENT("&command","Animation") 
   { 
   *changebuilding $gBuildingNum,14 
   sleep(80) 
   *changebuilding $gBuildingNum,8 
   } 
}

Posted: Wed Jun 05, 2013 2:25 am
by matias
Good :)))
but tested it and the else doesnt work i had to use ELSE IF

Posted: Wed Jun 05, 2013 12:02 pm
by Mit
then something else is wrong, coz theres no logic in doing an

Code: Select all

if ( a not equal b )
..
else if ( a equal b )
by defintion if a is not not equal to b, then it is equal to b :) and using an else or an else if would make no difference.
Doesn't really matter i guess, but i don't like leaving such oddities unresolved :] - Might wanna check if it works correctly for non-owners, then maybe doublecheck the values used are what you're expecting by printing them out. Maybe the script didnt get reloaded at the right time or something else 'external'..
or, you could just ignore it and get on with things :)

Posted: Wed Jun 05, 2013 5:11 pm
by matias
I think it works this way...


if (somthing = ##)
{
Do this
}
Else if (somthing = ##)
{
Do that
}


or


if (somthing = ##)
{
Do this
}

Else
{
Do that
}