The Dawn Of Time
The Official Forums for the Dawn Of Time Mud Codebase
 
Log in Register FAQ Memberlist Search The Dawn Of Time Forum Index Goto the Official Dawn Website

Mprog help.

 
Post new topic   Reply to topic    The Dawn Of Time Forum Index » Getting Started
View previous topic :: View next topic  
Author Message
boblinski



Joined: 27 Nov 2007
Posts: 40

PostPosted: Mon Jun 09, 2008 8:29 pm    Post subject: Mprog help. Reply with quote

Hi there, I've been trying to setup a mprog to act as a trainer.. wherein the trainer will give you a new skill/spell dependent on your level! The skills/spells are set in stone, no randomizing to it.

Anyway, please have a look, because it definitely needs fine turned because this is for a single class for only 10 levels... and I will have 50 mortal levels and somewhere around 10 classes so it will be a lot of work to keep going with this like it is.

Code:
if level $n == 2
and hastoken $n L2_ill_tok
 say You cannot learn anymore yet, $n.
else
 mob setskill $n *sp2* 1 0 0
 mob oload L2_ill_tok
 mob tgive $n L2_ill_tok
endif

if level $n == 3
 if hastoken $n L3_ill_tok
  say You cannot learn anymore yet, $n.
 else
  if hastoken $n L2_ill_tok
   mob setskill $n *sp3* 1 0 0
   mob oload L3_ill_tok
   mob tgive $n L3_ill_tok
   mob tremove $n L2_ill_tok
  else
   mob setskill $n *sp2* 1 0 0
   mob setskill $n *sp3* 1 0 0
   mob oload L3_ill_tok
   mob tgive $n L3_ill_tok
  endif
 endif
endif

if level $n == 4
 if hastoken $n L4_ill_tok
  say You cannot learn anymore yet, $n.
 else
  if hastoken $n L3_ill_tok
   mob setskill $n *sp4* 1 0 0
   mob oload L4_ill_tok
   mob tgive $n L4_ill_tok
   mob tremove $n L3_ill_tok
  else
   if hastoken $n L2_ill_tok
    mob setskill $n *sp3* 1 0 0
    mob setskill $n *sp4* 1 0 0
    mob oload L4_ill_tok
    mob tgive $n L4_ill_tok
    mob tremove $n L2_ill_tok
   else
    mob setskill $n *sp2* 1 0 0
    mob setskill $n *sp3* 1 0 0
    mob setskill $n *sp4* 1 0 0
    mob oload L4_ill_tok
    mob tgive $n L4_ill_tok
   endif
  endif
 endif
endif

if level $n == 5
 if hastoken $n L5_ill_tok
  say You cannot learn anymore yet, $n.
 else
  if hastoken $n L4_ill_tok
   mob setskill $n *sp5* 1 0 0
   mob oload L5_ill_tok
   mob tgive $n L5_ill_tok
   mob tremove $n L4_ill_tok
  else
   if hastoken $n L3_ill_tok
    mob setskill $n *sp4* 1 0 0
    mob setskill $n *sp5* 1 0 0
    mob oload L5_ill_tok
    mob tgive $n L5_ill_tok
    mob tremove $n L3_ill_tok
   else
    if hastoken $n L2_ill_tok
     mob setskill $n *sp3* 1 0 0
     mob setskill $n *sp4* 1 0 0
     mob setskill $n *sp5* 1 0 0
     mob oload L5_ill_tok
     mob tgive $n L5_ill_tok
     mob tremove $n L2_ill_tok
    else
     mob setskill $n *sp2* 1 0 0
     mob setskill $n *sp3* 1 0 0
     mob setskill $n *sp4* 1 0 0
     mob setskill $n *sp5* 1 0 0
     mob oload L5_ill_tok
     mob tgive $n L5_ill_tok
    endif
   endif
  endif
 endif
endif

if level $n == 6
 if hastoken $n L6_ill_tok
  say You cannot learn anymore yet, $n.
 else
  if hastoken $n L5_ill_tok
   mob setskill $n *sp6* 1 0 0
   mob oload L6_ill_tok
   mob tgive $n L6_ill_tok
   mob tremove $n L5_ill_tok
  else
   if hastoken $n L4_ill_tok
    mob setskill $n *sp5* 1 0 0
    mob setskill $n *sp6* 1 0 0
    mob oload L6_ill_tok
    mob tgive $n L6_ill_tok
    mob tremove $n L4_ill_tok
   else
    if hastoken $n L3_ill_tok
     mob setskill $n *sp4* 1 0 0
     mob setskill $n *sp5* 1 0 0
     mob setskill $n *sp6* 1 0 0
     mob oload L6_ill_tok
     mob tgive $n L6_ill_tok
     mob tremove $n L3_ill_tok
    else
     if hastoken $n L2_ill_tok
      mob setskill $n *sp3* 1 0 0
      mob setskill $n *sp4* 1 0 0
      mob setskill $n *sp5* 1 0 0
      mob setskill $n *sp6* 1 0 0
      mob oload L6_ill_tok
      mob tgive $n L6_ill_tok
      mob tremove $n L2_ill_tok
     else
      mob setskill $n *sp2* 1 0 0
      mob setskill $n *sp3* 1 0 0
      mob setskill $n *sp4* 1 0 0
      mob setskill $n *sp5* 1 0 0
      mob setskill $n *sp6* 1 0 0
      mob oload L6_ill_tok
      mob tgive $n L6_ill_tok
     endif
    endif
   endif
  endif
 endif
endif

if level $n == 7
 if hastoken $n L7_ill_tok
  say You cannot learn anymore yet, $n.
 else
  if hastoken $n L6_ill_tok
   mob setskill $n *sp7* 1 0 0
   mob oload L7_ill_tok
   mob tgive $n L7_ill_tok
   mob tremove $n L6_ill_tok
  else
   if hastoken $n L5_ill_tok
    mob setskill $n *sp6* 1 0 0
    mob setskill $n *sp7* 1 0 0
    mob oload L7_ill_tok
    mob tgive $n L7_ill_tok
    mob tremove $n L5_ill_tok
   else
    if hastoken $n L4_ill_tok
     mob setskill $n *sp5* 1 0 0
     mob setskill $n *sp6* 1 0 0
     mob setskill $n *sp7* 1 0 0
     mob oload L7_ill_tok
     mob tgive $n L7_ill_tok
     mob tremove $n L4_ill_tok
    else
     if hastoken $n L3_ill_tok
      mob setskill $n *sp4* 1 0 0
      mob setskill $n *sp5* 1 0 0
      mob setskill $n *sp6* 1 0 0
      mob setskill $n *sp7* 1 0 0
      mob oload L7_ill_tok
      mob tgive $n L7_ill_tok
      mob tremove $n L3_ill_tok
     else
      if hastoken $n L2_ill_tok
       mob setskill $n *sp3* 1 0 0
       mob setskill $n *sp4* 1 0 0
       mob setskill $n *sp5* 1 0 0
       mob setskill $n *sp6* 1 0 0
       mob setskill $n *sp7* 1 0 0
       mob oload L7_ill_tok
       mob tgive $n L7_ill_tok
       mob tremove $n L2_ill_tok
      else
       mob setskill $n *sp2* 1 0 0
       mob setskill $n *sp3* 1 0 0
       mob setskill $n *sp4* 1 0 0
       mob setskill $n *sp5* 1 0 0
       mob setskill $n *sp6* 1 0 0
       mob setskill $n *sp7* 1 0 0
       mob oload L7_ill_tok
       mob tgive $n L7_ill_tok
      endif
     endif
    endif
   endif
  endif
 endif
endif

if level $n == 8
 if hastoken $n L8_ill_tok
  say You cannot learn anymore yet, $n.
 else
  if hastoken $n L7_ill_tok
   mob setskill $n *sp7* 1 0 0
   mob setskill $n *sp8* 1 0 0
   mob oload L8_ill_tok
   mob tgive $n L8_ill_tok
   mob tremove $n L7_ill_tok
  else
   if hastoken $n L6_ill_tok
    mob setskill $n *sp7* 1 0 0
    mob setskill $n *sp8* 1 0 0
    mob oload L8_ill_tok
    mob tgive $n L8_ill_tok
    mob tremove $n L6_ill_tok
   else
    if hastoken $n L5_ill_tok
     mob setskill $n *sp6* 1 0 0
     mob setskill $n *sp7* 1 0 0
     mob setskill $n *sp8* 1 0 0
     mob oload L8_ill_tok
     mob tgive $n L8_ill_tok
     mob tremove $n L5_ill_tok
    else
     if hastoken $n L4_ill_tok
      mob setskill $n *sp5* 1 0 0
      mob setskill $n *sp6* 1 0 0
      mob setskill $n *sp7* 1 0 0
      mob setskill $n *sp8* 1 0 0
      mob oload L8_ill_tok
      mob tgive $n L8_ill_tok
      mob tremove $n L4_ill_tok
     else
      if hastoken $n L3_ill_tok
       mob setskill $n *sp4* 1 0 0
       mob setskill $n *sp5* 1 0 0
       mob setskill $n *sp6* 1 0 0
       mob setskill $n *sp7* 1 0 0
       mob setskill $n *sp8* 1 0 0
       mob oload L8_ill_tok
       mob tgive $n L8_ill_tok
       mob tremove $n L3_ill_tok
      else
       if hastoken $n L2_ill_tok
        mob setskill $n *sp3* 1 0 0
        mob setskill $n *sp4* 1 0 0
        mob setskill $n *sp5* 1 0 0
        mob setskill $n *sp6* 1 0 0
        mob setskill $n *sp7* 1 0 0
        mob setskill $n *sp8* 1 0 0
        mob oload L8_ill_tok
        mob tgive $n L8_ill_tok
        mob tremove $n L2_ill_tok
       else
        mob setskill $n *sp2* 1 0 0
        mob setskill $n *sp3* 1 0 0
        mob setskill $n *sp4* 1 0 0
        mob setskill $n *sp5* 1 0 0
        mob setskill $n *sp6* 1 0 0
        mob setskill $n *sp7* 1 0 0
        mob setskill $n *sp8* 1 0 0
        mob oload L8_ill_tok
        mob tgive $n L8_ill_tok
       endif
      endif
     endif
    endif
   endif
  endif
 endif
endif

if level $n == 9
 if hastoken $n L9_ill_tok
  say You cannot learn anymore yet, $n.
 else
  if hastoken $n L8_ill_tok
   mob setskill $n *sp7* 1 0 0
   mob setskill $n *sp8* 1 0 0
   mob setskill $n *sp9* 1 0 0
   mob oload L9_ill_tok
   mob tgive $n L9_ill_tok
   mob tremove $n L8_ill_tok
  else
   if hastoken $n L7_ill_tok
    mob setskill $n *sp7* 1 0 0
    mob setskill $n *sp8* 1 0 0
    mob setskill $n *sp9* 1 0 0
    mob oload L9_ill_tok
    mob tgive $n L9_ill_tok
    mob tremove $n L7_ill_tok
   else
    if hastoken $n L6_ill_tok
     mob setskill $n *sp7* 1 0 0
     mob setskill $n *sp8* 1 0 0
     mob setskill $n *sp9* 1 0 0
     mob oload L9_ill_tok
     mob tgive $n L9_ill_tok
     mob tremove $n L6_ill_tok
    else
     if hastoken $n L5_ill_tok
      mob setskill $n *sp6* 1 0 0
      mob setskill $n *sp7* 1 0 0
      mob setskill $n *sp8* 1 0 0
      mob setskill $n *sp9* 1 0 0
      mob oload L9_ill_tok
      mob tgive $n L9_ill_tok
      mob tremove $n L5_ill_tok
     else
      if hastoken $n L4_ill_tok
       mob setskill $n *sp5* 1 0 0
       mob setskill $n *sp6* 1 0 0
       mob setskill $n *sp7* 1 0 0
       mob setskill $n *sp8* 1 0 0
       mob setskill $n *sp9* 1 0 0
       mob oload L9_ill_tok
       mob tgive $n L9_ill_tok
       mob tremove $n L4_ill_tok
      else
       if hastoken $n L3_ill_tok
        mob setskill $n *sp4* 1 0 0
        mob setskill $n *sp5* 1 0 0
        mob setskill $n *sp6* 1 0 0
        mob setskill $n *sp7* 1 0 0
        mob setskill $n *sp8* 1 0 0
        mob setskill $n *sp9* 1 0 0
        mob oload L9_ill_tok
        mob tgive $n L9_ill_tok
        mob tremove $n L3_ill_tok
       else
        if hastoken $n L2_ill_tok
         mob setskill $n *sp3* 1 0 0
         mob setskill $n *sp4* 1 0 0
         mob setskill $n *sp5* 1 0 0
         mob setskill $n *sp6* 1 0 0
         mob setskill $n *sp7* 1 0 0
         mob setskill $n *sp8* 1 0 0
         mob setskill $n *sp9* 1 0 0
         mob oload L9_ill_tok
         mob tgive $n L9_ill_tok
         mob tremove $n L2_ill_tok
        else
         mob setskill $n *sp2* 1 0 0
         mob setskill $n *sp3* 1 0 0
         mob setskill $n *sp4* 1 0 0
         mob setskill $n *sp5* 1 0 0
         mob setskill $n *sp6* 1 0 0
         mob setskill $n *sp7* 1 0 0
         mob setskill $n *sp8* 1 0 0
         mob setskill $n *sp9* 1 0 0
         mob oload L9_ill_tok
         mob tgive $n L9_ill_tok
        endif
       endif
      endif
     endif
    endif
   endif
  endif
 endif
