Visit Retro Mud
Please help support TMC by visiting our sponsor

Member Discussions

terms


It's Not Just a Game |------[ http://www.retromud.org ]------| It's an ATTITUDE
6 Planets. 60 Races. 1,000 Skills & Spells. Infinite Possibilities.


[Previous] [Next] [Post] [Reply] [Topics] [Summary] [Search]


1. ROM - Program Variables Sun Oct 12, 2008 [1:15 PM]
Hades_Kane
Email not supplied
member since: Aug 17, 2001
Reply
I'm running a ROM codebase and this is what I'm wanting to be able to do in my programs:

Basically something like:

if sex $g == 1
say $g is a male!

or

if class $g == 4
mob transfer $g 500


The difference there being the 'g' variable. What I would like something like this to be able to do is in the if checks, take the character who triggered the program and first check him/her against the condition its checking for, and then cycle through their group (if any) and if everyone meets the specific criteria, then continue with the command. With the command, I would like it to be able to basically do the same... affect the character who triggered it plus everyone in his group.

What my question is, for anyone familiar with ROM and the program structure, is there a way to do this within the current way its coded and structured? I could see ways of doing this by basically making copies of all of the checks and commands to account for group (like the 'gtransfer' command), but if possible I would really like to try to make a new character variable that can handle that.

The reason being is that we are going to be implementing a playable storyline, and there seems to be a consensus that being able to group through these quests would be ideal, and since so much of the quests are going to be scripted to where you have to be at a certain point in order to continue, it would be ideal to be able to check for something like '$g' instead of '$n'.

Anyone have any ideas?
-Diablos of End of Time, eotmud.com:4000, Final Fantasy Inspired -- Seeking Builders! For more info visit: http://www.eotmud.com/


2. RE: ROM - Program Variables Mon Oct 13, 2008 [12:31 AM]
Epilogy
Email not supplied
member since: Mar 9, 2006
In Reply To
Reply
Cowbell.


3. RE: ROM - Program Variables Mon Oct 13, 2008 [1:36 PM]
Keriwena
Email not supplied
member since: Jun 25, 2001
In Reply To
Reply
I think you answered yourself. :)

"say $g is a male!"

You can't do that, and wouldn't want to.

Put the choice in the function, perhaps with a switch:

if class/g $n == 4
mob transfer/g $n 500


Tir na nOg - where Heroes never die
tnnmud.com 6789

Looking for a few good MUDs?
http://www.MUDQuest.org


4. RE: ROM - Program Variables Mon Oct 13, 2008 [2:57 PM]
Hades_Kane
Email not supplied
member since: Aug 17, 2001
In Reply To
Reply
I was hoping to be able to accomplish this without having to update every check and command within the system, but if I have to do it that way, I guess I'll have to do it that way :p

When I first started tinkering with code, I was very prone to doing things in a much more convoluted and complicated manner than was necessary (but it would usually work with no problems), and as I've gotten better I've gone back through and recoded or simply streamlined many of the things I've added. I was hoping there was a less complicated and more streamlined solution that I simply wasn't able to see yet :p

Thanks for the advice.
-Diablos of End of Time, eotmud.com:4000, Final Fantasy Inspired -- Seeking Builders! For more info visit: http://www.eotmud.com/


5. RE: ROM - Program Variables Tue Oct 14, 2008 [10:31 AM]
Zividave
zivilyn@ansalonmud.com
member since: Sep 26, 2004
In Reply To
Reply
You'd have to set up a new variable ($g), then have it do something along the lines of:

// blah of course
CHAR_DATA *rch, *rch_next;

for (rch = ch->in_room->people; rch != NULL; rch = rch_next)
{
rch_next = rch->next_in_room; // no nasty NULLs
if (is_same_group (rch, ch))
return (rch);
}
ANyway, it's blah code but gives the idea.
maybe a switch at teh return part and do a check for the second statement etc (CASE 'class': one_argument(argument, arg); if blah blah blah etc)

One thing though, not sure it's really necessary. A grall prog will hit everyone entering the room (vs a greet prog). Although, yeah, Joe buys a sword, Bob is a cleric, shopkeeper says 'Bob doesn't like it if you cut people Joe'.
Zivilyn/Skol
http://www.ansalonmud.com
Join us today and create Dragonlance history.


6. RE: ROM - Program Variables Tue Oct 14, 2008 [12:40 PM]
Hades_Kane
Email not supplied
member since: Aug 17, 2001
In Reply To
Reply
That's more or less what I originally tried.

I had defined the $g within the progs, and tried it a couple of different ways... one by using the for loop for everyone in the room that was in the victim's group and setting each of them as lval_char (it generally only returned in the check or command the last character reached), and I also tried to make it loop through the same function again for every person there was, but I didn't really have much luck with that either.
-Diablos of End of Time, eotmud.com:4000, Final Fantasy Inspired -- Seeking Builders! For more info visit: http://www.eotmud.com/


It's Not Just a Game |------[ http://www.retromud.org ]------| It's an ATTITUDE
6 Planets. 60 Races. 1,000 Skills & Spells. Infinite Possibilities.