Code:
//////////////////////////////////////////////RESOURCE GATES///////////////////////////////////////////
//Variables:                                                                 //
//TAG.RESOURCEID - ID of the resource the gate will look for                                         //
//TAG.AMOUNTREQUIRED - The amount the gate requires you to have                                      //
//TAG.CONSUMEAMOUNT - The amount the gate will consume                                                 //
//TAG.AMOUNTTOGIVE - The amount the gate will give you if you don't have any                         //
//MOREP - The Coordinates of where the gate will take you if you meet the requirements               //
//                                                                         //
//General Info:                                                                            //
//Double-click to configure...variables really tell everything else...                               //
///////////////////////////////////////////////////////////////////////////////////////////////////////
[ITEMDEF i_Resource_Gate]
ID=i_moongate_blue
TYPE=t_script
NAME=Resource Gate
ON=@CREATE
   COLOR=07a1
ON=@DCLICK
   IF (<SRC.ACCOUNT.PLEVEL> > 1)
      DIALOG d_ResourceGate 
   ENDIF
   RETURN 1
ON=@STEP
   IF (<EVAL <TAG.RESOURCEID>>=0)
      SRC.SYSMESSAGE This tile has not been configured for entry yet.
      RETURN 1
   ENDIF
   IF !(<EVAL <TAG.AMOUNTTOGIVE>>=0)
      IF !<SRC.FINDID.<TAG.RESOURCEID>.UID>
         SRC.NEWITEM <TAG.RESOURCEID>
         SRC.ACT.AMOUNT=<EVAL <TAG.AMOUNTTOGIVE>>
         SRC.ACT.BOUNCE
      ENDIF
   ENDIF
   IF <SRC.RESTEST <EVAL <TAG.AMOUNTREQUIRED>> <TAG.RESOURCEID>>
      IF !(<EVAL <TAG.CONSUMEAMOUNT>>=0)
         SRC.CONSUME=<EVAL <TAG.CONSUMEAMOUNT>> <TAG.RESOURCEID>
      ENDIF
 
     SRC.GO <MOREP>
   ENDIF
   RETURN 1
CATEGORY=Miscellaneous
SUBSECTION=Gates
DESCRIPTION=Resource Consumption Gate
[DIALOG d_ResourceGate] 
0,0 
resizepic 190 175 5054 390 250 
resizepic 200 185 3000 370 230 
//Text Borders
resizepic 370 200 3000 185 22 
resizepic 370 235 3000 185 22 
resizepic 370 270 3000 185 22 
resizepic 370 305 3000 185 22 
resizepic 370 340 3000 185 22 
text 215 200 995 1 
text 215 235 995 2 
text 215 270 995 3 
text 215 305 995 4 
text 215 340 995 5 
//Text where coordinates will be entered.
textentry 375 200 175 25 0 0 6 
textentry 375 235 175 25 0 1 7 
textentry 375 270 175 25 0 2 8 
textentry 375 305 175 25 0 3 9 
textentry 375 340 175 25 0 4 10 
text 295 375 0000 11 
button 260 375 4005 4006 1 0 1 
text 465 375 0000 12 
button 430 375 4005 4006 1 0 0 
[DIALOG d_ResourceGate TEXT] 
<VAR.BLANKLINE>
Resource ID:
Amount Required:
Amount to Consume:
Amount to Give:
Coordinates:
<TAG.RESOURCEID>
<EVAL <TAG.AMOUNTREQUIRED>>
<EVAL <TAG.CONSUMEAMOUNT>>
<EVAL <TAG.AMOUNTTOGIVE>>
<MOREP>
Accept 
Cancel 
[DIALOG d_ResourceGate BUTTON] 
ON=0 
   SRC.SYSMESSAGE No changes made.
   RETURN 1
ON=1
   TAG.RESOURCEID=<ARGTXT[0]>
   TAG.AMOUNTREQUIRED=<ARGTXT[1]>
   TAG.CONSUMEAMOUNT=<ARGTXT[2]>
   TAG.AMOUNTTOGIVE=<ARGTXT[3]>
   MOREP=<ARGTXT[4]>
   RETURN 1