Author Topic: Why the *bleep* isn't this working...  (Read 8316 times)

0 Members and 1 Guest are viewing this topic.

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13303
  • Activity:
    0.4%
  • 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: Why the *bleep* isn't this working...
« Reply #15 on: December 25, 2010, 12:06:15 AM »
0
... I win. :)

Says the lemming to the other lemming just before plummeting to the rocky surf below.  lol.

(going to be a lonely script until I LEARN HOW TO DO ARRAYS)

Would you hurry up and learn those things already...  hehehe

Good to use both the #findcnt and #findkind.  That'll really melt their butter!
« Last Edit: December 25, 2010, 12:10:55 AM by TrailMyx »
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13303
  • Activity:
    0.4%
  • 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: Why the *bleep* isn't this working...
« Reply #16 on: December 25, 2010, 12:43:35 AM »
0
Hey, NB.  Here's a little explanation I whipped up for someone we all know and adore here at SUO a while back that wasn't shared publically that explains arrays a bit.  Hopefully it'll give you a little context since I compare a classical programming language with how to do the same thing in EUO.

-----------------------------------------------------------------------------

OK, well if you'd like to think about arrays here's something to think about.

First of all, perhaps a little bit about what arrays are.

Classically, arrays are a method of storing information so that the information can be addressed by indexing it.  So for example (psudocode):

Code: [Select]
set Members[0] = "TrailMyx";
set Members[1] = "Cerveza";
set Members[2] = "Khameleon";
set Members[3] = "12X";

So after this, you could address all the members names by using an index within the array such as:

Code: [Select]
for (int i=0; i<=3; i++)
{
  print("The member name is ",Members[i]);
}

But sometimes it's nice to be able to hold specific information about each member, and still be able to index it.  Again classically, you might think about 2-dimensional arrays, or:

Code: [Select]
set Members[0][0] = "TrailMyx";
set Members[0][1] = "San Diego";
set Members[0][2] = "41";
set Members[1][0] = "Cerveza";
set Members[1][1] = "Back East";
set Members[1][2] = "Unk";

for (int i=0; i<=1; i++)
{
  print("Member ",Members[i][0]," lives in ",Members[i][1], " and is ", Members[i][2], " years old."
}

However, you see how numerical indicies are not very descriptive.  But this is the gist of arrays. You can have 1D, 2D, 3D, nD arrays.  It really just depends on how you want to store your information.

So when people talk about "arrays" in EUO, they automatically CAN'T talk about arrays in the classical sense because there is no language construct for it.  However, by using creative use of the concatenation, and even more creative use of namespaces, you can form a data structure that functions EXACTLY the same as an array.

From the first example (now in EUO)

Code: [Select]
set %Members_0 TrailMyx
set %Members_1 Cerveza
set %Members_2 Khameleon
set %Members_3 12X
for %i 0 3
{
  display The member name is , #SPC ,  %Members_ . %i
}
stop

And the second example in EUO is:

Code: [Select]
set %Members_0_0 TrailMyx
set %Members_0_1 San , #SPC , Diego
set %Members_0_2 41
set %Members_1_0 Cerveza
set %Members_1_1 Back , #SPC , East
set %Members_1_2 Unk
for %i 0 1
{
  set %member_index Members_ , %i , _
  set %name %member_index , 0 ; compute the variable name, I.E.  Members_0_0
  set %location %member_index , 1  ; compute the variable name, I.E.  Members_0_1
  set %age %member_index , 2 ; compute the variable name, I.E.  Members_0_2
  set %name % . %name ; now get the value at %Members_0_0
  set %location % . %location ; now get the value at %Members_0_1
  set %age % . %age ; now get the value at %Members_0_2
  display ok Member , #SPC , %name , #SPC , lives , #SPC , in , #SPC , %location , #SPC , and , #SPC , is , #SPC , %age
}

stop

If you'd like to see how to do this with namespaces and so that it makes more sense, lemme know.  I'll save the namespaces for another day.
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline NObamaTopic starter

  • Everything I need to know, I learned from Miffy's Item Finder.
  • Elite
  • *
  • *
  • Posts: 3454
  • Activity:
    0%
  • Reputation Power: 43
  • NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.
  • Respect: +161
  • Referrals: 2
    • View Profile
Re: Why the *bleep* isn't this working...
« Reply #17 on: January 14, 2011, 08:58:59 PM »
0
 :D  :D  :D  :D  :D  :D  :D

I get it.  AT LAST.

 8)

Offline dxrom

  • Master of the milestones!
  • Elite
  • *
  • *
  • Posts: 1080
  • Activity:
    0%
  • Reputation Power: 15
  • dxrom is working their way up.dxrom is working their way up.dxrom is working their way up.
  • KEYBOARD COWBOY, GREAT SAMURAI OF THE INTERNET.
  • Respect: +100
  • Referrals: 1
    • View Profile
Re: Why the *bleep* isn't this working...
« Reply #18 on: January 15, 2011, 12:10:54 PM »
0
if the container is not preopened... it will tell you no deeds becasue u never last object it t open it

Give the man a prize.  Thanks C2.

xD
C2 beat me too it!

It's an annoying thing, but the bag needs to be open for the script to read anything in it, or maybe even RE-opened. I just know I get a bug when trying to chug pots sometimes where I  need to reopen my bag in order for razor to register that I have potions.



 ​_██​_
(ಠ​_ృ)
I do say, ol' Chap! Come play EVE Online! Why here is a 21 Day Free Trial!

Offline dxrom

  • Master of the milestones!
  • Elite
  • *
  • *
  • Posts: 1080
  • Activity:
    0%
  • Reputation Power: 15
  • dxrom is working their way up.dxrom is working their way up.dxrom is working their way up.
  • KEYBOARD COWBOY, GREAT SAMURAI OF THE INTERNET.
  • Respect: +100
  • Referrals: 1
    • View Profile
Re: Why the *bleep* isn't this working...
« Reply #19 on: January 15, 2011, 12:19:46 PM »
0
if the container is not preopened... it will tell you no deeds becasue u never last object it t open it

Give the man a prize.  Thanks C2.

xD
C2 beat me too it!

It's an annoying thing, but the bag needs to be open for the script to read anything in it, or maybe even RE-opened. I just know I get a bug when trying to chug pots sometimes where I  need to reopen my bag in order for razor to register that I have potions.

Actually this might be a VERY late reply >_>
Sorry just woke up xD

@TM: Arrays are so confusing, however I am in love with for loops, and how the can be used to step through arrays. :D



 ​_██​_
(ಠ​_ృ)
I do say, ol' Chap! Come play EVE Online! Why here is a 21 Day Free Trial!

Scrripty

  • Guest
Re: Why the *bleep* isn't this working...
« Reply #20 on: January 15, 2011, 02:36:43 PM »
0
If you guys would like to see a great easy example, look at my pseudo ignore script.  For loops and simple arrays made easy. :)

Tags: