Author Topic: [FIXED] Help using TrailMyx's advanced journal scanner  (Read 4589 times)

0 Members and 1 Guest are viewing this topic.

Offline ChubbaTopic starter

  • Newbie
  • *
  • Posts: 5
  • Activity:
    0%
  • Reputation Power: 0
  • Chubba has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
[FIXED] Help using TrailMyx's advanced journal scanner
« on: March 09, 2009, 06:48:27 PM »
0
I'm new to coding, so this is probably a stupid question on my part, but for the life of me I can't figure out how to integrate these subs into my script. Every time It try, I get the error "You may not run this script directly." How do I add it to my script? Or do I run it in another tab?
« Last Edit: May 07, 2009, 11:38:50 AM by TrailMyx »

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13302
  • Activity:
    0.2%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: Help using TrailMyx's advanced journal scanner
« Reply #1 on: March 09, 2009, 06:53:10 PM »
0
Just copy my subs into your code.   They aren't meant to be run directly, but used via "gosub". 
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline ChubbaTopic starter

  • Newbie
  • *
  • Posts: 5
  • Activity:
    0%
  • Reputation Power: 0
  • Chubba has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Re: Help using TrailMyx's advanced journal scanner
« Reply #2 on: March 09, 2009, 07:37:30 PM »
0
So just copy them over like in this example? Why isn't it working?

Code: [Select]
gosub TM_AdvJournalSync heal 100
while 1
{
 gosub TM_AdvJournalScan heal VALID cookies_
  if #RESULT = #TRUE
  {
    event macro 1 0 Bam!
  }
}

sub TM_AdvJournalSync
  namespace push
  namespace local TM_AdvJS_ , %1
  set !_jindex #jindex + 1
  if %0 > 1
    set !lpc_set %2
  namespace pop
  set !TM_FunctionCalled #TRUE
return

sub TM_AdvJournalScan
  namespace push
  namespace local TM_AdvJS_ , %1
  set !args %2
  set !temp_lpc #LPC
  if !lpc_set = N/A
    set #LPC 1000
  else
    set #LPC !lpc_set
  set !num_args %0
  set !first_arg 3
  if !_jindex = N/A
    set !_jindex #jindex
  if !charname = N/A
  {
    set !charname #CHARNAME
    AdvJournalScan_loop1:
      str pos !charname #SPC
      if #STRRES <> 0
      {
        set !val #STRRES - 1
        str left !charname !val
        set !left #STRRES
        set !val !val + 1
        str del !charname 1 !val
        set !charname !left , _ , #STRRES
        goto AdvJournalScan_loop1
      }
  }
  set !index !first_arg
  repeat
    set !temp_jindex !_jindex
    set !text % . !index
    while !temp_jindex <= #jindex
    {
      scanjournal !temp_jindex
      str pos #JOURNAL !charname 1
      set !namepos #STRRES
      str count #JOURNAL !charname
      set !namecnt #STRRES
      str pos #JOURNAL :_ 1
      set !smcpos #STRRES
      str pos #JOURNAL !text 1
      set !textpos #STRRES
      if !textpos < !smcpos && !smcpos <> 0 || !smcpos = 1 || :_ notin #JOURNAL || VALID notin !args
        set !pass #TRUE
      else
        set !pass #FALSE
      if ( !text in #journal && ( ( !namepos = 1 && !namecnt <= 1 ) || !pass ) )
      {
        set !temp_jindex !temp_jindex + 1
        if ADVANCE in !args
          set !_jindex !temp_jindex
        set #LPC !temp_lpc
        namespace pop
        set !TM_FunctionCalled #TRUE
        return #TRUE
      }
      set !temp_jindex !temp_jindex + 1
    }
    set !index !index + 1
  until !index - !first_arg > !num_args - !first_arg
  set #LPC !temp_lpc
  namespace pop
  set !TM_FunctionCalled #TRUE
return #FALSE
« Last Edit: March 09, 2009, 07:41:46 PM by Chubba »

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13302
  • Activity:
    0.2%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: Help using TrailMyx's advanced journal scanner
« Reply #3 on: March 09, 2009, 07:50:41 PM »
0
A couple reasons why that's not working.

1)  Your while loop is not "looping".  In easyuo, a boolean #TRUE is not 1 but -1.  So you need to have "while #TRUE"
2)  TM_AdvJournalSync returns #TRUE or #FALSE based on if it finds something in  your journal.  So just have an "if" statement
3)  I'd recommend you initialize your journal handler with a TM_AdvJournalSync at the beginning of your script just to clear out any possibile residual "cookies" lurking about in your journal history.

