Author Topic: Weird question I can't find any info on:  (Read 6536 times)

0 Members and 1 Guest are viewing this topic.

Offline silentsentinelTopic starter

  • Jr. Member
  • **
  • Posts: 31
  • Activity:
    0%
  • Reputation Power: 0
  • silentsentinel has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Weird question I can't find any info on:
« on: April 21, 2009, 11:57:12 PM »
0
Hi all,

Got a weird question. I'm not entirely sure how to word this so I'm not even sure if I'm barking up the right tree. Bear with me.

I'd like to know how to sift out the following from the journal with an if statement.

For example:

Code: [Select]
set %jStart #jindex + 1
set %jTimeout #scnt2 + 5
set %jEnd #jindex
while #scnt2 < %jTimeout
{
for %ji %jStart %jEnd
{
scanjournal %ji
if larry in #journal || if curly in #journal || if moe in #journal
                        print (resulting flag)
         }
}

I'm not sure how to extract the resulting flag without making a seperate if statement for each condition. Basically I want to print the term that caused the statement to actually flag, for debugging purposes.

(I have a whole list of flags defined for GM detection. If one of them flags/halts the script, I want to know what word it actually was from my list.)

Is this possible in one if statement similar to the way I have it structured?

Thanks for any thoughts.
« Last Edit: April 21, 2009, 11:59:11 PM by silentsentinel »

Offline xeres

  • Jr. Member
  • **
  • Posts: 22
  • Activity:
    0%
  • Reputation Power: 0
  • xeres has no influence.
  • Respect: +1
  • Referrals: 0
    • View Profile
Re: Weird question I can't find any info on:
« Reply #1 on: April 22, 2009, 03:12:44 AM »
0
I did something similar when I was working on a GM detector.....

to test for individual keywords or phrases in journal, you do have to break it all out individually...
The %msg# variables are my GM detector phrases that are set near the top
Code: [Select]
sub checknotifications
      if ( %msg1 in #journal )
         {
         set %msg1tripped #true
         set %keyword %msg1
         }
      if ( %msg2 in #journal )
         {
         set %msg2tripped #true
         set %keyword %msg2
         }
      if ( %msg3 in #journal  )
         {
         set %msg3tripped #true
         set %keyword %msg3
         }
      if ( %msg4 in #journal  )
         {
         set %msg4tripped #true
         set %keyword %msg4
         }
      if ( %msg5 in #journal  )
         {
         set %msg5tripped #true
         set %keyword %msg5
         }
Now that I'm looking at that code...it would be cleaner with a for loop....but meh, its old code.

then you can do something like this to tie it all up...
Code: [Select]
if %msg1tripped || %msg2tripped || %msg3tripped || %msg4tripped || %msg5tripped
     {
     sound %notificationsound
     display Notification triggered on keyword: " %keyword " on charater " #charname " @ time: #time date: #date
     }

saved me from jail many times while I was making glasses on OSI :D

Offline Endless Night

  • Global Moderator
  • *
  • *
  • Posts: 5467
  • Activity:
    0%
  • Reputation Power: 62
  • Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!
  • Respect: +393
  • Referrals: 1
    • View Profile
Re: Weird question I can't find any info on:
« Reply #2 on: April 22, 2009, 04:42:17 AM »
0
You have a logical error .. to do with your timeout code.  You repeat the SAME scanning of the SAME JOURNAL entries over and over for 5 seconds..  Given that you set the end and start journal entires in a microsecond  this basically means you are scanning the same zero or 1 journal entry 100's probably 1000's of times.

Also you for statment is incorrect (need an = )
Thier no such command as print.
and you cannot put multiple ifs on the same line   "if  x || y"       not "if x || if y"
« Last Edit: April 22, 2009, 04:45:47 AM by Endless Night »
Outlaw Josey Wales - "Manwink, A Long Gone Scripty, and Endless are always teasing us with their private sections lol. What there realy saying is scripters rule and users drool."
Briza - "Your a living breathing vortex of usefulness."

Offline silentsentinelTopic starter

  • Jr. Member
  • **
  • Posts: 31
  • Activity:
    0%
  • Reputation Power: 0
  • silentsentinel has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Re: Weird question I can't find any info on:
« Reply #3 on: April 22, 2009, 06:38:14 PM »
0
You have a logical error .. to do with your timeout code.  You repeat the SAME scanning of the SAME JOURNAL entries over and over for 5 seconds..  Given that you set the end and start journal entires in a microsecond  this basically means you are scanning the same zero or 1 journal entry 100's probably 1000's of times.

Also you for statment is incorrect (need an = )
Thier no such command as print.
and you cannot put multiple ifs on the same line   "if  x || y"       not "if x || if y"

Hey there, a few question on what you mentioned. Firstly, my journal timeout is #scnt2 + 5 (5 10th's of a second, not 5 seconds,) does what you state still apply? I'm slightly confused by what you mean by I'm only scanning the zero journal entry? Please clarify if possible.

Also, wherein does my for statement need an =? Not sure how my syntax is wrong there? Thanks for the heads up, just confused.

The print thing was just an example on my part, I know it's not real, just was using it to illustrate what I wanted to do -- and the if statement error was a logical typo on my part, sorry for that.

Here is the real code in question so you can get a proper look:

Code: [Select]
set %jStart #jindex + 1
set %jTimeout #scnt2 + 5
set %jEnd #jindex
while #scnt2 < %jTimeout
{
for %ji %jStart %jEnd
{
scanjournal %ji
if is_attacking_you in #journal
{
wait 20
event macro 1 0 heh wtf
wait 20
event macro 13 21
display ok Alert: #charname being attacked! Script halted!$
halt
}
if more_reagents_are_needed_for_this_spell in #journal
{
wait 20
event macro 13 21
display ok Alert: #charname is out of reagents! Script halted!$
halt
}
if i_see_you_already_have_an_escort in #journal
{
wait 20
event macro 13 21
display ok Alert: #charname has an escort stuck! Script halted!$
halt
}
if you_see:_gm in #journal || you_see:_game in #journal || you_see:_admin in #journal ||
you_see:_counselor in #journal || you_see:_staff in #journal || you_see:_admin in #journal
set %wrongTextException #true
if %wrongTextException = #false && ( ,_ , #charname , ! in #journal || #charname , :_ in
#journal || guildmaster in #journal || you_have_hidden_yourself_well in #journal ||
you_are_now_under_the_protection_of_the_town_guards in #journal ||
you_have_left_the_protection_of_the_town_guards in #journal || you_open_a_magical_gate in #journal ||
spell_fizzles in #journal || you_see: in #journal || steal in #journal || you_enter_a_meditative_trance in
#journal || you_stop_meditating in #journal || will_you_take_me in #journal ||
you_shove_them_out_of_the_way in #journal || you_are_at_peace in #journal || karma in #journal ||
fame in #journal || compassion in #journal || you_are_dead in #journal ||
you_have_nothing_i_would_be_interested_in in #journal || delucia_for_your_last in #journal ||
can_page_for_vendor in #journal || seem_to_hide_right_now in #journal || staff_message_from_gm in
#journal || you_must_rest in #journal || you_must_wait in #journal || yourself_red-handed in #journal ||
resisting_magical_energy in #journal || you_feel in #journal || you_begin_to_feel in #journal ||
you_are_in_extreme_pain in #journal || into_your_bank_box_i in #journal || samson in #journal ||
samantha in #journal || shina in #journal || samirah in #journal || samuel in #journal || hira in #journal ||
 hilda in #journal || hildegard in #journal || chiara in #journal || kachine in #journal || clarence in #journal
|| shi in #journal || botan in #journal || chyou in #journal || saree in #journal || dlagma in #journal ||
snow in #journal || white in #journal || kynthia in #journal || ares in #journal || chilali in #journal ||
rashida in #journal || bottle in #journal || ship in #journal || )
set %wrongText #true

if %wrongText = #false && ( gm in #journal || afk in #journal || script in #journal || bot in #journal || are
 in #journal || you in #journal || now in #journal || hi in #journal || hey in #journal || hello in #journal ||
greetings in #journal || talk in #journal || respond in #journal || answer in #journal || speak in #journal ||
 admin in #journal || game in #journal || master in #journal || #charname in #journal )
{
if gm in #journal
set %textFlag gm
if afk in #journal
set %textFlag afk
if script in #journal
set %textFlag bot
if are in #journal
set %textFlag are
if you in #journal
set %textFlag you
if now in #journal
set %textFlag now
if hi in #journal
set %textFlag hi
if hey in #journal
set %textFlag hey
if hello in #journal
set %textFlag hello
if greetings in #journal
set %textFlag greetings
if talk in #journal
set %textFlag talk
if respond in #journal
set %textFlag respond
if answer in #journal
set %textFlag answer
if speak in #journal
set %textFlag speak
if admin in #journal
set %textFlag admin
if game in #journal
set %textFlag game
if master in #journal
set %textFlag master
if #charname in #journal
set %textFlag #charname
wait 20
event macro 1 0 decoy text here
wait 40
event macro 13 21
display ok Alert: #charname being watched! Flag: %textFlag - Script halted!$
halt
}
}
}

Edit: Wow, pardon the crappy spacing/formatting. Paste fail.
« Last Edit: April 22, 2009, 06:47:06 PM by silentsentinel »

Offline Endless Night

  • Global Moderator
  • *
  • *
  • Posts: 5467
  • Activity:
    0%
  • Reputation Power: 62
  • Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!
  • Respect: +393
  • Referrals: 1
    • View Profile
Re: Weird question I can't find any info on:
« Reply #4 on: April 22, 2009, 06:58:31 PM »
0
sorry the for loop is correct .. doesnt need an equal got my own sysntax confused.

Now onto the TImeout.

You set %Jend  2 lines after you set %Jstart .. thierfor in all probablity #jindex did not change in value.  Depending on what you have #LPC set to.

So it doesnt matter what the timeout is being as you are only journal scanning between #jstart and #jend which probably are exactly the same value.  IF you wanted to wait .5sec then set %jstart  wait 5  then set %jend instead of the while loop.  OR More complex something like below

Code: [Select]
set %jStart #jindex + 1
set %jTimeout #scnt2 + 5
set %Resultflag N/A
while #scnt2 < %jTimeout && %ResultFlag = N/A
  {
   set %jEnd #jindex
   IF %Jend >= %Jstart
     {
     for %ji %jStart %jEnd
{
scanjournal %ji
if larry in #journal
                    set %resultingflag  Larry
if curly in #journal
                    set %resultingflag  curly
if  moe in #journal
                    set %resultingflag  moe
            }
     set %Jstart %Jend + 1
    }
}

Outlaw Josey Wales - "Manwink, A Long Gone Scripty, and Endless are always teasing us with their private sections lol. What there realy saying is scripters rule and users drool."
Briza - "Your a living breathing vortex of usefulness."

Offline silentsentinelTopic starter

  • Jr. Member
  • **
  • Posts: 31
  • Activity:
    0%
  • Reputation Power: 0
  • silentsentinel has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Re: Weird question I can't find any info on:
« Reply #5 on: April 22, 2009, 07:31:17 PM »
0
Crap ok wow, so if I understand what you're saying right, I can just set %jend inside the while loop and as long as it's not being flagged to timeout it will actually refresh right? So, here's my new code (I don't use resulting flag as I just have the flag set %jtimeout to present time, thereby ending the loop) -

Code: [Select]
        set %jStart #jindex + 1
set %jTimeout #scnt2 + 5
while #scnt2 < %jTimeout
{
set %jEnd #jindex
for %ji %jStart %jEnd
{
scanjournal %ji
if gm in #journal
{
                             [evade]
                             set %jtimeout #scnt2
                        }
                }
        }
                           

Does that look logically correct?

Offline silentsentinelTopic starter

  • Jr. Member
  • **
  • Posts: 31
  • Activity:
    0%
  • Reputation Power: 0
  • silentsentinel has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Re: Weird question I can't find any info on:
« Reply #6 on: April 22, 2009, 09:22:30 PM »
0
update: script runs 1000x smoother now... lol

Offline silentsentinelTopic starter

  • Jr. Member
  • **
  • Posts: 31
  • Activity:
    0%
  • Reputation Power: 0
  • silentsentinel has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Re: Weird question I can't find any info on:
« Reply #7 on: April 25, 2009, 04:46:01 PM »
0
Hm, hey again all. Trying to finish last minute stuff in this script and I'm running into a weird problem intermittently. Basically this section of my code has a Journal Scan that's supposed to acquire the target's destination. The problem is though, sometime's the escorts response is completely missed, and the destination isn't set. I have it scanning for a full second after the speech command (have tried 1.5 seconds too...) is given and it's not missed all the time, just some of it, causing the script to hang up.

There is no other spam most of the time causing it to be not in Jindex or Jindex + 1 either... this is why it's got me baffled.

Am I doing something wrong, anyone have any ideas? (This particular part takes place in sub get Escort, AFTER stealing their gold. It seems to work fine before stealing their gold. So, after returning from sub stealGold and trying to get the destination is where the problem arises.)

Thanks guys. The script:

Code: [Select]
set #lpc 50
ignoreitem #charid
set %bankerID LSAO
set %loopScript #true
if #charname = [removed for security]
{
set %rbDepot YMIMJOD
set %rbDestination1 VOJMJOD
set %rbDestination2 NJKMJOD
set %rbMisc XMJMJOD
set %baseLocation escortDepot1
}
if #charname = [removed for security]
{
set %rbDepot KTJMJOD
set %rbDestination1 FXJMJOD
set %rbDestination2 DWJMJOD
set %rbMisc DEJMJOD
set %baseLocation escortDepot5
}
if #charname = [removed for security]
{
set %rbDepot OXHMJOD
set %rbDestination1 VRJMJOD
set %rbDestination2 FVIMJOD
set %rbMisc BFKMJOD
set %baseLocation escortDepot9
}
if #charname = [removed for security]
{
set %rbDepot TLIMJOD
set %rbDestination1 MYIMJOD
set %rbDestination2 ZKJMJOD
set %rbMisc DAJMJOD
set %baseLocation escortDepot13
}

while %loopScript = #true
{
gosub weightCheck
gosub recallAround
gosub getEscort
}

sub alertCheck
{
set %wrongText #false
set %wrongTextException #false
set %textFlag none
set %jStart #jindex + 5
set %jTimeout #scnt2 + 10
while #scnt2 < %jTimeout
{
set %jEnd #jindex
for %ji %jStart %jEnd
{
scanjournal %ji
if you_see:_admin in #journal || you_see:_counselor in #journal || you_see:_game in #journal || you_see:_gm in #journal || you_see:_staff in #journal
set %wrongTextException #true
if %wrongTextException = #false && ( ,_ , #charname , ! in #journal || #charname , :_ in #journal || afrodite in #journal || botan in #journal || bottle in #journal || can_page_for_vendor in #journal || [removed for security]:_guards in #journal || [removed for security]:_kal in #journal || [removed for security]:_vas in #journal || guildmaster in #journal || i_seem_to_have_lost_my_master in #journal || [removed for security]:_guards in #journal || [removed for security]:_kal in #journal || [removed for security]:_vas in #journal || samantha in #journal || samirah in #journal || samson in #journal || samuel in #journal || spell_fizzles in #journal || staff_message_from_gm in #journal || steal in #journal || you_see: in #journal )
set %wrongText #true
if %wrongText = #false && ( #charname in #journal || admin in #journal || afk in #journal || answer in #journal || bot in #journal || counselor in #journal || [removed for security] in #journal || game in #journal || gm in #journal || greetings in #journal || hello in #journal || hey in #journal || master in #journal || page in #journal || [removed for security] in #journal || respond in #journal || script in #journal || speak in #journal || talk in #journal )
{
if #charname in #journal
set %textFlag #charname
if admin in #journal
set %textFlag admin
if afk in #journal
set %textFlag afk
if answer in #journal
set %textFlag answer
if bot in #journal
set %textFlag bot
if counselor in #journal
set %textFlag counselor
if [removed for security] in #journal
set %textFlag fro
if game in #journal
set %textFlag game
if gm in #journal
set %textFlag gm
if greetings in #journal
set %textFlag greetings
if hello in #journal
set %textFlag hello
if hey in #journal
set %textFlag hey
if master in #journal
set %textFlag master
if page in journal
set %textFlag page
if [removed for security] in #journal
set %textFlag pip
if respond in #journal
set %textFlag respond
if script in #journal
set %textFlag script
if speak in #journal
set %textFlag speak
if talk in #journal
set %textFlag talk
wait 40
[removed for security]
event macro 13 21
display ok Alert: #charname being watched! Flag: %textFlag - Script halted!$
halt
}
}
if is_attacking_you in #journal
{
wait 20
event macro 1 0 [removed for security]
wait 20
event macro 13 21
display ok Alert: #charname being attacked! Script halted!$
halt
}
if more_reagents_are_needed_for_this_spell in #journal
{
wait 20
event macro 13 21
display ok Alert: #charname is out of reagents! Script halted!$
halt
}
if i_see_you_already_have_an_escort in #journal
{
wait 20
event macro 13 21
display ok Alert: #charname has an escort stuck! Script halted!$
halt
}
if world_will_save in #journal
{
wait 20
event macro 13 21
event exmsg #charid 0 175 World saving; pausing script for 1 minute.
wait 1200
}
}
if #charghost = yes
{
display ok Alert: #charname died! Script halted!$
halt
}
return
}

sub weightCheck
{
if #gold > 4500 || #weight > 250
{
gosub alertCheck
gosub useRunebook recall 1 %rbMisc
gosub alertCheck
exevent popup %bankerID 2
wait 20
set %bankID #contid
finditem POF C_ , #backpackid
gosub alertCheck
exevent drag #findid #findstack
gosub alertCheck
exevent dropc %bankID
return
}
if #charghost = no && #gold <= 4500 && #weight <= 250
return
}

sub recallAround
{
gosub alertCheck
if %baseLocation = escortDepot1
gosub useRunebook recall 1 %rbDepot
if %baseLocation = escortDepot2
gosub useRunebook recall 2 %rbDepot
if %baseLocation = escortDepot3
gosub useRunebook recall 3 %rbDepot
if %baseLocation = escortDepot4
gosub useRunebook recall 4 %rbDepot
if %baseLocation = escortDepot5
gosub useRunebook recall 5 %rbDepot
if %baseLocation = escortDepot6
gosub useRunebook recall 6 %rbDepot
if %baseLocation = escortDepot7
gosub useRunebook recall 7 %rbDepot
if %baseLocation = escortDepot8
gosub useRunebook recall 8 %rbDepot
if %baseLocation = escortDepot9
gosub useRunebook recall 9 %rbDepot
if %baseLocation = escortDepot10
gosub useRunebook recall 10 %rbDepot
if %baseLocation = escortDepot11
gosub useRunebook recall 11 %rbDepot
if %baseLocation = escortDepot12
gosub useRunebook recall 12 %rbDepot
if %baseLocation = escortDepot13
gosub useRunebook recall 13 %rbDepot
if %baseLocation = escortDepot14
gosub useRunebook recall 14 %rbDepot
if %baseLocation = escortDepot15
useRunebook recall 15 %rbDepot
if %baseLocation = escortDepot16
gosub useRunebook recall 16 %rbDepot
return
}

sub getEscort
{
set %destination none
set %escortFound #false
set %followers none
set %markFound #false
set %nearnpcID none
set %npcID none
set %npcPosX none
set %npcPosY none
set %redestAttempt #false
finditem HS_IS G_4
if #findcnt > 0
{
set %markFound #true
set %npcID #findid
finditem %npcID G_6
set %npcPosX #findx
set %npcPosY #findy
gosub alertCheck
set %jStart #jindex + 1
event pathfind %npcPosX %npcPosY
set %jTimeout #scnt2 + 10
while #scnt2 < %jTimeout
{
set %jEnd #jindex
for %ji %jStart %jEnd
{
scanjournal %ji
if can't_get_there in #journal
{
set %markFound #false
set %jTimeout #scnt2
}
}
}
}
if %markFound = #true
{
gosub alertCheck
set %jStart #jindex + 1
event macro 1 0 destination
set %jTimeout #scnt2 + 10
while #scnt2 < %jTimeout
{
set %jEnd #jindex
for %ji %jStart %jEnd
{
scanjournal %ji
if i_am_looking_to_go_to_britain in #journal || i_am_looking_to_go_to_cove in #journal || i_am_looking_to_go_to_covetous in #journal || i_am_looking_to_go_to_deceit in #journal || i_am_looking_to_go_to_despise in #journal || i_am_looking_to_go_to_destard in #journal || i_am_looking_to_go_to_hythloth in #journal || i_am_looking_to_go_to_jhelom in #journal || i_am_looking_to_go_to_magincia in #journal || i_am_looking_to_go_to_minoc in #journal || i_am_looking_to_go_to_moonglow in #journal || i_am_looking_to_go_to_nujel in #journal || i_am_looking_to_go_to_ocllo in #journal || i_am_looking_to_go_to_serpent in #journal || i_am_looking_to_go_to_shame in #journal || i_am_looking_to_go_to_skara in #journal || i_am_looking_to_go_to_trinsic in #journal || i_am_looking_to_go_to_vesper in #journal || i_am_looking_to_go_to_wrong in #journal || i_am_looking_to_go_to_yew in #journal
{
set %escortFound #true
set %jTimeout #scnt2
}
}
}
if %escortFound = #false
ignoreitem %npcID
if %escortFound = #true
{
finditem %npcID G_6
if #findx <> %npcPosX || #findy <> %npcPosY
{
finditem %npcID G_6
set %npcPosX #findx
set %npcPosY #findy
gosub alertCheck
event pathfind %npcPosX %npcPosY
}
gosub alertCheck
set %followers #followers
event macro 1 0 i will take thee
gosub stealGold %npcID
redestAttempt:
gosub alertCheck
set %jStart #jindex + 1
event macro 1 0 destination
set %jTimeout #scnt2 + 10
while #scnt2 < %jTimeout
{
set %jEnd #jindex
for %ji %jStart %jEnd
{
scanjournal %ji
if britain in #journal
{
set %destination britain
set %jTimeout #scnt2
}
if cove in #journal
{
set %destination cove
set %jTimeout #scnt2
}
if covetous in #journal
{
set %destination covetous
set %jTimeout #scnt2
}
if deceit in #journal
{
set %destination deceit
set %jTimeout #scnt2
}
if despise in #journal
{
set %destination despise
set %jTimeout #scnt2
}
if destard in #journal
{
set %destination destard
set %jTimeout #scnt2
}
if hythloth in #journal
{
set %destination hythloth
set %jTimeout #scnt2
}
if jhelom in #journal
{
set %destination jhelom
set %jTimeout #scnt2
}
if magincia in #journal
{
set %destination magincia
set %jTimeout #scnt2
}
if minoc in #journal
{
set %destination minoc
set %jTimeout #scnt2
}
if moonglow in #journal
{
set %destination moonglow
set %jTimeout #scnt2
}
if nujel in #journal
{
set %destination nujel
set %jTimeout #scnt2
}
if ocllo in #journal
{
set %destination ocllo
set %jTimeout #scnt2
}
if serpent in #journal
{
set %destination serpent
set %jTimeout #scnt2
}
if shame in #journal
{
set %destination shame
set %jTimeout #scnt2
}
if skara in #journal
{
set %destination skara
set %jTimeout #scnt2
}
if trinsic in #journal
{
set %destination trinsic
set %jTimeout #scnt2
}
if vesper in #journal
{
set %destination vesper
set %jTimeout #scnt2
}
if wrong in #journal
{
set %destination wrong
set %jTimeout #scnt2
}
if yew in #journal
{
set %destination yew
set %jTimeout #scnt2
}
}
}
gosub alertCheck
if %destination = none && %redestAttempt = #false
{
set %redestAttempt #true
goto redestAttempt
}
if %redestAttempt = #true
{
wait 20
event macro 13 21
display ok Alert: #charname did not receive a destination from their escort after 2 attempts! Script halted!$
halt
}
if %destination = britain
gosub useRunebook gate 1 %rbDestination1
if %destination = cove
gosub useRunebook gate 2 %rbDestination1
if %destination = covetous
gosub useRunebook gate 3 %rbDestination1
if %destination = deceit
gosub useRunebook gate 4 %rbDestination1
if %destination = despise
gosub useRunebook gate 5 %rbDestination1
if %destination = destard
gosub useRunebook gate 6 %rbDestination1
if %destination = hythloth
gosub useRunebook gate 7 %rbDestination1
if %destination = jhelom
gosub useRunebook gate 8 %rbDestination1
if %destination = magincia
gosub useRunebook gate 9 %rbDestination1
if %destination = minoc
gosub useRunebook gate 10 %rbDestination1
if %destination = moonglow
gosub useRunebook gate 11 %rbDestination1
if %destination = nujel
gosub useRunebook gate 12 %rbDestination1
if %destination = ocllo
gosub useRunebook gate 13 %rbDestination1
if %destination = serpent
gosub useRunebook gate 14 %rbDestination1
if %destination = shame
gosub useRunebook gate 15 %rbDestination1
if %destination = skara
gosub useRunebook gate 16 %rbDestination1
if %destination = trinsic
gosub useRunebook gate 1 %rbDestination2
if %destination = vesper
gosub useRunebook gate 2 %rbDestination2
if %destination = wrong
gosub useRunebook gate 3 %rbDestination2
if %destination = yew
gosub useRunebook gate 4 %rbDestination2
}
}
if %markFound = #false
{
if %baseLocation = escortDepot1
{
set %baseLocation escortDepot2
return %baseLocation
}
if %baseLocation = escortDepot2
{
set %baseLocation escortDepot3
return %baseLocation
}
if %baseLocation = escortDepot3
{
set %baseLocation escortDepot4
return %baseLocation
}
if %baseLocation = escortDepot4
{
set %baseLocation escortDepot5
return %baseLocation
}
if %baseLocation = escortDepot5
{
set %baseLocation escortDepot6
return %baseLocation
}
if %baseLocation = escortDepot6
{
set %baseLocation escortDepot7
return %baseLocation
}
if %baseLocation = escortDepot7
{
set %baseLocation escortDepot8
return %baseLocation
}
if %baseLocation = escortDepot8
{
set %baseLocation escortDepot9
return %baseLocation
}
if %baseLocation = escortDepot9
{
set %baseLocation escortDepot10
return %baseLocation
}
if %baseLocation = escortDepot10
{
set %baseLocation escortDepot11
return %baseLocation
}
if %baseLocation = escortDepot11
{
set %baseLocation escortDepot12
return %baseLocation
}
if %baseLocation = escortDepot12
{
set %baseLocation escortDepot13
return %baseLocation
}
if %baseLocation = escortDepot13
{
set %baseLocation escortDepot14
return %baseLocation
}
if %baseLocation = escortDepot14
{
set %baseLocation escortDepot15
return %baseLocation
}
if %baseLocation = escortDepot15
{
set %baseLocation escortDepot16
return %baseLocation
}
if %baseLocation = escortDepot16
{
set %baseLocation escortDepot1
return %baseLocation
}
}
set %markFound none
return
}

sub stealGold
{
gosub alertCheck
gosub useRunebook stealgold 2 %rbMisc
wait 20
set #lobjectid %npcID
gosub alertCheck
event macro 17
wait 20
finditem ZJF CA_ , #contid
set #lobjectid #findid
gosub alertCheck
event macro 17
wait 20
finditem POF C_ , #contid
set #ltargetid #findid
set #ltargetkind 1
gosub alertCheck
event macro 13 33
target 5s
event macro 22
set %waitTimer #scnt2 + 100
while #scnt2 < %waitTimer
gosub alertCheck
finditem POF C_ , #contid
set #ltargetid #findid
set #ltargetkind 1
gosub alertCheck
event macro 13 33
target 5s
event macro 22
set %waitTimer #scnt2 + 100
while #scnt2 < %waitTimer
gosub alertCheck
event macro 13 21
set %waitTimer #scnt2 + 1200
while #scnt2 < %waitTimer
gosub alertCheck
return
}

sub useRunebook
{
set %rbAction %1
set %rbRune %2 - 1
set %rb %3
set %reTravel #false
reTravel:
if %reTravel = #true
{
set %reTravel #false
wait 40
}
finditem %rb C_ , #backpackid
set #lobjectid #findid
gosub alertCheck
event macro 17
wait 20
set %rbPage ( %rbRune / 2 ) + 1
if %rbPage < 5
set %rbPage %rbPage - 1
set %rbX #contposx + 140 + ( 35 * %rbPage )
set %rbY #contposy + 200
gosub alertCheck
click %rbX %rbY dmc
gosub alertCheck
if %rbAction = recall
{
set %rbX #contposx + 150 + ( 160 * ( %rbRune % 2 ) )
set %rbY #contposy + 175
set %jStart #jindex + 1
click %rbX %rbY dmc
set %jTimeout #scnt2 + 30
while #scnt2 < %jTimeout
{
set %jEnd #jindex
for %ji %jStart %jEnd
{
scanjournal %ji
if spell_fizzles in #journal
{
set %reTravel #true
goto reTravel
}
}
}
}
if %rbAction = gate
{
set %confX none
set %confY none
set %rbX #contposx + 225 + ( 160 * ( %rbRune % 2 ) )
set %rbY #contposy + 175
set %jStart #jindex + 1
click %rbX %rbY dmc
set %jTimeout #scnt2 + 30
while #scnt2 < %jTimeout
{
set %jEnd #jindex
for %ji %jStart %jEnd
{
scanjournal %ji
if spell_fizzles in #journal || that_location_is_blocked in #journal
{
set %reTravel #true
goto reTravel
}
}
}
finditem OTF G_1
set #lobjectid #findid
gosub alertCheck
event macro 17
wait 40
set %confX #contposx + 35
set %confY #contposy + 150
gosub alertCheck
click %confX %confY dmc
wait 20
finditem OTF G_1
set #lobjectid #findid
gosub alertCheck
event macro 17
wait 40
set %confX #contposx + 35
set %confY #contposy + 150
gosub alertCheck
click %confX %confY dmc
wait 20
gosub weightCheck
gosub alertCheck
event macro 13 21
set %waitTimer #scnt2 + 1000
while #scnt2 < %waitTimer
gosub alertCheck
}
if %rbAction = stealgold
{
set %confX none
set %confY none
set %rbX #contposx + 225 + ( 160 * ( %rbRune % 2 ) )
set %rbY #contposy + 175
gosub alertCheck
set %jStart #jindex + 1
click %rbX %rbY dmc
set %jTimeout #scnt2 + 30
while #scnt2 < %jTimeout
{
set %jEnd #jindex
for %ji %jStart %jEnd
{
scanjournal %ji
if that_location_is_blocked in #journal
{
wait 20
event macro 13 21
display ok Alert: #charname has an escort or obstruction blocking their steal spot! Script halted!$
halt
}
if spell_fizzles in #journal
{
set %reTravel #true
goto reTravel
}
}
}
finditem OTF G_1
set #lobjectid #findid
gosub alertCheck
event macro 17
wait 40
set %confX #contposx + 35
set %confY #contposy + 150
gosub alertCheck
click %confX %confY dmc
}
return
}

Offline Endless Night

  • Global Moderator
  • *
  • *
  • Posts: 5467
  • Activity:
    0%
  • Reputation Power: 62
  • Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!
  • Respect: +393
  • Referrals: 1
    • View Profile
Re: Weird question I can't find any info on:
« Reply #8 on: April 26, 2009, 05:44:34 AM »
0
Sorry dont have time to totally debug it .. but one thing jumped to mind to make code faster ..

instead of
Code: [Select]
if i_am_looking_to_go_to_britain in #journal || i_am_looking_to_go_to_cove in #journal || i_am_looking_to_go_to_covetous in #journal || i_am_looking_to_go_to_deceit in #journal || i_am_looking_to_go_to_despise in #journal || i_am_looking_to_go_to_destard in #journal || i_am_looking_to_go_to_hythloth in #journal || i_am_looking_to_go_to_jhelom in #journal || i_am_looking_to_go_to_magincia in #journal || i_am_looking_to_go_to_minoc in #journal || i_am_looking_to_go_to_moonglow in #journal || i_am_looking_to_go_to_nujel in #journal || i_am_looking_to_go_to_ocllo in #journal || i_am_looking_to_go_to_serpent in #journal || i_am_looking_to_go_to_shame in #journal || i_am_looking_to_go_to_skara in #journal || i_am_looking_to_go_to_trinsic in #journal || i_am_looking_to_go_to_vesper in #journal || i_am_looking_to_go_to_wrong in #journal || i_am_looking_to_go_to_yew in #journal

just use
Code: [Select]
if i_am_looking_to_go_to_ IN #journal
Outlaw Josey Wales - "Manwink, A Long Gone Scripty, and Endless are always teasing us with their private sections lol. What there realy saying is scripters rule and users drool."
Briza - "Your a living breathing vortex of usefulness."

Offline silentsentinelTopic starter

  • Jr. Member
  • **
  • Posts: 31
  • Activity:
    0%
  • Reputation Power: 0
  • silentsentinel has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Re: Weird question I can't find any info on:
« Reply #9 on: April 26, 2009, 11:32:26 AM »
0
Hey Endless, I think I figured it out, I didn't have "set %Jstart %Jend + 1" outside my for loop. That made it seem to work more smoothly... but I really am unsure as to why that if statement/ and re-setting of that variable is neccessary. It works, but I'm not sure why it's needed, if you have time to clarify that'd help a ton :) Thanks

Offline Endless Night

  • Global Moderator
  • *
  • *
  • Posts: 5467
  • Activity:
    0%
  • Reputation Power: 62
  • Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!
  • Respect: +393
  • Referrals: 1
    • View Profile
Re: Weird question I can't find any info on:
« Reply #10 on: April 28, 2009, 05:22:23 AM »
0
Outlaw Josey Wales - "Manwink, A Long Gone Scripty, and Endless are always teasing us with their private sections lol. What there realy saying is scripters rule and users drool."
Briza - "Your a living breathing vortex of usefulness."

Offline silentsentinelTopic starter

  • Jr. Member
  • **
  • Posts: 31
  • Activity:
    0%
  • Reputation Power: 0
  • silentsentinel has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Re: Weird question I can't find any info on:
« Reply #11 on: April 28, 2009, 08:05:20 AM »
0
Hey Endless,

I've read the wiki multiple times. Really they don't do much there to explain the logic... they simply spell out the methodology without explaining why certain things are set as they are.

anyway the only real question I have left that I haven't figured out is the following.. Why is the following even used?

"if %jEnd >= %jStart"
{

}
set %jStart %jEnd + 1 (or set %jStart %jEnd)"

It seems redundant, but maybe I'm missing something in the logic. Basically it seems as if %jEnd/#jindex will never NOT be >= whatever you set %jStart to, right?

For whatever reason the script seemed to process a bit faster with that statement in place... but I totally don't see why it's used, if someone could explain it a bit.

I think I understand the rest, just wanna figure out this last piece. Thanks all.

Offline Endless Night

  • Global Moderator
  • *
  • *
  • Posts: 5467
  • Activity:
    0%
  • Reputation Power: 62
  • Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!
  • Respect: +393
  • Referrals: 1
    • View Profile
Re: Weird question I can't find any info on:
« Reply #12 on: April 28, 2009, 02:29:52 PM »
0
"if %jEnd >= %jStart"

Is Used so that you dont bother attempt to do the for loop when you have nothing to loop.  Ie if the journal count has not increased dont bother scan it.


set %jStart %jEnd + 1 (or set %jStart %jEnd)"

Well lets say you just scanned journal entried 10-60 (start End) the next time you scan you dont want to scan 10-61 do you as that would just be wasting time.. isnt it much better on the next scan to just scan 61-61 Or 61-whatever the new index is at.  And if you thier is no new entry #jindex = 60 then the if above wont bother scan at all.

Outlaw Josey Wales - "Manwink, A Long Gone Scripty, and Endless are always teasing us with their private sections lol. What there realy saying is scripters rule and users drool."
Briza - "Your a living breathing vortex of usefulness."

Offline silentsentinelTopic starter

  • Jr. Member
  • **
  • Posts: 31
  • Activity:
    0%
  • Reputation Power: 0
  • silentsentinel has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Re: Weird question I can't find any info on:
« Reply #13 on: April 28, 2009, 08:21:23 PM »
0
excellent, makes sense now

so my original issue is solved by setting %jStart to #jindex - 5 before the while loop, and setting %jStart to #jindex + 1 thereafter during the loop/if statement :)

Seems to scan previous lines with no redundant scanning, while catching the new lines as well. Testing that now and it seems to be working for me,

Thanks everyone for all the help, much obliged.

Offline Endless Night

  • Global Moderator
  • *
  • *
  • Posts: 5467
  • Activity:
    0%
  • Reputation Power: 62
  • Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!
  • Respect: +393
  • Referrals: 1
    • View Profile
Re: Weird question I can't find any info on:
« Reply #14 on: April 29, 2009, 06:45:48 AM »
0
No problem glad it all worked out in the end.  The whole journal scanning is a little bit weird at first but once you get your head around it you can do loads of stuff.
Outlaw Josey Wales - "Manwink, A Long Gone Scripty, and Endless are always teasing us with their private sections lol. What there realy saying is scripters rule and users drool."
Briza - "Your a living breathing vortex of usefulness."

Tags: