Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Brandonito
Newbie


Joined: 24 Jul 2008
Posts: 8

PostPosted: Thu Jul 24, 2008 7:44 pm   

Character Creation problem
 
I've been trying to code a script for character creation on Dark Castle, and running in to maaaany issues.

Here is a sample of what the code looks like...

Code:
  Choose from any of the following groups of abilities...     
Group: 1     2     3     4     5
Str:   14    12    13    8     14
Dex:   15    14    13    10    11
Con:   12    14    12    13    11
Int:   16    14    12    9     10
Wis:   13    11    11    14    13
Choose a group <1-5>, or press return to reroll(Help <attribute> for more information) --> r

  Choose from any of the following groups of abilities...     
Group: 1     2     3     4     5
Str:   14    14    12    13    11
Dex:   12    14    11    12    14
Con:   13    14    8     12    13
Int:   9     13    14    14    13
Wis:   11    12    13    14    11
Choose a group <1-5>, or press return to reroll(Help <attribute> for more information) -->


Basically, what I'm trying to do is configure a script that will reroll until one of the group #'s has an 18 in the strength line, AND and 18 in the Constitution line.

So far all I've been able to do is figure out one, not both.
Any help would be greatly appreciated.
-Brandon

Edit Vijilante--changed quote tag to code tag
Reply with quote
Qaiia
Wanderer


Joined: 06 Apr 2007
Posts: 59

PostPosted: Thu Jul 24, 2008 8:02 pm   
 
Show us your existing code, please?
_________________
Citrus: The Juicy Alternative
Reply with quote
Brandonito
Newbie


Joined: 24 Jul 2008
Posts: 8

PostPosted: Thu Jul 24, 2008 8:07 pm   
 
... Deleted it out of frustration, but if it will help, I can re-write it again.
Reply with quote
Nurodma
Beginner


Joined: 10 Oct 2005
Posts: 24

PostPosted: Thu Jul 24, 2008 9:36 pm   
 
Can you paste the exact spacing as it appears on the mud?
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Thu Jul 24, 2008 11:42 pm   
 
I think any solution that is used will require the use of the %max function. I am not going to say much more since I tend to dislike autorollers in general.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Fri Jul 25, 2008 1:53 am   
 
#variable StatGroups {}
#variable StatRules {Str=18|Con=18}
#variable FlagGroups {1|2|3|4|5}
#variable FlagAnswer {}
#variable TempStatLabel {}
#variable TempStatOperation {}
#variable TempStatValue {}
#trigger {Str:%s(%d)%s(%d)%s(%d)%s(%d)%s(%d)} {TempStatLabel="";TempStatOperation="";TempStatValue="";FlagGroups="1|2|3|4|5";#forall @StatRules {#if ("%i" =~ "(%w)({=|<|>|<=|>=})(%d)") {#additem TempStatLabel %%1;#additem TempStatOperation %%2;#additem TempStatValue %%3}};#additem Statgroups.Group1 %1;#additem Statgroups.Group2 %2;#additem Statgroups.Group3 %3;#additem Statgroups.Group4 %4;#additem Statgroups.Group5 %5}
#condition {Dex:%s(%d)%s(%d)%s(%d)%s(%d)%s(%d)} {#additem Statgroups.Group1 %1;#additem Statgroups.Group2 %2;#additem Statgroups.Group3 %3;#additem Statgroups.Group4 %4;#additem Statgroups.Group5 %5}
#condition {Con:%s(%d)%s(%d)%s(%d)%s(%d)%s(%d)} {#additem Statgroups.Group1 %1;#additem Statgroups.Group2 %2;#additem Statgroups.Group3 %3;#additem Statgroups.Group4 %4;#additem Statgroups.Group5 %5}
#condition {Int:%s(%d)%s(%d)%s(%d)%s(%d)%s(%d)} {#additem Statgroups.Group1 %1;#additem Statgroups.Group2 %2;#additem Statgroups.Group3 %3;#additem Statgroups.Group4 %4;#additem Statgroups.Group5 %5}
#condition {Wis:%s(%d)%s(%d)%s(%d)%s(%d)%s(%d)} {#additem Statgroups.Group1 %1;#additem Statgroups.Group2 %2;#additem Statgroups.Group3 %3;#additem Statgroups.Group4 %4;#additem Statgroups.Group5 %5}
#condition {^>} {#loop 1,5 {#if (%ismember("Str",@TempStatLabel)) {#if (%item(@StatGroups.group%i,1)@tempstatoperation@tempstatvalue) {#noop do nothing, this is still a valid group} {#delitem FlagGroups %i}} {#noop Strength is not part of the criteria};#if (%ismember("Dex",@TempStatLabel)) {#if (%item(@StatGroups.group%i,1)@tempstatoperation@tempstatvalue) {#noop do nothing, this is still a valid group} {#delitem FlagGroups %i}} {#noop Dexterity is not part of the criteria};#if (%ismember("Con",@TempStatLabel)) {#if (%item(@StatGroups.group%i,1)@tempstatoperation@tempstatvalue) {#noop do nothing, this is still a valid group} {#delitem FlagGroups %i}} {#noop Constitution is not part of the criteria};#if (%ismember("Int",@TempStatLabel)) {#if (%item(@StatGroups.group%i,1)@tempstatoperation@tempstatvalue) {#noop do nothing, this is still a valid group} {#delitem FlagGroups %i}} {#noop Intelligence is not part of the criteria};#if (%ismember("Wis",@TempStatLabel)) {#if (%item(@StatGroups.group%i,1)@tempstatoperation@tempstatvalue) {#noop do nothing, this is still a valid group} {#delitem FlagGroups %i}} {#noop Wisdom is not part of the criteria};#if (%numitems(@FlagGroups)) {FlagAnswer = %prompt(%item(@FlagGroups,1),%concat("Do you want to choose one of these groups (",%replace(@FlagGroups,"|",", "),")?"));#if (%ismember(@FlagAnswer,@FlagGroups)) {@FlagAnswer} {#cr}} {#cr}} {nocr|prompt}

I know it looks like crap and I have not done any testing with it to see if it even works, but that should get you very close. I took the liberty of including variable support for the various stat rules you might want, so if you decide you want to include more or change them all you need to do is change the value(s) of the StatRules variable.
_________________
EDIT: I didn't like my old signature
Reply with quote
Brandonito
Newbie


Joined: 24 Jul 2008
Posts: 8

PostPosted: Fri Jul 25, 2008 11:40 am   
 
bump
Reply with quote
ralgith
Sorcerer


Joined: 13 Jan 2006
Posts: 715

PostPosted: Fri Jul 25, 2008 12:36 pm   
 
This should do what you're lookin for.

Code:
#CLASS {AutoRoller}
#TRIG {Str~:%s(%d)%s(%d)%s(%d)%s(%d)%s(%d)} {Col1.str = %1;Col2.str = %2;Col3.str = %3;Col4.str = %4;Col5.str = %5}
#TRIG {Dex~:%s(%d)%s(%d)%s(%d)%s(%d)%s(%d)} {Col1.dex = %1;Col2.dex = %2;Col3.dex = %3;Col4.dex = %4;Col5.dex = %5}
#TRIG {Con~:%s(%d)%s(%d)%s(%d)%s(%d)%s(%d)} {Col1.con = %1;Col2.con = %2;Col3.con = %3;Col4.con = %4;Col5.con = %5}
#TRIG {Int~:%s(%d)%s(%d)%s(%d)%s(%d)%s(%d)} {Col1.int = %1;Col2.int = %2;Col3.int = %3;Col4.int = %4;Col5.int = %5}
#TRIG {Wis~:%s(%d)%s(%d)%s(%d)%s(%d)%s(%d)} {Col1.wis = %1;Col2.wis = %2;Col3.wis = %3;Col4.wis = %4;Col5.wis = %5;#EXEC calcrolls}
#VAR Col1 {}
#VAR Col2 {}
#VAR Col3 {}
#VAR Col4 {}
#VAR Col5 {}
#ALIAS calcrolls {#LOOP 5 {#IF (%concat("Col", %i, ".str") > 17 & %concat("Col", %i, ".con") > 17) {#ECHO {Reroll Acceptable};#SEND %i;#ABORT 1} {#SEND %cr}}
#CLASS 0
_________________
CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate
Reply with quote
Brandonito
Newbie


Joined: 24 Jul 2008
Posts: 8

PostPosted: Fri Aug 01, 2008 5:06 pm   
 
That is exactly what I was looking for... just having problems with the calcrolls alias...
Code:
#LOOP 5 {#IF (%concat( "Col", %i, ".str") > 17 & %concat( "Col", %i, ".con") > 17) {
    #ECHO {Reroll Acceptable}
    #SEND %i
    #ABORT 1
    } {#SEND %cr}}


That doesn't seem to work, and I don't quite understand how to fix it..

Here is what the mud shows me after running the script..

Code:
  Choose from any of the following groups of abilities...     
Group: 1     2     3     4     5
Str:   12    13    16    12    9
Dex:   12    13    10    11    11
Con:   10    12    13    14    14
Int:   12    9     13    10    12
Wis:   13    14    14    13    13
Reroll Acceptable
Choose a group <1-5>, or press return to reroll(Help <attribute> for more information) -->
Choose a race(races you can select are marked with a *).
  *1: Human
  *2: Elf
  *3: Dwarf
  *4: Hobbit
  *5: Pixie
  *6: Ogre
  *7: Gnome
  *8: Orc
   9: Troll


Basically, it's saying one of the groups was acceptable, although none of them are, and choosing one.. (not sure which).

Any ideas?[/code]
Reply with quote
ralgith
Sorcerer


Joined: 13 Jan 2006
Posts: 715

PostPosted: Fri Aug 01, 2008 5:50 pm   
 
Sorry I wrote that on the fly here in the browser ;)

For one, I boobied lol
Basically I missed the #LOOP's closing bracket.

Here is the updated version, though it still may not work till I can get home and test it myself...
Note that is just the contents of the alias.

Code:
#LOOP 5 {#IF (%concat( "Col", %i, ".str") > 17 & %concat( "Col", %i, ".con") > 17) {
    #ECHO {Reroll Acceptable ~Roll: %i}
    #SEND %i
    #ABORT 1
    }
}
#SEND %cr
Reply with quote
Brandonito
Newbie


Joined: 24 Jul 2008
Posts: 8

PostPosted: Fri Aug 01, 2008 5:54 pm   
 
Doesn't work still...

It is accepting column 1, even though neither str nor con are > 17...

Code:
  Choose from any of the following groups of abilities...     
Group: 1     2     3     4     5
Str:   10    15    13    12    16
Dex:   13    14    10    13    15
Con:   12    14    14    13    12
Int:   13    12    14    11    14
Wis:   17    15    15    14    11
Reroll Acceptable Roll: 1
Choose a group <1-5>, or press return to reroll(Help <attribute> for more information) -->
Choose a race(races you can select are marked with a *).
  *1: Human
  *2: Elf
  *3: Dwarf
  *4: Hobbit
  *5: Pixie
   6: Ogre
  *7: Gnome
  *8: Orc
  *9: Troll


See? Acceptable Roll isn't 1... it's nothing... so it should reroll.... instead it accepts 1 anyways...
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Fri Aug 01, 2008 9:11 pm   
 
The problem seems to be that the #IF is comparing the string "Col1.str" to 17. Try adding @ to the appropriate spots so that CMud can know that Col1.str is supposed to be a variable?
_________________
EDIT: I didn't like my old signature
Reply with quote
Brandonito
Newbie


Joined: 24 Jul 2008
Posts: 8

PostPosted: Sat Aug 02, 2008 12:25 pm   
 
MattLofton wrote:
The problem seems to be that the #IF is comparing the string "Col1.str" to 17. Try adding @ to the appropriate spots so that CMud can know that Col1.str is supposed to be a variable?



It's for ZMud not CMud... that going to be a problem?
Reply with quote
ralgith
Sorcerer


Joined: 13 Jan 2006
Posts: 715

PostPosted: Sat Aug 02, 2008 1:58 pm   
 
No, and he is correct. As I said I wrote this on the fly.

Here is the correct alias...

Code:
#LOOP 5 {#IF (%concat( "@Col", %i, ".str") > 17 & %concat( "@Col", %i, ".con") > 17) {
    #ECHO {Reroll Acceptable Roll~: %i}
    #SEND %i
    #ABORT 1
    }
}
#SEND %cr
_________________
CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sat Aug 02, 2008 2:42 pm   
 
If that doesn't work then do this
Code:
#LOOP 5 {#IF ((@{Col%{i}.str} > 17) & (@{Col%{i}.con} > 17)) {

_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Brandonito
Newbie


Joined: 24 Jul 2008
Posts: 8

PostPosted: Sat Aug 02, 2008 2:49 pm   
 
Vijilante wrote:
If that doesn't work then do this
Code:
#LOOP 5 {#IF ((@{Col%{i}.str} > 17) & (@{Col%{i}.con} > 17)) {


That worked... Thank you all very much. The headaches this saves will be amazing.
Reply with quote
ralgith
Sorcerer


Joined: 13 Jan 2006
Posts: 715

PostPosted: Sun Aug 03, 2008 2:49 am   
 
I can imagine. One of the MUDs I play can sometimes require HOURS of rerolling. I once left a character on a reroll trigger and according to the timestamps in my log.... it took 17 hours 43 minutes and 11 seconds to get the stats I was aiming for. Of course, I WAS aiming for the highest rollable stats possible for that race... :D
_________________
CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate
Reply with quote
Seb
Wizard


Joined: 14 Aug 2004
Posts: 1269

PostPosted: Sun Aug 03, 2008 2:59 am   
 
ralgith wrote:
I can imagine. One of the MUDs I play can sometimes require HOURS of rerolling. I once left a character on a reroll trigger and according to the timestamps in my log.... it took 17 hours 43 minutes and 11 seconds to get the stats I was aiming for. Of course, I WAS aiming for the highest rollable stats possible for that race... :D

Haha! That's probably why they took away rolling for stats on my MUD (and you can now choose them). Course it would have taken a lot longer for us since you had to reach level 6 to find out what your stats were!
Reply with quote
ralgith
Sorcerer


Joined: 13 Jan 2006
Posts: 715

PostPosted: Mon Aug 04, 2008 12:49 pm   
 
Well, on that MUD you can usually get "good" stats within just a few rolls. I don't want "good" I want "great" :D
_________________
CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate
Reply with quote
Brandonito
Newbie


Joined: 24 Jul 2008
Posts: 8

PostPosted: Tue Aug 05, 2008 6:57 pm   
 
Yeah, I was aiming for perfect... and I'm still trying btw... 49 hours straight rolling now on my 2nd character.

Crazy eh?

First character was 17 hours.
Reply with quote
Seb
Wizard


Joined: 14 Aug 2004
Posts: 1269

PostPosted: Wed Aug 06, 2008 2:41 am   
 
Wow! Your mud really needs to change their system! Wink
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
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

© 2009 Zugg Software. Hosted by Wolfpaw.net