[Home] [Downloads] [Search] [Help/forum]

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  I wrote this but...
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

I wrote this but...

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by David Berthiaume   (202 posts)  [Biography] bio
Date Fri 01 Apr 2005 11:37 PM (UTC)

Amended on Fri 01 Apr 2005 11:38 PM (UTC) by David Berthiaume

Message
I can't quite figure out who I did it. I need to modify this to set another variable, but I can't recall how I set up what it was I did
dim levelold, level
levelold = CInt(world.getvariable ("level"))
if world.getvariable ("level2") = "subhero" then
level = (levelold + 1)
if level > 100 then
world.setvariable "level2", "H"
level = (level - 100)
world.setvariable "level", level
else
world.setvariable "level", level
end if
else
level = (levelold + 1)
world.setvariable "level", level
end if


So then... What I need to do is put in a world.setvariable "MakeLevel', level
But the vbscript variable "level" has to be at a maximum of 100.

Ya know what I mean?
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] bio
Date Reply #1 on Sat 02 Apr 2005 07:17 AM (UTC)

Amended on Sat 02 Apr 2005 07:07 PM (UTC) by Flannel

Message
When do you want to set it?

what the script currently does is get the variable, check to see if level2 is 'subhero' if it, then it makes level = levelold+1 and checks to see if level is bigger than 100.
If it is, it sets level2 to H and both ways sets level to be 1-100.
If level2 wasnt 'subhero' then it simply adds 1 to the level.

However, none of this is actually what you asked. So what are you really asking?

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
[Go to top] top

Posted by David Berthiaume   (202 posts)  [Biography] bio
Date Reply #2 on Sat 02 Apr 2005 11:09 AM (UTC)
Message
Actually, I'm writing in vbscript.

The level progression goes from Level 1 to 100

At which point when you hit level 101, you become a Hero and the level progression goes from 1 to 750

What this script does is allow me to have my current level set in my infobar script.

If my level is subhero, then it just adds one to the level and so on and so forth, untill I hit Hero level, then it deducts 100 from the the current level changes it to "H" variable, and tacks it on, so it displays: Level: H1, instead of Level: 101.

Now, even though you become hero levels, you still only use Level 100 equipment, whats nice about this mud is there are no levels for equipment, the level is really only for enchanting purposes. However, you still can not create items above your current level. Meaning, at level 85 I have to make level 85 equipment, even though I can use Level 100 gear.

This mud has quite an extensive Player made equipment system, the majority of the mud ends up using player made armor, mostly because of the difficulty of finding quality items on mobs.

Anyways, I have a script that allows me to make items in 1 command instead of the multiple commands that it takes.

make new helm
make type winged helm
make level 100
make size medium
make colour blue
make material furnace (This will use whatever is in the furnace to create the item.)
make proceed

Anyways, I've still got to make a script menu type thing that will let me include the make types of the items. But that's a side project.

What I'm doing right now is using an alias like this:

make (helm) 100 medium blue

This will make a generic helm at level 100, size medium, and colour it blue.

I also have a multiple make alias that will make many items by queing up the commands as many times as I set the variable for.

What I want to do is have this level-up script set the variable for my current make level, level. So instead of manually putting in the level, it does it with expanded variables.

The problem I am running into is I am not sure where I need to put the code in. Which isn't very complicated code to begin with.

Also, if there were a way to simplify this script I wouldn't also mind knowing that as well.
[Go to top] top

Posted by Nick Gammon   Australia  (21,677 posts)  [Biography] bio   Forum Administrator
Date Reply #3 on Thu 07 Apr 2005 05:21 AM (UTC)
Message
For a start, why not just put:


world.setvariable "level", level


... at the end, rather than in every possible branch of the "if" statement?


- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Klintz   (5 posts)  [Biography] bio
Date Reply #4 on Thu 07 Apr 2005 12:12 PM (UTC)
Message
the mud you talk about sounds good what is the name of it?
[Go to top] top

Posted by David Berthiaume   (202 posts)  [Biography] bio
Date Reply #5 on Sat 09 Apr 2005 01:56 AM (UTC)
Message
Nick, I don't remember why I did that.

I'm certain there was a reason behind it. I just can't remember, I haven't had to change the script in so long. I just know it works.

It's called Xaos... You can find it on the mudconnector
[Go to top] top

Posted by Ked   Russia  (524 posts)  [Biography] bio
Date Reply #6 on Sat 09 Apr 2005 03:07 AM (UTC)

Amended on Sat 09 Apr 2005 03:09 AM (UTC) by Ked

Message
This code should be much easier to work with.


dim level
level = CInt(world.getvariable ("level")) + 1
if (world.getvariable ("level2") = "subhero") and _
   (level > 100) then
   world.setvariable "level2", "H"
   level = (level - 100)
end if
world.setvariable "level", level


What you are doing is incrementing the level by one and then checking whether it is over 100. If yes then you "normalize" it by incrementing level2 and subtracting 100 from level. Finally you save the new level. The original version of the script wasn't very obvious about that.

Edit: The levelold variable was also redundant
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


6,252 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]