Author Topic: Repeat Until While  (Read 12051 times)

0 Members and 1 Guest are viewing this topic.

Offline camotbik

  • Sr. Member
  • *
  • Posts: 349
  • Activity:
    0%
  • Reputation Power: 3
  • camotbik has no influence.
  • Gender: Male
  • Hello! I'm a UO addict.
  • Respect: +38
  • Referrals: 0
    • View Profile
Re: Repeat Until While
« Reply #15 on: September 20, 2011, 10:09:42 PM »
0
huh, I didn't know it's user editable. Sorry for misleading.

They are not Required on For loops of more than one line of code

Is that a typo?
« Last Edit: September 21, 2011, 12:03:19 AM by camotbik »
What you witness -- is whatver..
uogamers hybrid.

Offline CervezaTopic starter

  • Hacksimus Maximus
  • Scripthack
  • *
  • Posts: 5857
  • Activity:
    0%
  • Reputation Power: 80
  • Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!
  • Gender: Male
  • So... Hows that Hopey-Changey thing working out?
  • Respect: +403
  • Referrals: 11
    • View Profile
Re: Repeat Until While
« Reply #16 on: September 21, 2011, 03:05:30 AM »
0
repeat
will repeat
anything in between
itself and the
very next instance
of the command
until

You do not need {} for them.

while
only does one line

So if you want more then one line for a while you need {}

while
{
does the next line
ONLY
so you
need to use
brackets
}

For loops need {}

This is for EUO, I have no idea about OEUO
XXXXXXXXXX________________________________________] 20%
I've forgotten more about this game then most people will ever know.
Thank you for controlling your children. Their manners reflect your love for them.
Give a man a fish and you feed him for a day. Don't teach a man to fish, and you feed yourself. He's a grown man. Fishing's not that hard.

Offline Endless Night

  • Global Moderator
  • *
  • *
  • Posts: 5467
  • Activity:
    0%
  • Reputation Power: 62
  • Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!
  • Respect: +393
  • Referrals: 1
    • View Profile
Re: Repeat Until While
« Reply #17 on: September 21, 2011, 04:23:31 AM »
0
huh, I didn't know it's user editable. Sorry for misleading.

They are not Required on For loops of more than one line of code

Is that a typo?

guilty of excessive cutting and pasting as charged..  correct typo

For loops require {}
Outlaw Josey Wales - "Manwink, A Long Gone Scripty, and Endless are always teasing us with their private sections lol. What there realy saying is scripters rule and users drool."
Briza - "Your a living breathing vortex of usefulness."

Offline 12TimesOver

  • Another Day, Another Vendetta
  • Global Moderator
  • *
  • *
  • Posts: 3694
  • Activity:
    0%
  • Reputation Power: 41
  • 12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.
  • Gender: Male
  • Respect: +321
  • Referrals: 2
    • View Profile
Re: Repeat Until While
« Reply #18 on: September 21, 2011, 05:24:43 AM »
0
I just wanted to add, that at multiple lines you have to use brackets inside repeat/until circle.
Code: [Select]
Synopsis : repeat { } until ( expression )
http://wiki.easyuo.com/index.php?title=Repeat..until
Nope, no brackets needed for Repeat/Until.

And Cerv's examples are correct. There is no need to check the mana before the loop, this is the inherent difference between repeat and while. Repeat ALWAYS executes the code the first time, While only executes code if the criteria is met first.

X

<edit> whoops, I see my reply is now redundant. I'll leave it anyhow, now we have quorum ;)
« Last Edit: September 21, 2011, 05:34:33 AM by 12TimesOver »
When they come for me I'll be sitting at my desk
     with a gun in my hand wearing a bulletproof vest
My, my, my how the time does fly
     when you know you're gonna die by the end of the night

Offline UOMaddog

  • Maddog
  • Elite
  • *
  • *
  • Posts: 1625
  • Activity:
    0%
  • Reputation Power: 22
  • UOMaddog might someday be someone...UOMaddog might someday be someone...UOMaddog might someday be someone...UOMaddog might someday be someone...
  • Gender: Male
  • Biggest B@D@$$ of the Universe
  • Respect: +165
  • Referrals: 8
    • View Profile
    • Insane UO
Re: Repeat Until While
« Reply #19 on: September 21, 2011, 12:47:18 PM »
0
@12X: The reason I said it was a flaw is because most of the times when you want to do something that requires mana, you should CHECK FIRST, so in those cases, WHILE would be a better choice than REPEAT/UNTIL. I'm not saying it wasn't behaving properly, just that it's not an ideal choice if that circumstance
There are 10 kinds of people in this world: those that understand binary and those that don't!

Windows:  A 64-bit tweak of a 32-bit extension to a 16-bit user interface for an 8-bit operating system based on a 4-bit architecture from a 2-bit company that can't stand 1 bit of competition!

Offline 12TimesOver

  • Another Day, Another Vendetta
  • Global Moderator
  • *
  • *
  • Posts: 3694
  • Activity:
    0%
  • Reputation Power: 41
  • 12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.
  • Gender: Male
  • Respect: +321
  • Referrals: 2
    • View Profile
Re: Repeat Until While
« Reply #20 on: September 21, 2011, 02:14:33 PM »
0
@12X: The reason I said it was a flaw is because most of the times when you want to do something that requires mana, you should CHECK FIRST, so in those cases, WHILE would be a better choice than REPEAT/UNTIL. I'm not saying it wasn't behaving properly, just that it's not an ideal choice if that circumstance
Ok, well I would agree that the example might not be the best as for game mechanics (and after re-reading the thread I see that that was your point) but it was syntactically accurate which was the point anyhow. Sounds like we both agree in either case.

;)

X
When they come for me I'll be sitting at my desk
     with a gun in my hand wearing a bulletproof vest
My, my, my how the time does fly
     when you know you're gonna die by the end of the night

Offline UOMaddog

  • Maddog
  • Elite
  • *
  • *
  • Posts: 1625
  • Activity:
    0%
  • Reputation Power: 22
  • UOMaddog might someday be someone...UOMaddog might someday be someone...UOMaddog might someday be someone...UOMaddog might someday be someone...
  • Gender: Male
  • Biggest B@D@$$ of the Universe
  • Respect: +165
  • Referrals: 8
    • View Profile
    • Insane UO
Re: Repeat Until While
« Reply #21 on: September 21, 2011, 03:31:06 PM »
0
Now if only we were in Congress! We could agree AND get things done!
There are 10 kinds of people in this world: those that understand binary and those that don't!

Windows:  A 64-bit tweak of a 32-bit extension to a 16-bit user interface for an 8-bit operating system based on a 4-bit architecture from a 2-bit company that can't stand 1 bit of competition!

Offline slyone

  • Full Member
  • ***
  • Posts: 135
  • Activity:
    0%
  • Reputation Power: 2
  • slyone has no influence.
  • Gender: Male
  • Respect: +40
  • Referrals: 1
    • View Profile
Re: Repeat Until While
« Reply #22 on: September 21, 2011, 04:47:49 PM »
0
Whats the open EUO equivalent of these statements?

Lua is pretty similar in structure.  Check out these links from the online manual...

repeat-until:
http://www.lua.org/pil/4.3.3.html

while:
http://www.lua.org/pil/4.3.2.html

for:
http://www.lua.org/pil/4.3.4.html

I started programming in C.  Half of the time I forget the "do" in the while, for and if statements in Lua...
Started playing back at the Second Age

Offline mmoore5325

  • Newbie
  • *
  • Posts: 6
  • Activity:
    0%
  • Reputation Power: 1
  • mmoore5325 has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Re: Repeat Until While
« Reply #23 on: October 14, 2014, 10:55:59 PM »
0
I've seen people put <> in their statements, I was just curious what they do.
When I use #targcurs
set #targcurs = 1
while #targcurs = 1
wait 2
set %bag #lobjectid
set #lobjectid #ltargetid
event macro 17
Thats actually almost all the code I am familiar with
But I was just curious.
Cervesas beer <> 0
and I thought I saw someone put
while #targcurs <> 1 or something close to it
If Cervesas beer < 0, OMG NO!
if it is > 0, GREAT!
But if its <> 0, I take it as maybe I'm drinking, maybe i'm not.  Please help me understand.

Offline TrailMyx

  • 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: Repeat Until While
« Reply #24 on: October 14, 2014, 11:07:58 PM »
0
The <> operator simply means "not equal".  Other languages use "!=" for the same purpose.
Please read the ScriptUO site RULES
Come play RIFT with me!

Tags: