Author Topic: My first Script, looking to pick your brains.  (Read 10375 times)

0 Members and 1 Guest are viewing this topic.

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13304
  • Activity:
    0.6%
  • 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: My first Script, looking to pick your brains.
« Reply #30 on: August 17, 2009, 06:32:39 PM »
0
That's ok.  I can make my karma whatever I want.  :) 
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline seeriuslyTopic starter

  • Full Member
  • ***
  • Posts: 219
  • Activity:
    0%
  • Reputation Power: 6
  • seeriusly has no influence.
  • Gender: Male
  • Respect: +40
  • Referrals: 0
    • View Profile
Re: My first Script, looking to pick your brains.
« Reply #31 on: August 17, 2009, 06:55:18 PM »
0
LOL...  I know. :)

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: My first Script, looking to pick your brains.
« Reply #32 on: August 17, 2009, 08:18:24 PM »
0
repeat
  blabla code
until #True

Would mean that you dont need the repeat as it would only ever ever ever run once so is the same as

blabla code

~~~~~~~~~

What you should do is something like this

Code: [Select]
Set %ExitScript NO
Repeat
    ; Scan the journal for a exit keyword
    ; such as   "bigJobs"
    ; If you find bigjobs in the journal set %exitScript YES
    ; ..
    ; All the code Between the repeat and until .. will keep looping until %exitscript = YES
Until %ExitScript = YES
Halt ; The script is over stop running.
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."

Scrripty

  • Guest
Re: My first Script, looking to pick your brains.
« Reply #33 on: August 17, 2009, 10:35:48 PM »
0
Or for the total noob.
Code: [Select]
start:

script

if #conditiontoexit = #true
   goto end

goto start

end:
halt

That will loop over and over also. :)  Just sayin... :)

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: My first Script, looking to pick your brains.
« Reply #34 on: August 18, 2009, 07:17:11 AM »
0
yes script you could do that but personally i find that harder to read, and debug especially once your scripts start getting larger and larger.  If you can manage the logic of a repeat until loop you will be better off in the long run.  I have scripts 10k lines long without a single GOTO statment.

In fact   Until <Condition>   is basically codewise equialent of
   If NOT <condition>   goto <tag>    And Repeat is eqvialent to <Tag>

Its hard to do something like this with ifs.. and gotos..  , hard to read hard to debug

Code: [Select]
Repeat
   bla bla
   Repeat
      blba bla bal
      Repeat
          bla bla bla
      Until !ExitScript || InnerLoopCondition
   Until !ExitScript  || OtherCondition
Until !ExitScript
Halt


All that said you make your own bed and u lie in it. LOL take it from me thow trashing the gotos will save you tons of headaches.

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

Scrripty

  • Guest
Re: My first Script, looking to pick your brains.
« Reply #35 on: August 18, 2009, 11:37:56 AM »
0
All that said you make your own bed and u lie in it. LOL take it from me thow trashing the gotos will save you tons of headaches.

I never use gotos.  But when you're new, they are easy to understand. :)

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: My first Script, looking to pick your brains.
« Reply #36 on: August 18, 2009, 04:07:11 PM »
0
I havent been new to coding in sooooo long i've kinda forgotten what the umm initial viewpoint is  :o
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 seeriuslyTopic starter

  • Full Member
  • ***
  • Posts: 219
  • Activity:
    0%
  • Reputation Power: 6
  • seeriusly has no influence.
  • Gender: Male
  • Respect: +40
  • Referrals: 0
    • View Profile
Re: My first Script, looking to pick your brains.
« Reply #37 on: August 18, 2009, 06:21:29 PM »
0
*rummages through script*  mmm... I got a bunch of goto statements...  :-[ I guess cause they are easy like you said.

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13304
  • Activity:
    0.6%
  • 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: My first Script, looking to pick your brains.
« Reply #38 on: August 18, 2009, 06:26:37 PM »
0
*rummages through script*  mmm... I got a bunch of goto statements...  :-[ I guess cause they are easy like you said.

Don't worry about them too much.  If it works for you, then just use'em.  :)  I still do if they make sense for the task at hand.
Please read the ScriptUO site RULES
Come play RIFT with me!

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: My first Script, looking to pick your brains.
« Reply #39 on: August 18, 2009, 07:35:20 PM »
0
dont worry about it seeriusly  .. just keep that script moving forward what ever way you can.

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: