Freeshard Launching made easy! SUO Launcher HERE
0 Members and 2 Guests are viewing this topic.
gosub TM_AdvJournalSync heal 100while 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 #TRUEreturnsub 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 #TRUEreturn #FALSE
set %string cookiesgosub TM_AdvJournalSync scanner1 100while #TRUE{ gosub TM_AdvJournalScan scanner1 VALID_ADVANCE %string if #RESULT = #TRUE display Found , #SPC , %string}stop
set %not_found 0set %string cookiesgosub TM_AdvJournalSync scanner1 100while ( %not_found <> 1 ){ gosub TM_AdvJournalScan scanner1 VALID_ADVANCE %string if #RESULT = #TRUE %not_found = 1}stop
gosub TM_AdvJournalSync scanner1 100repeat gosub TM_AdvJournalScan scanner1 VALID_ADVANCE cookiesuntil #RESULT = #TRUEdisplay Cookies!!!stop
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 0set %string cookiesgosub TM_AdvJournalSync scanner1 100while ( %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