Here's the fixed code:

Code: [Select]
set %string cookies
gosub TM_AdvJournalSync scanner1 100
while #TRUE
{
 gosub TM_AdvJournalScan scanner1 VALID_ADVANCE %string
 if #RESULT = #TRUE
   display Found , #SPC , %string
}
stop
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline ChubbaTopic starter

  • Newbie
  • *
  • Posts: 5
  • Activity:
    0%
  • Reputation Power: 0
  • Chubba has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Re: Help using TrailMyx's advanced journal scanner
« Reply #4 on: March 09, 2009, 08:08:24 PM »
0
Cool! Thanks. So if I wanted to loop through and do something while a string, say cookies, was not found in my journal, would I code it like this:

Code: [Select]
set %not_found 0
set %string cookies
gosub TM_AdvJournalSync scanner1 100
while ( %not_found <> 1 )
{
 gosub TM_AdvJournalScan scanner1 VALID_ADVANCE %string
 if #RESULT = #TRUE
   %not_found = 1
}
stop

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13302
  • Activity:
    0.2%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: Help using TrailMyx's advanced journal scanner
« Reply #5 on: March 09, 2009, 08:15:58 PM »
0
Personally I would do it like this:

Code: [Select]
gosub TM_AdvJournalSync scanner1 100
repeat
 gosub TM_AdvJournalScan scanner1 VALID_ADVANCE cookies
until #RESULT = #TRUE
display Cookies!!!
stop
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline Superslayer

  • Elite
  • *
  • *
  • Posts: 1006
  • Activity:
    0%
  • Reputation Power: 14
  • Superslayer barely matters.Superslayer barely matters.
  • Gender: Male
  • Well what do you drink? Not tea.
  • Respect: +43
  • Referrals: 0
    • View Profile
Re: Help using TrailMyx's advanced journal scanner
« Reply #6 on: March 09, 2009, 09:39:48 PM »
0
Cool! Thanks. So if I wanted to loop through and do something while a string, say cookies, was not found in my journal, would I code it like this:

Code: [Select]
set %not_found 0
set %string cookies
gosub TM_AdvJournalSync scanner1 100
while ( %not_found <> 1 )
{
 gosub TM_AdvJournalScan scanner1 VALID_ADVANCE %string
 if #RESULT = #TRUE
   %not_found = 1
}
stop

Don't forget the 'Set' when #result = #true

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13302
  • Activity:
    0.2%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: Help using TrailMyx's advanced journal scanner
« Reply #7 on: March 09, 2009, 10:38:32 PM »
0

Don't forget the 'Set' when #result = #true

So true.  EasyUO is such a hodge-podge of different languages.  If you look into it, you'll find BASIC, PHP, Perl, C, etc.  Even FORTRAN just because you have limitations on how the code is formatted (i.e. first item in a line is ALWAYS a command).  FORTRAN was a bit more strict (i.e. first character being "*' denoted a comment, etc.)  Yes, I had to take FORTRAN 77 in college, and FORTRAN 4 in high school.  :(

My brain is cluttered with so much crap.  All those damn Pascal classes!! 
« Last Edit: March 09, 2009, 10:41:20 PM by TrailMyx »
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline ChubbaTopic starter

  • Newbie
  • *
  • Posts: 5
  • Activity:
    0%
  • Reputation Power: 0
  • Chubba has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Re: Help using TrailMyx's advanced journal scanner
« Reply #8 on: March 10, 2009, 10:10:03 AM »
0
Yeah, that threw me off for a bit, but I figured it I was missing a set eventually. I've taken classes on C, C++, Java and Javascript, so some stuff comes easy, others not so much.

Tags: