Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - TrailMyx

Pages: 1 ... 614 615 [616] 617 618 ... 622
9226
General Discussion / Re: Set multiple variables at once
« on: June 13, 2008, 10:31:41 AM »
So, perhaps, just as simple as that, it might be able to be done?

Yeh, I'm pretty sure I'm not going to break any existing precedence rules or any other rule for that matter.  I'll check into it.  Good idea.

9227
General Discussion / Re: Set multiple variables at once
« on: June 13, 2008, 03:31:44 AM »
I was thinking about your original question a bit, Nicar.  I don't think it breaks any rule to do just this:

Code: [Select]
set %count1 %count2 %count3 %count4 0

Since this breaks down into 6 tokens, I always know the first token is the command and the last token is the argument to set to (assuming 3+).  So it's actually pretty straightforward to say that tokens 1 to n - 1 should be set to the same value.

EasyUO would evaluate it a bit differently:

Code: [Select]
set %count1 %count2

the %count3 %count4 0 part would be ignored.

9228
no kidding.  I've never really quit; I've always had a main account that I've paid for since the beginning.  But I've let it go unplayed for months at a time.  Then there have been times, especially in my IDOC days when I'd have 5 paid accounts to hold all the houses back in the day when you couldn't place a house anywhere on a shard.  Those were crazy days; I miss that.

9229
New member introductions / Re: Maddog HERE!!!
« on: June 13, 2008, 03:15:14 AM »
Howdy Maddog!  Glad  you made it here too!  Yet another site, no?  Well, this one isn't going anywhere anytime soon.

But welcome to you!

9230
General Discussion / Re: Set multiple variables at once
« on: June 12, 2008, 09:01:08 PM »
well, how about a colon ?   :  I don't think it's used for anything
Code: [Select]
int %count1 : %count2
float %realmath : %candivide

Yeh, I was going to look at what doesn't impact EasyUO too much, and can be included in the syntax that won't mess up EasyUO itself.  But I'm scheming.. ;)

9231
General Discussion / Re: Set multiple variables at once
« on: June 12, 2008, 08:38:30 PM »
Yeh, there are all kinds of constructs for various languages that allow you to specify the "type" of a variable.  I'll have to look at what matches closely enough to the EasyUO language.  I don't want this to turn into something that feels like a patchwork, so I'm going to be careful where I add to the syntax, but I still want to expand on the existing functionality.

I have to be careful because Cheffe has already created a meaning for the comma separation, and it's not for variable separation.  lol.  It's concatenation of all things.

9232
General Discussion / Re: Set multiple variables at once
« on: June 12, 2008, 07:30:41 PM »
Well not really.  If you look an many other languages (i.e. all) there's not really a way to initialize them unless you do it by hand.  There are compiler directives that allow you to assign a null value to the respective data type (kinda like what Hardyz suggests) but mostly all of them require you to do SOMETHING with the value.

For EasyUO, you can just have faith that math on a N/A value will default to zero, i.e. set %test %test + 1 = 1.  Otherwise, it gets kinda convoluted because of EasyUO's basic typeless structure.  I'm actually having to institute a way to differentiate that since I'm wanting to include decimal math, but you also have to be able to tell the difference between 0.0 (string) and 0.0 (float).

Right now I have a hirarchy of promotion/demotion from string->int->float, but I still need to allow for a way to let the user specify this.

9233
General Discussion / Re: Set multiple variables at once
« on: June 12, 2008, 04:08:47 PM »
Well because EUO doesn't have a real "value" for null since it deals with variable arguments mostly like strings unless math can be done.  At least with stronger typed languages, you can divine what the value should be, but you can't make the assumption with a language like EasyUO.  But if you can actually setup what you'd like "null" to be, then you get your <3 of nulls and you can talk about empty strings, zeros, N/A, etc.

Actually, if you try and do any math to a N/A, it's treated like a zero.  Also if the value that's found in a variable doesn't actually represent a number, then it's considered a zero or N/A.

Code: [Select]
set %test imanumber
set %test %test * 5 + 10
display ok %test

This will result in a 10 since the multiplication evaluates to zero.

9234
I didn't know about winuo.org until I just saw your post in another thread. I think I will take it there heh, but the offer is still open here. I love scripting, just more on the scripting for bugs side.

Oh, you'd love my orange cloth generator then. :)

9235
Off Topic / Dreadful new terrorist tactics....
« on: June 12, 2008, 01:14:47 PM »
Roadside bombs, suicide bombers, bombs strapped to women....

But this.............this is just plain wrong.


9236
General Discussion / Re: Set multiple variables at once
« on: June 12, 2008, 12:33:13 PM »
Am I the only one that wants/uses/does this?

Like, initializing variables to 0. I don't want to check for a variable by n/a. What if I ran the script, stopped it, and I'm running it again and it is holding a value? so, now I have 5 variables, I am setting to 0... I want to set them with 1 line of code, can SUO do that?

I've often wanted to do something exactly like that.  It really makes sense to initialize a variable to a number rather than some obscure reference that's not even a NaN or something more accepted like that.  Really, it would be pretty easy to add a system variable like #INITVAR which you can set that'll allow you set a variable initialization value. If you want to change to another block of initialization, you can just change the initializer.  I'll add that to the list of new features.

9237
Off Topic / Re: Bored at Work so thought i would post....
« on: June 12, 2008, 12:27:41 PM »
Heh, boredom sucks don't it.  Oh, thing that in a few more hours you'll be home and everything will be ok.  ;)

There aren't many members here either; but that's ok with me.

9238
Scripting Chat / Finally have some script explanations re-posted
« on: June 11, 2008, 11:32:35 PM »
Freddy graciously let me prowl through his thread vault over at WinUO.org and I was able to copy several of the script explanations from over there to add them to my scripts here.  So thanks to freddy for that!

TM

9239
Script Snippets / Context menu handler subs
« on: June 11, 2008, 10:57:41 PM »
Here's a set of subs I put together that will search the text of the context popup menu (exevent popup) and select the proper item.  I have searched the land to find most of the context menu entries, but I probably have forgotten a few, so if you find one, let me know and I'll add it to the master list.  This is independent of any OCR program out there, so you won't have any code dependencies.

Note:
You have to run SetupContextValues at the beginning of your scripts execution to setup all the %CONTEXT_XXX.. values.

Also, since this uses pixcol you must keep the screen clear of clutter, otherwise the script will claim it can't find the requested context line.

Here's a bit of test code:
Code: easyuo
  1. gosub SetupContextValues
  2. set #TARGCURS 1
  3. repeat
  4. until #TARGCURS = 0
  5. gosub HandleContextMenu NULL #LTARGETID %CONTEXT_Buy ; "Vender buy!"
  6.  

Also, this has been setup so you may call it as a separate subroutine:
Code: easyuo
  1. set %context_subs c:\context_subs.txt
  2.  
  3. call %context_subs SetupContextValues
  4. call %context_subs HandleContextMenu #CHARID %CONTEXT_Open_Paperdoll
  5.  

Here's the code you'll need to include in your script:

If you add it directly, then you don't need the "gosub %1" and "exit".  Those are there to allow these subs to be "call"ed.
Code: easyuo
  1. gosub %1
  2. exit
  3. ;-------------------------------------------------------------------------------
  4. sub SetupContextValues
  5. ; For #CHARID -------------------------------------------
  6.   set %CONTEXT_Open_Paperdoll 3156756
  7.   set %CONTEXT_Open_Backpack 3428334
  8.   set %CONTEXT_View_Quest_Log 3126406
  9.   set %CONTEXT_Quest_Conversation 3730488
  10.   set %CONTEXT_Cancel_Quest 1535584
  11.   set %CONTEXT_Toggle_Insurance 6427264
  12.   set %CONTEXT_Auto_Renew_Insurance 10565554
  13.   set %CONTEXT_Cancel_Renewing 8578676
  14.   set %CONTEXT_Toggle_Monster_Title_Display 6959492
  15.   set %CONTEXT_Toggle_Quest_Item 3603586
  16.   set %CONTEXT_Leave_House 2202616
  17.   set %CONTEXT_Totals 744812 ; alexandria
  18. ; -------------------------------------------------------
  19. ; Various commands:
  20.   set %CONTEXT_Buy 200250
  21.   set %CONTEXT_Sell 260988
  22.   set %CONTEXT_Open_Bankbox 2793788
  23.   set %CONTEXT_Talk 208296
  24.   set %CONTEXT_Stable_Pet 1059800
  25.   set %CONTEXT_Claim_All_Pets 3073470
  26.   set %CONTEXT_Ask_Destination 4153934
  27.   set %CONTEXT_Accept_Escort 2171844
  28.   set %CONTEXT_Command_Kill 3025036
  29.   set %CONTEXT_Command_Follow 2998872
  30.   set %CONTEXT_Command_Guard 3695576
  31.   set %CONTEXT_Command_Stop 3084560
  32.   set %CONTEXT_Command_Stay 3438018
  33.   set %CONTEXT_Add_Friend 1757318
  34.   set %CONTEXT_Remove_Friend 2870250
  35.   set %CONTEXT_Transfer 593758
  36.   set %CONTEXT_Release 753348
  37.   set %CONTEXT_Tame 2967380
  38.   set %CONTEXT_Hire 271802
  39.   set %CONTEXT_Lock_Karma 1628904
  40.   set %CONTEXT_Tithe_Gold 1504152
  41.   set %CONTEXT_Resurrect 1040922
  42.   set %CONTEXT_Add_To_Spellbook 4435612
  43.  
  44. ; -------------------------------------------------------
  45. ; Training commands:
  46.   set %CONTEXT_Train_Alchemy 2851050
  47.   set %CONTEXT_Train_Anatomy 2802984
  48.   set %CONTEXT_Train_Animal_Taming 4605822
  49.   set %CONTEXT_Train_Animal_Lore 3779370
  50.   set %CONTEXT_Train_Archery 2127964
  51.   set %CONTEXT_Train_Arms_Lore 2746638
  52.   set %CONTEXT_Train_Blacksmithy 5406112
  53.   set %CONTEXT_Train_Bowcraft_Fletching 9229098
  54.   set %CONTEXT_Train_Camping 3103050
  55.   set %CONTEXT_Train_Carpentry 3895634
  56.   set %CONTEXT_Train_Cartography 4174618
  57.   set %CONTEXT_Train_Chivalry 3031212
  58.   set %CONTEXT_Train_Cooking 2505550
  59.   set %CONTEXT_Train_Discordance 4510014
  60.   set %CONTEXT_Train_Evaluating_Intelligence 10255594
  61.   set %CONTEXT_Train_Fencing 2057938
  62.   set %CONTEXT_Train_Fishing 2129530
  63.   set %CONTEXT_Train_Focus 1736784
  64.   set %CONTEXT_Train_Forensic_Evaluation 9881992
  65.   set %CONTEXT_Train_Healing 2330106
  66.   set %CONTEXT_Train_Inscription 2652544
  67.   set %CONTEXT_Train_Item_Identification 10238832
  68.   set %CONTEXT_Train_Lockpicking 3681790
  69.   set %CONTEXT_Train_Lumberjacking 6315420
  70.   set %CONTEXT_Train_Mace_Fighting 5961428
  71.   set %CONTEXT_Train_Magery 2466304
  72.   set %CONTEXT_Train_Meditation 3901812
  73.   set %CONTEXT_Train_Mining 2019092
  74.   set %CONTEXT_Train_Musicianship 4167920
  75.   set %CONTEXT_Train_Necromancy 4205298
  76.   set %CONTEXT_Train_Parry 3108898
  77.   set %CONTEXT_Train_Peacemaking 4680400
  78.   set %CONTEXT_Train_Provocation 3850930
  79.   set %CONTEXT_Train_Resisting_Spells 6022522
  80.   set %CONTEXT_Train_Spirit_Speak 4945928
  81.   set %CONTEXT_Train_Swordsmanship 5601890
  82.   set %CONTEXT_Train_Tactics 1806400
  83.   set %CONTEXT_Train_Tailoring 2867278
  84.   set %CONTEXT_Train_Taste_Evaluation 6613220
  85.   set %CONTEXT_Train_Tinkering 2863750
  86.   set %CONTEXT_Train_Tracking 2572028
  87.   set %CONTEXT_Train_Veterinary 2777822
  88.   set %CONTEXT_Train_Wrestling 2967380
  89. return
  90. ;-------------------------------------------------------------------------------
  91. ; %1 = HandleContextMenu
  92. ; %2 = #FINDID to manipulate
  93. ; %3 = menu selection
  94. ; returns #TRUE if entry not found, otherwise #FALSE for no error
  95. ; stores computed values in !test1, !test2, !test3, etc for each menu selection.
  96. sub HandleContextMenu
  97.   namespace push
  98.   namespace local HCM
  99.   set !findid %2
  100.   set !menu_selection %3
  101.   set !x_offset 12
  102.   set !y_offset 12
  103.   set !select_height 18
  104.   set !y_gump_excess 24
  105.  
  106.   exevent popup !findid
  107.   gosub GumpWait NULL normal_gump normal_gump
  108.   set #CONTPOSX 25
  109.   set #CONTPOSY 25
  110.   wait 10
  111.   str pos #CONTSIZE _
  112.   str del #CONTSIZE 1 #STRRES
  113.  
  114.   set !gump_y #STRRES
  115.   set !number_of_selections ( ( !gump_y - !y_gump_excess ) / !select_height )
  116.   for !line_number 1 !number_of_selections
  117.   {
  118.     set !clickxposition1 #CONTPOSX + !x_offset
  119.     set !clickyposition1 #CONTPOSY + !y_offset + ( !select_height * ( !line_number - 1 ) )
  120.     set !clickxposition2 !clickxposition1 + 150
  121.     set !clickyposition2 !clickyposition1 + !select_height - 1
  122.     gosub NewSampleArea NULL !clickxposition1 !clickyposition1 !clickxposition2 !clickyposition2
  123.     set !test . !line_number #RESULT  ; stores values in !test1, !test2, .. !test . n.  Put in debug mode to gather these sampled values
  124. ;    pause  ; include this pause to view sampled values.
  125.     if #RESULT = !menu_selection
  126.     {
  127.       click !clickxposition1 !clickyposition1 mc
  128.       namespace pop
  129.       return #FALSE ; no error, selection found
  130.     }
  131.   }
  132. ;  pause
  133.   namespace clear
  134.   namespace pop
  135. return #TRUE
  136. ;-------------------------------------------------------------------------------
  137. ; %1 = NewSampleArea
  138. ; %2 = x1coord
  139. ; %3 = y1coord
  140. ; %4 = x2coord
  141. ; %5 = y2coord
  142. ; %6 = return stamp
  143. sub NewSampleArea
  144.   namespace push
  145.   namespace local NSA2
  146.   set !temp_LPC #LPC
  147.   set #LPC 10000
  148.   set !stamp 0
  149.   set !x %2
  150.   set !blank_cnt 0
  151.   while !x <= %4
  152.   {
  153.     set !y %3
  154.     while !y <= %5
  155.     {
  156.       savepix !x !y 1
  157.       if #PIXCOL = 16777215
  158.       {
  159.         set !stamp ( !stamp + ( !x - %2 + 1 ) * 2048 + ( !y - %3 + 1 ) * 128 )
  160.         set !blank_cnt 0
  161.       }
  162.       else
  163.       {
  164.         set !stamp ( !stamp + ( !x - %2 ) * ( !y - %3 ) )
  165.       }
  166.       set !y !y + 2
  167.     }
  168.     set !blank_cnt !blank_cnt + 1
  169.     if !blank_cnt >= 10
  170.       goto NewSampleArea_skip1
  171.     set !x !x + 5 ; changing this will impact present sampled values!!
  172.   }
  173. NewSampleArea_skip1:
  174.   set #LPC !temp_LPC
  175.   set #RESULT !stamp
  176.   namespace pop
  177. return #RESULT
  178. ;-------------------------------------------------------------------------------
  179. ; %1 = GumpWait
  180. ; %2 = Gumpname 1
  181. ; %3 = Gumpname 2
  182. sub GumpWait
  183.   wait 10
  184.   set %timedelay #SCNT
  185.   GumpWait_loop1:
  186.     if #CONTNAME = %2 || #CONTNAME = %3
  187.       return
  188.     if #SCNT > %timedelay + 7
  189.       return
  190.     goto GumpWait_loop1
  191. return

This should work on both OSI and RunUO

9240
Bug discussion / Re: Unhandled Exception
« on: June 11, 2008, 09:55:54 PM »
Hey no problem at all, I figured my career-related expertise could come in handy for something really important :p

TBH, I'm psyched to be part of this project so I'm happy to break it and tell you how I did it whenever I can, hehe.

Well I'm happy to have ya'll playing with it.  It's been fun for me to write and a very therapeutic diversion from all the daily crap.  heh

Pages: 1 ... 614 615 [616] 617 618 ... 622