Omega GATE SCRIPT

Forum Archive - from http://theuniversal.net
Locked
User avatar
matias
World Owner
World Owner
Posts: 46
Joined: Wed Apr 24, 2013 7:37 pm

Omega GATE SCRIPT

Post 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
	}
}
User avatar
zaroba
World Owner
World Owner
Posts: 7257
Joined: Fri Oct 10, 2003 11:06 pm
Location: Hereford, PA
Contact:

Post 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
}
User avatar
Mit
Staff
Staff
Posts: 3551
Joined: Sun Sep 21, 2003 10:14 pm
Location: Unknown

Post 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 ;)
User avatar
matias
World Owner
World Owner
Posts: 46
Joined: Wed Apr 24, 2013 7:37 pm

Post 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
	}
}
User avatar
Mit
Staff
Staff
Posts: 3551
Joined: Sun Sep 21, 2003 10:14 pm
Location: Unknown

Post by Mit »

btw, those nested events work? I never expected that to happen ;)
User avatar
matias
World Owner
World Owner
Posts: 46
Joined: Wed Apr 24, 2013 7:37 pm

Post by matias »

User avatar
zaroba
World Owner
World Owner
Posts: 7257
Joined: Fri Oct 10, 2003 11:06 pm
Location: Hereford, PA
Contact:

Post by zaroba »

nested events? odd. didn't notice them in the script.

does typing &animation work to play the animation as well?
User avatar
Mit
Staff
Staff
Posts: 3551
Joined: Sun Sep 21, 2003 10:14 pm
Location: Unknown

Post 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 
   } 
}
User avatar
matias
World Owner
World Owner
Posts: 46
Joined: Wed Apr 24, 2013 7:37 pm

Post by matias »

Good :)))
but tested it and the else doesnt work i had to use ELSE IF
User avatar
Mit
Staff
Staff
Posts: 3551
Joined: Sun Sep 21, 2003 10:14 pm
Location: Unknown

Post 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 :)
User avatar
matias
World Owner
World Owner
Posts: 46
Joined: Wed Apr 24, 2013 7:37 pm

Post 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
}
Locked