Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Alright guys I will show you the scripts, aliases and triggers I have for a research function. Basically in our mud every skill has a percentage that they can be researched up to. Right now my code helps me capture all the skills on research and their percentage values, then start researching them.
- Scripts:
- function removefromlist()
- table.remove(researchthese, 1)
- research.skill = researchthese[1]
- cecho("\n<yellow>Skill changed to: "..research.skill)
- send("research "..research.skill)
- end
- -------
- function moveskills()
- researchthese = {}
- for i,v in pairs(mySkills) do
- if (v<80) then
- table.insert(researchthese,i)
- end
- end
- end
- -------------------------------------------------------------
- Triggers:
- You study for hours on end, but fail to gather any knowledge. | Exact match
- if researching then
- cecho("\n<yellow>Study harder, bitch!")
- send("research "..research.skill)
- end
- -------
- You finish your studies and feel much more skilled. | Exact match
- research.percent = research.percent + 15
- if researching then
- if research.percent < 81 then
- send("research "..research.skill)
- cecho("\n<yellow>Current percentage: "..research.percent.."%")
- else
- table.remove(researchthese, 1)
- research.skill = researchthese[1]
- research.percent = research.percent
- cecho("\n<yellow>Skill changed to: "..research.skill)
- send("research "..research.skill)
- end
- end
- --------
- You can't learn any more about that from books! | Exact match
- if researching then
- if research.percent >= 80 then
- cecho("\n<yellow>Percent is higher than 80.")
- table.remove(researchthese, 1)
- research.skill = researchthese[1]
- cecho("\n<yellow>Skill changed to: "..research.skill)
- send("research "..research.skill)
- else
- cecho("\n<red>Something is wrong here.. You are below 80 percent?")
- end
- end
- --------
- I got various syntaxes refusing to research skills saying they cannot be researched. Or that I am done researching them so what it does is;
- tempTimer( 2, [[removefromlist()]] )
- --------
- The Skills capture parser:
- ---------------------------------Skills----------------------------------- | exact match
- mySkills = {}
- --------
- ^\{Tone:
- ^\[HP: | Both perl regex (To end the capture I think)
- setTriggerStayOpen("skills", 0)
- display(mySkills)
- --------
- \s*([a-zA-z\- ]+\d+)% | Perl regex (No output just the folder name and this trigger)
- --------
- ([a-zA-z \-]+)(\d+) | Perl regex
- if string.trim(matches[2]) ~= "" then
- mySkills[string.trim(matches[2])] = tonumber(matches[3])
- end
- --------
- Aliases:
- I have two aliases, one is called msnow.
- Output: moveskills()
- -----
- The second alias is ^tr (\w+)$
- if matches[2] == "on" then
- research = {}
- research.skill = researchthese[1]
- research.percent = tonumber(mySkills[researchthese[1]])
- researching = true
- send("research "..research.skill)
- cecho("\n<green>Research Mode - Enabled")
- elseif matches[2] == "off" then
- researching = false
- cecho("\n<red>Research Mode - Disabled")
- end
- ------------------------------------------------------------------------------------------------
- I will paste you an example of practice window's output from mud and my prompt to help you understand. (Also the research capture displaying the table)
- ------------------------------------Skills ------------------------------------
- dock 0% fly 0% navigation 100%
- ship systems 100% small spacecraft 100% space combat 1 0%
- tractor beams 0% weapon systems 20%
- ------------------------------------ Feats ------------------------------------
- To see a shorter practice list, type PRACTICE <class name>.
- [HP: 3273/3273] [OOC: 6] Time: [ day] Tone: [none] [Movement: 2770/2770] [Near: ] [Mana: 0/0]
- [Ambience: average]{
- ["weapon systems"] = 20,
- ["tractor beams"] = 0,
- dock = 0,
- fly = 0,
- ["ship systems"] = 100,
- ["small spacecraft"] = 100,
- navigation = 100
- }
- You finish your studies and feel much more skilled.
- ----------------------------------------------------------------------------------------
- I have 3 problems as it stands:
- 1- When I trigger my research code via;
- - practice
- - msnow
- - tr on
- The script will capture the numbers and then take the first item on the list and then research it all the way above 80 percentage value. Once that one is above 80, it will move to the next skill, ---it will research it only once---. Once the final skill is researched it will stop the code.
- I would like it so that I am able to research every skill to its potential. Not the first to its potential and then rest only once.
- 2- My capture does not capture skills named "space combat 1" "space combat 2" etc. It's not a huge problem, I simply was wondering if it can easily be fixed, if not no huge deal.
- 3- This is within number 1 too. As it stands the code will move to the next skill, but refuse to take its research value. Is there a way to force the code to go back to the table and capture whatever number its value is?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement