SphereCommunity
Jail Stone help - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: Jail Stone help (/Thread-Jail-Stone-help)



Jail Stone help - Leonidas - 01-15-2014 07:49 AM

So Ive had this script and I remember it working a long time ago, but now when I double click my bail stone my client crashes, really have no clue why its doing this! Any help is appreciated.

Code:
[ITEMDEF i_Bail_stone]

DEFNAME=i_Bail_Stone
name=Bail Stone
ID=i_gravestone_18
TYPE=0
CATEGORY=Jail System
SUBSECTION=Jail Items
DESCRIPTION=Bail Stone

on=@create
color=0054e
attr=010

ON=@dclick
SRC.DIALOG d_bail_stone
RETURN 1


[EVENTS e_jail_timer]

serv.newitem=i_jail_timer
new.p=<src.p>
  new.link=<src.uid>
  src.message @0481 "Your fifteen minutes begins now"
  return 1
ON=@DCLICK
if (<tag0.active>=1)
  if (<link.uid> != <src.uid>)
    src.message "This stone belongs to <link.name>"
    return 1
else
src.forgive
SRC.DIALOG where_to
endif
  endif





[DIALOG d_bail_stone]
100, 100
page 0
resizepic 100 100 2620 400 145
//BUTTONS
button 125 155 2362 2361 1 0 1
button 125 172 2362 2361 1 0 2
button 125 189 2362 2361 1 0 3

TEXT
text 140 110 137 0
text 140 150 268 1
text 140 167 268 2
text 140 184 268 3
text 140 201 268 4




[DIALOG d_bail_stone TEXT]
Choose your payment!
Pay the bail (1000gp)
Serve your sentence (15min)
-1 to all stats

[DIALOG d_bail_stone BUTTON]

ONBUTTON=1

IF <SRC.RESTEST <EVAL <SRC.tag0.BAILCOST>> i_gold>
SRC.CONSUME=<EVAL <SRC.tag0.BAILCOST>> i_gold 1000
SRC.SYSMESSAGE Bail has been payed!
src.forgive
src.go britain
dialogclose d_bail_stone BUTTON
RETURN 1
ELSE
SRC.SYSMESSAGE You do not have enough gold in your pack
SRC.BANKSELF
dialogclose d_bail_stone BUTTON
RETURN 1
ENDIF


ONBUTTON=2
src.jailstone
dialogclose d_bail_stone BUTTON

ONBUTTON=3
src.str -= 1
src.dex -= 1
src.int -= 1
dialogclose d_bail_stone BUTTON
SRC.DIALOG where_to

[DIALOG where_to]
100, 100
page 0
resizepic 100 100 2620 400 165

//BUTTONS
button 125 155 2362 2361 1 0 1 //Britain
button 125 172 2362 2361 1 0 2 //Sherwood
button 125 189 2362 2361 1 0 3 //Trinsic
button 125 206 2362 2361 1 0 4 //Vesper
button 125 223 2362 2361 1 0 5 //Yew

//Text
text 150 110 137 0
text 150 150 168 1
text 150 168 268 2
text 150 185 268 3
text 150 203 268 4
text 150 220 268 5

[DIALOG where_to TEXT]
please choose your destination
Britain
Sherwood
Trinsic
Vesper
Yew

[DIALOG where_to BUTTON]

ONBUTTON=1
src.forgive
SRC.GO 1495,1630,10
SOUND 00Ff
Return 0

ONBUTTON=2
src.forgive
SRC.GO 1825,846,-1
SOUND 00Ff
Return 0

ONBUTTON=3
src.forgive
SRC.GO 1846,2780,0
SOUND 00Ff

ONBUTTON=4
src.forgive
SRC.GO 2871,703,0
SOUND 00Ff

ONBUTTON=5
src.forgive  
SRC.GO 550,1004,0
SOUND 00Ff

[DIALOG d_bail_stone]
100, 100
page 0
resizepic 100 100 2620 400 145
//BUTTONS
button 125 155 2362 2361 1 0 1
button 125 172 2362 2361 1 0 2
button 125 189 2362 2361 1 0 3

TEXT
text 140 110 137 0
text 140 150 268 1
text 140 167 268 2
text 140 184 268 3
text 140 201 268 4


[FUNCTION consumebank]
act=
act.layer=layer_pack
act.type=t_container
act.equip

src.consume

act.layer=layer_bankbox
act.type=t_eq_bank_box
act.equip

[PLEVEL 1]
jailstone

[FUNCTION jailstone]

serv.newitem=i_jail_timer
  new.p=<src.p>
  new.link=<src.uid>
  src.message @0481 "Your sentence begins now"
  return 1

[ITEMDEF i_jail_timer]

NAME=Jail Timer
ID=i_crystal_red
TYPE=t_normal

ON=@CREATE
attr=attr_move_never
color=69
more1=900
timer=1

On=@DClick
if (<tag0.active>=1)
  if (<link.uid> != <src.uid>)
    src.message "This stone belongs to <link.name>"
    return 1
  else
    src.DIALOG where_to
    remove
    return 1
  endif
else
  src.message "Be quiet prisoner!"
  return 1
endif

On=@Timer
if (<more1> > 0)
  say <eval <more1>>
  more1 -= 1
  timer=1
  return 1
else
  sfx 489
  tag.active=1
  timerf 30,remove
  return 1
endif

[eof]



RE: Jail Stone help - darksun84 - 01-15-2014 07:59 AM

There are two [dialog d_bail_stone] defined, and the last one looks wrong.

Also this part of code is not covered by any triggers inside the event
PHP Code:
[EVENTS e_jail_timer]

serv.newitem=i_jail_timer
new.p=<src.p>
  new.
link=<src.uid>
  
src.message @0481 "Your fifteen minutes begins now"
  
return 



RE: Jail Stone help - Mordaunt - 01-15-2014 09:08 AM

Code:
[DIALOG d_bail_stone]
100, 100
page 0
resizepic 100 100 2620 400 145
//BUTTONS
button 125 155 2362 2361 1 0 1
button 125 172 2362 2361 1 0 2
button 125 189 2362 2361 1 0 3

TEXT
text 140 110 137 0
text 140 150 268 1
text 140 167 268 2
text 140 184 268 3
text 140 201 268 4

Old... outdated scripting method using text instead of dtext and having no text block will crash your client because the dialog renders badly.


RE: Jail Stone help - Leonidas - 01-15-2014 11:25 AM

Guess I could have tried a little harder at looking at it than asking Tongue Thank you guys