endif

if level $n == 10
 if hastoken $n L10_ill_tok
  say You cannot learn anymore yet, $n.
  else
   if hastoken $n L8_ill_tok
    mob setskill $n *sp7* 1 0 0
    mob setskill $n *sp8* 1 0 0
    mob setskill $n *sp9* 1 0 0
    mob setskill $n *sp10* 1 0 0
    mob oload L10_ill_tok
    mob tgive $n L10_ill_tok
    mob tremove $n L9_ill_tok
  else
   if hastoken $n L8_ill_tok
    mob setskill $n *sp7* 1 0 0
    mob setskill $n *sp8* 1 0 0
    mob setskill $n *sp9* 1 0 0
    mob setskill $n *sp10* 1 0 0
    mob oload L10_ill_tok
    mob tgive $n L10_ill_tok
    mob tremove $n L8_ill_tok
   else
    if hastoken $n L7_ill_tok
     mob setskill $n *sp7* 1 0 0
     mob setskill $n *sp8* 1 0 0
     mob setskill $n *sp9* 1 0 0
     mob setskill $n *sp10* 1 0 0
     mob oload L10_ill_tok
     mob tgive $n L10_ill_tok
     mob tremove $n L7_ill_tok
    else
     if hastoken $n L6_ill_tok
      mob setskill $n *sp7* 1 0 0
      mob setskill $n *sp8* 1 0 0
      mob setskill $n *sp9* 1 0 0
      mob setskill $n *sp10* 1 0 0
      mob oload L10_ill_tok
      mob tgive $n L10_ill_tok
      mob tremove $n L6_ill_tok
     else
      if hastoken $n L5_ill_tok
       mob setskill $n *sp6* 1 0 0
       mob setskill $n *sp7* 1 0 0
       mob setskill $n *sp8* 1 0 0
       mob setskill $n *sp9* 1 0 0
       mob setskill $n *sp10* 1 0 0
       mob oload L10_ill_tok
       mob tgive $n L10_ill_tok
       mob tremove $n L5_ill_tok
      else
       if hastoken $n L4_ill_tok
        mob setskill $n *sp5* 1 0 0
        mob setskill $n *sp6* 1 0 0
        mob setskill $n *sp7* 1 0 0
        mob setskill $n *sp8* 1 0 0
        mob setskill $n *sp9* 1 0 0
        mob setskill $n *sp10* 1 0 0
        mob oload L10_ill_tok
        mob tgive $n L10_ill_tok
        mob tremove $n L4_ill_tok
       else
        if hastoken $n L3_ill_tok
         mob setskill $n *sp4* 1 0 0
         mob setskill $n *sp5* 1 0 0
         mob setskill $n *sp6* 1 0 0
         mob setskill $n *sp7* 1 0 0
         mob setskill $n *sp8* 1 0 0
         mob setskill $n *sp9* 1 0 0
         mob setskill $n *sp10* 1 0 0
         mob oload L10_ill_tok
         mob tgive $n L10_ill_tok
         mob tremove $n L3_ill_tok
        else
         if hastoken $n L2_ill_tok
          mob setskill $n *sp3* 1 0 0
          mob setskill $n *sp4* 1 0 0
          mob setskill $n *sp5* 1 0 0
          mob setskill $n *sp6* 1 0 0
          mob setskill $n *sp7* 1 0 0
          mob setskill $n *sp8* 1 0 0
          mob setskill $n *sp9* 1 0 0
          mob setskill $n *sp10* 1 0 0
          mob oload L10_ill_tok
          mob tgive $n L10_ill_tok
          mob tremove $n L2_ill_tok
         else
          mob setskill $n *sp2* 1 0 0
          mob setskill $n *sp3* 1 0 0
          mob setskill $n *sp4* 1 0 0
          mob setskill $n *sp5* 1 0 0
          mob setskill $n *sp6* 1 0 0
          mob setskill $n *sp7* 1 0 0
          mob setskill $n *sp8* 1 0 0
          mob setskill $n *sp9* 1 0 0
          mob setskill $n *sp10* 1 0 0
          mob oload L10_ill_tok
          mob tgive $n L10_ill_tok
         endif
        endif
       endif
      endif
     endif
    endif
   endif
  endif
 endif
endif


Also this is too many lines for a single mprog, is there a way around the line restriction? any ideas?


Back to top
View user's profile Send private message
derek



Joined: 23 Sep 2007
Posts: 125

PostPosted: Tue Jun 10, 2008 3:37 pm    Post subject: Reply with quote

i know next to nothing about mobprogs, but why don't you just do a seperate prog for each level to get around the prog length issue.


Back to top
View user's profile Send private message
boblinski



Joined: 27 Nov 2007
Posts: 40

PostPosted: Tue Jun 10, 2008 4:45 pm    Post subject: Reply with quote

See how each part of the code gets bigger depending on what level it's working on? well by the time it gets to level 50,, just the level 50 one will be too big by itself.


Back to top
View user's profile Send private message
derek



Joined: 23 Sep 2007
Posts: 125

PostPosted: Wed Jun 11, 2008 1:41 am    Post subject: Reply with quote

nod. well you could go about doing this in a number of ways, though. personally, i think you'd probably be better off in the long run hard coding this, but that may not be an option for what you're trying to do.

I don't see a 'hasskill' if check in the quick look i just did of the iftypes, but if you insist on doing this via mprog, your best bet might be to code that ifcheck, and then do something like
if level $n >02
and hasskill $n whatever > 0
mob setskill $n whatever 1 0 0

you could at least dispense with the tokens this way (which might also save you trouble down the road. on the off chance you've got a prog that gives a token in error, you could end up with the mob setting a skill back down to one as it's currently written. Probably not much of an issue when you're talking about 10 or even 50 skills, but with 500 tracking the problem down might be quite a bit more annoying,) and save yourself a ton of coding.

As a last resort, rather than using the level check like you are, you might try assigning each skill it's own unique token, which would allow you to break up the mprogs pretty easily. The problem with that approach is that you'd have ALOT of mprogs. I'm not sure if there's a limit on the number of mprogs you can place on a mob, I don't think I've ever put more than 3 or 4 on one, so would probably require some experimentation (or for someone who actually knows the system to chime in.)

If you run into limit on the number of individual mprogs per mob, you could put each trainer at the end of a maze and use a number of invisible mobs to set the tokens as the characters pass through the maze, and put a number of invisible mobs to handle the actual skill setting at the trainer. You'd be looking at writing thousands of individual mprogs this way, which seems a little overcomplicated to me, but it would work. `


Back to top
View user's profile Send private message
boblinski



Joined: 27 Nov 2007
Posts: 40

PostPosted: Wed Jun 11, 2008 10:37 am    Post subject: Reply with quote

Yeah, it sounds like a lot of work.. I would like to hard code it, but I don't really know what the syntax's are that I need to use..

I had no idea how to use mprogs when I first started, but they're a lot easier because of the help files..


Back to top
View user's profile Send private message
Deisel



Joined: 31 Jul 2007
Posts: 84
Location: SC

PostPosted: Fri Jun 13, 2008 9:44 am    Post subject: Reply with quote

No need to code a hasskill ifcheck. There is one in there. I used it for our form getting mprog before I coded it in. Syntax should be something like:

if hasskill $n dummyskill > 0
blah
endif

Edit:

Out of curiosity though, why do yo uneed to use mprogs for skills? As in depth as the skill editor is, why not just use that? You can set skills level, restric it to certain classes and races. I might be able to help you out if I knew what you were trying to do.



_________________
The major difference between a thing that might go wrong and a thing that cannot possibly go wrong is that when a thing that cannot possibly go wrong goes wrong it usually turns out to be impossible to get at or repair.
Douglas Adams
Back to top
View user's profile Send private message
Daos



Joined: 29 Jan 2003
Posts: 1219
Location: United States

PostPosted: Fri Jun 13, 2008 4:47 pm    Post subject: Reply with quote

Deisel wrote:
Out of curiosity though, why do you need to use mprogs for skills? As in depth as the skill editor is, why not just use that? You can set skills level, restric it to certain classes and races.


My thoughts exactly.



_________________
- Daos

http://www.dawnoftime.org
Back to top
View user's profile Send private message Send e-mail Visit poster's website
boblinski



Joined: 27 Nov 2007
Posts: 40

PostPosted: Sat Jun 14, 2008 11:02 am    Post subject: Reply with quote

I'm wanting to use it for spells.

I want set spells that are given at exact levels for set classes.


Back to top
View user's profile Send private message
Deisel



Joined: 31 Jul 2007
Posts: 84
Location: SC

PostPosted: Wed Jun 18, 2008 11:17 am    Post subject: Reply with quote

Use search and look for the code for setting scrolls to be learned. It's how I let players gain spells, and it works really well.



_________________
The major difference between a thing that might go wrong and a thing that cannot possibly go wrong is that when a thing that cannot possibly go wrong goes wrong it usually turns out to be impossible to get at or repair.
Douglas Adams
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    The Dawn Of Time Forum Index » Getting Started All times are GMT + 13 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001-2005 phpBB Group
Theme created by Vjacheslav Trushkin