Author Topic: Somewhat working EasyUO context coloring  (Read 3984 times)

0 Members and 1 Guest are viewing this topic.

Offline TrailMyxTopic starter

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13301
  • Activity:
    0%
  • 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
Somewhat working EasyUO context coloring
« on: February 20, 2017, 09:30:46 PM »
0
Had a few minutes today to figure out Geshi.  This is pretty close and those who use ScriptUO will know the colors..

Its not 100% yet, but it works OK for now.

Code: easyuo
  1. ;-------------------------------------------------------------------------------
  2. ;-----------------------  TM Advanced Journal Subs   ---------------------------
  3. ;-------------------------------------------------------------------------------
  4. ; %1 - Journal Name
  5. ; %2 - #LPC setting (optional)
  6. ; Brings !_jindex up to the most recent #journal entry
  7. sub TM_AdvJournalSync
  8.   namespace push
  9.   namespace local TM_AdvJS_ , %1
  10.   set !_jindex #jindex + 1
  11.   if %0 > 1
  12.     set !lpc_set %2
  13.   namespace pop
  14.   set !TM_FunctionCalled #TRUE
  15. return
  16. ;-------------------------------------------------------------------------------
  17. ; %1 - Journal Name
  18. ; %2 - NONE, ADVANCE , ( _VALID ) - advances jindex pointer, anything else
  19. ; %3, %4, %5, etc strings to match
  20. ; returns #TRUE for match, #FALSE for no match
  21. ;  Will not advance !_jindex pointer to allow for scanning journal history for more than one search.
  22. ;  Also searches for : , #SPC in journal entry to be sure someone isn't spamming the text
  23. ;  About %2 arguments:
  24. ;    NONE: defaults to basic journal scan (no SPAM checking, no #jindex pointer copy advancing)
  25. ;    ADVANCE: no spam checking, advances #jindex copy
  26. ;    VALID: invokes SPAM filtering, no advance of #jindex copy
  27. ;    VALID_ADVANCE, VALIDADVANCE, ADVANCE_VALID, etc.: invokes SPAM filtering, advances of #jindex copy
  28. sub TM_AdvJournalScan
  29.   namespace push
  30.   namespace local TM_AdvJS_ , %1
  31.   set !args %2
  32.   set !temp_lpc #LPC
  33.   if !lpc_set = N/A
  34.     set #LPC 1000
  35.   else
  36.     set #LPC !lpc_set
  37.   set !num_args %0
  38.   set !first_arg 3
  39.   set !sampled_jindex #JINDEX
  40.   if !_jindex = N/A
  41.     set !_jindex !sampled_jindex
  42.   if !charname = N/A
  43.   {
  44.     set !charname #CHARNAME
  45. AdvJournalScan_loop1:
  46.     str pos !charname #SPC
  47.     if #STRRES <> 0
  48.     {
  49.       set !val #STRRES - 1
  50.       str left !charname !val
  51.       set !left #STRRES
  52.       set !val !val + 1
  53.       str del !charname 1 !val
  54.       set !charname !left , _ , #STRRES
  55.       goto AdvJournalScan_loop1
  56.     }
  57.   }
  58.   set !index !first_arg
  59.   repeat
  60.     set !temp_jindex !_jindex
  61.     set !text % . !index
  62.     while !temp_jindex <= !sampled_jindex
  63.     {
  64.       scanjournal !temp_jindex
  65.       str pos #JOURNAL !charname 1
  66.       set !namepos #STRRES
  67.       str count #JOURNAL !charname
  68.       set !namecnt #STRRES
  69.       str pos #JOURNAL :_ 1
  70.       set !smcpos #STRRES
  71.       str pos #JOURNAL !text 1
  72.       set !textpos #STRRES
  73.       if !textpos < !smcpos && !smcpos <> 0 || !smcpos = 1 || :_ notin #JOURNAL || VALID notin !args
  74.         set !pass #TRUE
  75.       else
  76.         set !pass #FALSE
  77.       if ( !text in #journal && ( ( !namepos = 1 && !namecnt <= 1 ) || !pass ) )
  78.       {
  79.         set !temp_jindex !temp_jindex + 1
  80.         if ADVANCE in !args
  81.           set !_jindex !temp_jindex
  82.         set !trigger !text
  83.         set #LPC !temp_lpc
  84.         namespace pop
  85.         set !TM_FunctionCalled #TRUE
  86.         return #TRUE
  87.       }
  88.       set !temp_jindex !temp_jindex + 1
  89.     }
  90.     set !index !index + 1
  91.   until !index - !first_arg > !num_args - !first_arg
  92.   set %10 !sampled_jindex - !_jindex
  93.   set %10 %1 , _ , %10 ; for debugging purposes
  94.   set #LPC !temp_lpc
  95.   set !trigger #FALSE
  96.   namespace pop
  97.   set !TM_FunctionCalled #TRUE
  98. return #FALSE
  99.  
« Last Edit: February 21, 2017, 10:43:00 AM by TrailMyx »
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline TrailMyxTopic starter

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13301
  • Activity:
    0%
  • 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: Somewhat working EasyUO context coloring
« Reply #1 on: February 20, 2017, 10:19:38 PM »
0
I'm going to have to pull the code though since it's throwing site warnings.   

Edit: never mind, I figured it out. :)
« Last Edit: February 20, 2017, 10:40:04 PM by TrailMyx »
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline TrailMyxTopic starter

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13301
  • Activity:
    0%
  • 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: Somewhat working EasyUO context coloring
« Reply #2 on: February 22, 2017, 10:54:15 AM »
0
So I've almost got this working completely.  I need to figure out how to tell GeSHi how to avoid coloration of keywords when they reside in a variable.  I found how to do it for comments, but it's a bit more involved for keywords and requires a bit of RegEx magic that I'll have to blindly grope my way toward..
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline BobOzarius

  • Full Member
  • ***
  • Posts: 103
  • Activity:
    0%
  • Reputation Power: 2
  • BobOzarius has no influence.
  • Respect: +26
  • Referrals: 0
    • View Profile

Offline TrailMyxTopic starter

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13301
  • Activity:
    0%
  • 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: Somewhat working EasyUO context coloring
« Reply #4 on: February 22, 2017, 02:20:58 PM »
0
;)  http://www.freeformatter.com/regex-tester.html

Heh, oh yes, I have a few links to various testers.  Unfortunately I need to unlock a very undocumented feature in GeSHi that seems to use reverse-logic and some magic sprinkled in.  Oh yeh, and RegEx.  lol

https://regex101.com/

http://regexr.com/
« Last Edit: February 22, 2017, 02:24:46 PM by TrailMyx »
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline BobOzarius

  • Full Member
  • ***
  • Posts: 103
  • Activity:
    0%
  • Reputation Power: 2
  • BobOzarius has no influence.
  • Respect: +26
  • Referrals: 0
    • View Profile
Re: Somewhat working EasyUO context coloring
« Reply #5 on: February 25, 2017, 02:04:53 PM »
0
Regex is so fun. I've found so many crazy uses for it. It's crazy when you are proficient in it's use.

Tags: