Page 1 of 1

Locations Names ?

Posted: 2009-03-20 23:30:51
by mTr
Hello, i was wondering if i can get a variable with the name of the zone i am. I dont need X and Y, just the name... for example, Despise, Destard, Britain... Etc.

Thanks in advance.

Posted: 2009-03-20 23:54:17
by Destruction
.where

it works ?

Posted: 2009-03-21 00:14:29
by mTr
lol! i know that. But i want use the location for guild warning.... i mean: .g HELP IM IN (LOCATION) :P

Posted: 2009-03-21 00:32:55
by Destruction
need no help? - ok, only little hint -)

use .where, grab message from journal, then send guild warning.

Injection have no special command for u.

Posted: 2009-03-21 00:33:57
by mTr
ahh, you'r right, never thinked it. Thanks :)

Posted: 2009-03-21 06:12:27
by mTr
Hi again, just wanna show you how my script is. Maybe you can help me improve it, but at the moment it does the job fine. Don't be evil with me, is my 1st script :P.

Code: Select all

#AVISO GUILD

sub Aviso()
VAR p='N/A'
VAR x=UO.GetZ()
UO.DeleteJournal()
UO.sayu('.where')
wait(500)
if UO.InJournal('I am in') then
   p=UO.Journal(0)
   p=Mid(trim(p), 10+len('mTr'), 100)
   UO.sayu(',resend')
endif
if x>200 then
   UO.sayu('.gsay HELP | AYUDA @ ' + Left(p, len(p)-15))
endif
if x==0 then
   UO.sayu('.gsay HELP | AYUDA @ ' + Left(p, len(p)-11))
endif
if x<230 and x>9 then
   UO.sayu('.gsay HELP | AYUDA @ ' + Left(p, len(p)-14))
endif
if x>0 and x<10 then
   UO.sayu('.gsay HELP | AYUDA @ ' + Left(p, len(p)-13))
endif
end sub


All this repetitions is for checking Z and do the conversion of the string removing the cords, but still works with a bit of delay cause server don't send Z at every move (i think) and even with resend it fails sometimes. Is it there a better way to check it ? I tested with else's, but i dont know why isnt working with. so I had to use 4 if's.

Oh, btw, change 'mTr' with your name.

Posted: 2009-03-21 16:59:10
by Destruction

Code: Select all

sub aviso()
   var loc, msg = 'I am in '
   deljournal( msg )
   uo.msg( '.where' )
   repeat
      wait( 100 )
   until uo.injournal( msg )
   loc = uo.journal( uo.injournal( msg ) -1 )
   loc = explode( loc, msg, 1 )
   loc = explode( loc, ' (', 0 )
   uo.msg( '.gsay HELP | AYUDA @ ' + loc )
endsub


Its may be better.

PS: sub explode: viewtopic.php?p=55737#55737

PPS: I was asked about .where because on some shards this command isnt works.

Posted: 2009-03-21 18:28:26
by mTr
ooh, i forgot explode :P I come from php and c# so in both work this function :) but didnt know it was in c++ too. Still a newbie on it hehehe.

Thanks for you help man.