Author Topic: Can a scirpt have this basic type of setup....  (Read 1778 times)

0 Members and 1 Guest are viewing this topic.

Offline CoraginTopic starter

  • Wacko in Pajama's
  • Elite
  • *
  • *
  • Posts: 1641
  • Activity:
    0%
  • Reputation Power: 23
  • Coragin might someday be someone...Coragin might someday be someone...Coragin might someday be someone...Coragin might someday be someone...
  • Gender: Male
  • It Is What It Is.
  • Respect: +57
  • Referrals: 1
    • View Profile
Can a scirpt have this basic type of setup....
« on: May 28, 2009, 05:58:33 AM »
0
I didnt search, because I am SURE no one has ever asked this before, unless they wrote scripts for macroquest 2.

But can I set up my script to work like this....
(code snips taken from TM's how-to step one thread.
Code: [Select]

;Header
;==================================

set %var1 500
set %books 3
gosub setup
gosub main

Sub main
mainloop:
;all the crap the script does here
GoTo mainloop

Sub setup
;all setup commands here
return

This is very similar to MQ2, except most commands use the "/" switch, in MQ2 it would look like this...

Code: [Select]


|Header
|==================================

/set %var1 500
/set %books 3
/call setup
/call main

Sub main
:mainloop
|all the crap the script does here
/goto :mainloop

Sub setup
;all setup commands here
/return

As you can see, it is mostly the same, | used instead of ; and / use with goto and return and : used at the beginning of the command instead of the end.  But for the most part, it is exactly the same and if commands always started with the / switch.

But back to my main question, can the first code I wrote be used?  Having a Sub Main that is called right after setup that is the main loop?  I know for most of you, this is redundant, since just adding in loop: or mainloop: is basicly the same thing, but for me, it makes it easier to read.

I do not have access to UO ATM so I can make a simple script to test if it would work, thats why I am asking here, so I can learn.

Finally, am I the only one who thinks it would be much easier to have the command to use a skill like this

Code: [Select]
useskill hiding

Instead of...

Code: [Select]
macro (numbers here)
Coragin

My Facebook
And now I'm better at doing what ever it is Wolverine does!

Offline Cerveza

  • 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: Can a scirpt have this basic type of setup....
« Reply #1 on: May 28, 2009, 06:07:11 AM »
0
Code: [Select]
gosub setup
gosub main

Sub main
mainloop:
;all the crap the script does here
GoTo mainloop

Sub setup
;all setup commands here
return

You don't need the lines

gosub main
sub main

Cause the script "falls" through to those lines anyways.

Take a look at the tutorials, there's one in there about basic script flow.

Header
Setup (if small)
-- gosub setup (if large)
MainLoop (*can* be a goto loop, better loops exist)
Subs
Menu
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 CoraginTopic starter

  • Wacko in Pajama's
  • Elite
  • *
  • *
  • Posts: 1641
  • Activity:
    0%
  • Reputation Power: 23
  • Coragin might someday be someone...Coragin might someday be someone...Coragin might someday be someone...Coragin might someday be someone...
  • Gender: Male
  • It Is What It Is.
  • Respect: +57
  • Referrals: 1
    • View Profile
Re: Can a scirpt have this basic type of setup....
« Reply #2 on: May 28, 2009, 06:15:15 AM »
0
Cerveza,

Thats the thread I did read.  I know some lines are not needed, but as I said, its easier for me to read and kinda like what I am used to.  Since from what I can tell, it wont slow the script down, its just a few extra lines of code.  At least until I get the hang of things, then clean my scripts up. 

So, I do know that they are not needed, but my question is, will it work?  My guess is yes.
Coragin

My Facebook
And now I'm better at doing what ever it is Wolverine does!

Tags: