Author Topic: I don't understand.  (Read 5106 times)

0 Members and 1 Guest are viewing this topic.

Offline manwincTopic starter

  • Elite
  • *
  • *
  • Posts: 2556
  • Activity:
    0%
  • Reputation Power: 32
  • manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!
  • Gender: Male
  • "The Devs Hard at Work"
  • Respect: +272
  • Referrals: 1
    • View Profile
I don't understand.
« on: August 14, 2009, 09:09:37 PM »
0
I see alot of These kind of IF statements in Peoples Scripts


if %SOMETHING
{



}


I don't understand..... TO me its like a joke without a punchline... I don't understand what its function is or where you would actually use it? Without a mathematical comparison.... an IF just seems like a Wire Coat Hanger Unwinder... (Who would Actually use it?)
Monkeys and Typewriters!

" Oh I know, We'll make a Boss Encounter that requires 3 keys per player to enter, Then we'll make it not a closed instance so you never know if you are going to pop into a fresh room or a boss that has 1% Health left with 20 dudes smashing its face in, wasting your time and effort"

Offline rana70

  • Elite
  • *
  • *
  • Posts: 294
  • Activity:
    0%
  • Reputation Power: 5
  • rana70 has no influence.
  • Gender: Male
  • Respect: +75
  • Referrals: 2
    • View Profile
    • MyScripts
Re: I don't understand.
« Reply #1 on: August 14, 2009, 09:18:09 PM »
0
Hi,

it is just a possible way to to do something if a var is  #true.
Maybe this will explain it:
Code: [Select]
Set %Something #True

if %Something
{
Display OK Something is true
}

Set %Something #false

if %Something
{
Display OK This will never be displayed
}

halt

Offline manwincTopic starter

  • Elite
  • *
  • *
  • Posts: 2556
  • Activity:
    0%
  • Reputation Power: 32
  • manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!
  • Gender: Male
  • "The Devs Hard at Work"
  • Respect: +272
  • Referrals: 1
    • View Profile
Re: I don't understand.
« Reply #2 on: August 14, 2009, 09:25:57 PM »
0
So, its shorthand for

If %Something = #true


Wow, that is worthless to me......
Monkeys and Typewriters!

" Oh I know, We'll make a Boss Encounter that requires 3 keys per player to enter, Then we'll make it not a closed instance so you never know if you are going to pop into a fresh room or a boss that has 1% Health left with 20 dudes smashing its face in, wasting your time and effort"

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: +600
  • Referrals: 2
    • View Profile
Re: I don't understand.
« Reply #3 on: August 15, 2009, 05:04:53 AM »
0
So, its shorthand for

If %Something = #true


Wow, that is worthless to me......

Manwinc, detail? Being one who appreciates your coding abilities I'd be curious what you're getting at. I'm reading this thread like you feel about IF statements as Cerv feels about Goto statements. Do you not use If? Do you not like If without Else? I'm confused. I use statements such as this a lot - get a value, load a variable with the value, If the variable = value perform action, otherwise don't perform the action. Is this not good code?

How else would you approach this type of logic?

XII
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 manwincTopic starter

  • Elite
  • *
  • *
  • Posts: 2556
  • Activity:
    0%
  • Reputation Power: 32
  • manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!
  • Gender: Male
  • "The Devs Hard at Work"
  • Respect: +272
  • Referrals: 1
    • View Profile
Re: I don't understand.
« Reply #4 on: August 15, 2009, 09:57:50 AM »
0
oh no, Programming without If Statements would be Impossible in My Opinion.

I just think that

if %something
{
Do this
Do that
}

Seems Silly. It should have an = . I know now that when you perform an if Statement without an = It checks to see if its Equal To #True (or -1), but that just seems like something Silly to add to the program itself (easyuo).

Now, I have never taken a programming class, or learned any code other than easyuo( think its called Delphi) , so i'm sure that there are other Programming Languages and environments that use it, but I Wouldn't of Guessed that that's what it does in a Million years.

Heh Heh, and I'm all For Goto's......  ;D Trying to Break Away, But like I just said all my programming experience has been with easyuo so I didn't find out about the "hate" for goto's until about 6 months ago. No More Spaghetti Code For me!
Monkeys and Typewriters!

" Oh I know, We'll make a Boss Encounter that requires 3 keys per player to enter, Then we'll make it not a closed instance so you never know if you are going to pop into a fresh room or a boss that has 1% Health left with 20 dudes smashing its face in, wasting your time and effort"

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: +600
  • Referrals: 2
    • View Profile
Re: I don't understand.
« Reply #5 on: August 15, 2009, 05:01:48 PM »
0
Gotcha.

Yes, there are plenty of other languages that use the "IF Something" and "If Not Something" syntax so I guess it never really bugged me. ;)

XII
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 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: +786
  • Referrals: 1
    • View Profile
Re: I don't understand.
« Reply #6 on: August 15, 2009, 07:13:16 PM »
0
To correct something thier ... Easyuo script is not Called Delphi.  The Easyuo program itself was written in a programming language Called Delphi .. which in turn is a version of Pascal.  EasyUo Script is just that EasyUo script.

All conditional statments of any kind break down to  #TRUE or #FALSE .. if an = , <> , ! or other operative exists in the condition then the condition must be evaluated first is all.

Repeat Until <Condition>
If <Condition>
While <condition> Do

In other languges thiers more case <Condition>
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 manwincTopic starter

  • Elite
  • *
  • *
  • Posts: 2556
  • Activity:
    0%
  • Reputation Power: 32
  • manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!
  • Gender: Male
  • "The Devs Hard at Work"
  • Respect: +272
  • Referrals: 1
    • View Profile
Re: I don't understand.
« Reply #7 on: August 15, 2009, 08:27:17 PM »
0
Like I said 0 % Programming Experience.
Monkeys and Typewriters!

" Oh I know, We'll make a Boss Encounter that requires 3 keys per player to enter, Then we'll make it not a closed instance so you never know if you are going to pop into a fresh room or a boss that has 1% Health left with 20 dudes smashing its face in, wasting your time and effort"

Scrripty

  • Guest
Re: I don't understand.
« Reply #8 on: August 15, 2009, 09:35:53 PM »
0
Like I said 0 % Programming Experience.

You don't like this? :)

Code: [Select]
  sub ls
    menu get 13 ;Lightning Strike;Primary:Secondary
    if #menures = #true
    {
      menu get 14 ; WS Mana Check
      if #menures = #true
      {
        menu get specials
        if #menures = 1
        {
          if #mana > ( #maxmana * !LSManaPercentage ) / 10
            gosub lsSpecial
          return
        }
        menu get specials
        if #menures = 2
        {
          if #mana > ( #maxmana * !LSManaPercentage ) / 10 && #mana >= !PrimaryMana
            gosub execPrimary
          return
        }
        menu get specials
        if #menures = 3
        {
          if #mana > ( #maxmana * !LSManaPercentage ) / 10 && #mana >= !SecondaryMana
            gosub execSecondary
          return
        }
      }
      menu get specials
      if #menures = 1
      {
        gosub lsSpecial
        return
      }
     
      if #mana >= !PrimaryMana
      {
        menu get specials
        if #menures = 2
        {
          gosub execPrimary
          return
        }
      }
     
      if #mana >= !SecondaryMana
      {
        menu get specials
        if #menures = 3
        {
          gosub execSecondary
          return
        }
      }
    }
  return

Offline rana70

  • Elite
  • *
  • *
  • Posts: 294
  • Activity:
    0%
  • Reputation Power: 5
  • rana70 has no influence.
  • Gender: Male
  • Respect: +75
  • Referrals: 2
    • View Profile
    • MyScripts
Re: I don't understand.
« Reply #9 on: August 15, 2009, 10:46:57 PM »
0
He guys,

I think this point is done ...
 
The only problem he asked for help was using if's without any < , > , or =.

There is  one case when you test something for #TRUE, so that's it.

He prefers to write it out in full ... so it is OK for me !

I know people who dislike
-if you don't use brakets for Reperat Until's :-)
-some others dislike goto's

As long as it works .. it is ok for me :-)

A good day for all of you !
cu
« Last Edit: August 15, 2009, 10:49:32 PM by rana70 »

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13310
  • 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: +3089
  • Referrals: 34
    • View Profile
    • ScriptUO
Re: I don't understand.
« Reply #10 on: August 15, 2009, 11:25:43 PM »
0
I agree with Rana; if it works and you understand WHY it works, then why not?  The trick is just making sure you understand the WHY.

There's been a few times I've looked back at my earlier scripts and thought, "now why in the heck did I do it like that?"  But hey, it works so I just don't feel like re-doing it correctly. 
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline manwincTopic starter

  • Elite
  • *
  • *
  • Posts: 2556
  • Activity:
    0%
  • Reputation Power: 32
  • manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!
  • Gender: Male
  • "The Devs Hard at Work"
  • Respect: +272
  • Referrals: 1
    • View Profile
Re: I don't understand.
« Reply #11 on: August 16, 2009, 05:29:18 AM »
0
Yeah, thats all I was really looking for was people use if statements without = < > in them and what it actually does.

Quote
here's been a few times I've looked back at my earlier scripts and thought, "now why in the heck did I do it like that?"  But hey, it works so I just don't feel like re-doing it correctly.

I completely Agree TM, that's the point I'm at with my miner. In my opinion my script is a load of crap that needs to be De-gutted and reworked completely, but that's 1700 Lines of code to go back through and modify to make it more..... "Logical and up to date" with my scripting method now. Way too much hassle for something I don't Even Use.
Monkeys and Typewriters!

" Oh I know, We'll make a Boss Encounter that requires 3 keys per player to enter, Then we'll make it not a closed instance so you never know if you are going to pop into a fresh room or a boss that has 1% Health left with 20 dudes smashing its face in, wasting your time and effort"

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: +786
  • Referrals: 1
    • View Profile
Re: I don't understand.
« Reply #12 on: August 16, 2009, 06:30:24 AM »
0
I hear you thier... I look at some of my old scripts .. and embarrassment is not the words... and ill probably feel the same about my current scripts in 4 years from now presuming UO and EUO is still alive then.

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."

Tags: