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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
chaossdragon
Apprentice


Joined: 09 Apr 2008
Posts: 167

PostPosted: Tue Oct 27, 2020 1:47 am   

Shalimar I need your wisdom
 
I have... @monkCombos.name (where name is a specific combo of attacks listed as a string "palm punch|elbow|roundhouse kick" I have a list of like 18 combinations)

so my thing is as follows (new combo's will be added as I learn them)
Code:
alias "combo"

//master combo list
$comboList="opener|blind"

// command check with echo syntax
#IF (!%ismember(%1,$comboList)) {#echo "Syntax : combo <ARG> - where ARG is : opener|blind"}

//switch function for combo order
charStats.combo = %1

#SWITCH (%1 = opener) {comboTemp = %item(@monkCombos.opener,1);#EXE %pop(@comboTemp)}
  (%1 = blind) {comboTemp = %item(@monkCombos.blind,1);#EXE %pop(@comboTemp)}
 
#T+ ComboSeq


this is paired with a trigger
Code:
pattern - You have finished concentrating on the skill.
command - #if (%numitems(@comboTemp)>0) {#exec  %pop(@comboTemp)} {#say Combo Finish!}


Thing is @comboTemp is only receiving the first action and ignores everything after |
where the desired function is to do first listed action, and remove it from the string list, then upon trigger do action, remove from list til empty.

I want to keep the master list intact and 'copy' the combo to @comboTemp when called on by the alias 'combo'
Reply with quote
chaossdragon
Apprentice


Joined: 09 Apr 2008
Posts: 167

PostPosted: Tue Oct 27, 2020 6:06 am   
 
I more or less got it to work by not using %DB and making unique VAR string list for each combo, then copy that var to the @comboTemp to run %pop with... would much rather pull the string list from DB to not have as many stand alone variables... but not sure if that's do-able.

the core mechanics work for a friend that uses it in Blowtorch (on his cell) so converting stuff to work in cmud was my biggest issue.

Code:
 combo alias

//master combo list
$comboList="opener|blind|basic|DfA|dahleg|slow"

// command check with echo syntax
#IF (!%ismember(%1,$comboList)) {#echo "Syntax : combo <ARG> - where ARG is : opener|blind|basic|DfA|dahleg|slow"}

//switch function for combo order
charStats.combo = %1

#SWITCH (%1 = opener) {#VAR comboTemp @opener}
  (%1 = blind) {#VAR comboTemp @blind}
  (%1 = stun) {#VAR comboTemp @stun}

#EXE {%pop(@comboTemp)}
#T+ ComboSeq
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4662
Location: Pensacola, FL, USA

PostPosted: Tue Oct 27, 2020 11:27 am   
 
You are only ever assigning it the first item in the list:

comboTemp = %item(@monkCombos.opener,1)

Rather than the whole combo:

comboTemp = %db(@monkCombos, opener)

Also, you aren't supposed to use the @ symbol in a %pop
_________________
Discord: Shalimarwildcat
Reply with quote
chaossdragon
Apprentice


Joined: 09 Apr 2008
Posts: 167

PostPosted: Tue Oct 27, 2020 12:37 pm   
 
Ah

sucker punch is an out of combat skill and requires <arg> to designate the mob like 'kill soldier' 'sucker punch soldier' all other uses of the combo alias is after combat is initiated so doesn't require the <arg>

or were you meaning when designating 'comboTemp' ?
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4662
Location: Pensacola, FL, USA

PostPosted: Wed Oct 28, 2020 1:05 pm   
 
The latter.
_________________
Discord: Shalimarwildcat
Reply with quote
chaossdragon
Apprentice


Joined: 09 Apr 2008
Posts: 167

PostPosted: Thu Oct 29, 2020 12:32 am   
 
OK, got that all squared away and working perfectly. Thank you so much...

However I have a new issue that you have helped me with something(?) sort of.

Basic gist is I have an alias with a string list of trainable guild skills. alias to #FORALL from that list and a designated rank to train to. What I want to do is create a DB list of each skill_Name (%i) = Exp : Value to then %sort this list by the Exp Lowest to Highest.

Code:

$attackSkills = "backflip|butterfly kick|cross|hammer fist|hip throw|hook|jab|knee|knifehand chop|legsweep|stun|sucker punch"
$defenseSkills = "controlled breathing|dodge|spirit shout"
$offenseSkills = "critical hit|exotic|leftwield|second attack|third attack"
$utilitySkills = "bushido|climb|discipline"

#IF (%1 == "") {#SAY {Syntax : skillExp <Rank #>}} {
  gSkillList.rank = %1
  #FORALL %concat($attackSkills,"|",$defenseSkills,"|",$offenseSkills,"|",$utilitySkills) {
    $name=%i
    #ADDKEY @gSkillList $name ""
    estimate train %i @gSkillList.rank
    }
  }

#TR {That would cost you 448,800 experience points. } {#ADDKEY gSkillList.$name.exp %d}

**I know I can use a single list and I will convert it to a masterlist shortly but til I get this concept down (IF possible) small-ish lists for testing...
I can get the first half to work, but I can't figure out how to pass the captured Exp_Value to the linked Skill_Name.

Example : estimate train stun 50 (sent to mud)
Output : That would cost you 448,800 experience points.

*sadly the output spam doesn't list the skill from the command but I would think that is easy to get around, but I can't figure it out lol...
** @gSkillList.Name (@gSkillList.Rank) : @gSkillList.Name.Exp will be used for a check on what skill I want to focus on (lowest to highest)
Thanks again in advance
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4662
Location: Pensacola, FL, USA

PostPosted: Thu Oct 29, 2020 2:00 pm   
 
Sorting explanations can get a bit long, take a look at this old thread where I was doing something similar:

http://forums.zuggsoft.com/forums/viewtopic.php?p=133263#133263
_________________
Discord: Shalimarwildcat
Reply with quote
chaossdragon
Apprentice


Joined: 09 Apr 2008
Posts: 167

PostPosted: Thu Oct 29, 2020 2:06 pm   
 
I have managed to get 90% of what I wanted to accomplish down, just all that remains is the sorting.

Code:
 #ALIAS
$gSkills = "backflip|butterfly kick|cross|hammer fist|hip throw|hook|jab|knee|knifehand chop|legsweep|stun|sucker punch|controlled breathing|dodge|spirit shout|critical hit|exotic|leftwield|second attack|third attack|bushido|climb|discipline"

#IF (%1 == "") {#SAY {Syntax : skillExp <Rank #>}} {
  gSkillList.rank = %1
  #FORALL $gSkills {
    $name=%i
    #ADDKEY @gSkillList $name ""
    estimate train %i @gSkillList.rank
    #VAR tempSkillName $name
    #WA 1000
    }
  }
#LOOPDB @gSkillList {#SHOW {%key "=" %val}}
#UNVAR tempSkillName
#SAY {Complete!}

#TRIG
Pattern: ^That would cost you (\d[^>]+) experience points.
Script: #ADDKEY @gSkillList @tempSkillName %replace(%1,",","")

** Not sure if this is the best method to do this but it works...now just need to figure out the sorting of this list.

Code:
backflip = 5756125
butterfly kick = 5645625
cross = 1151225
hammer fist = 6331731
hip throw = 2261806
hook = 4317078
jab = 287784
knee = 2878056
knifehand chop = 2993115
legsweep = 2014628
stun = 1809450
sucker punch =
controlled breathing = 4523625
dodge = 1583259
spirit shout = 8142525
critical hit = 1809450
exotic = 575606
leftwield = 2261806
second attack = 904725
third attack = 3618900
bushido = 2035615
climb = 678534
discipline = 11291250

Variable tempSkillName removed.
Complete!
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4662
Location: Pensacola, FL, USA

PostPosted: Thu Oct 29, 2020 2:41 pm   
 
You could try flipping the key-value pair to leading with the xp costs.

#ADDKEY trainOrder $expCost $skillName

Then when you are ready to train the cheapest one:

$nextSkill=%pop(%sort(%dbkeys(@trainOrder)))
train %db(@trainOrder, $nextSkill)
#DELKEY trainorder $nextSkill
_________________
Discord: Shalimarwildcat
Reply with quote
chaossdragon
Apprentice


Joined: 09 Apr 2008
Posts: 167

PostPosted: Thu Oct 29, 2020 3:11 pm   
 
I had just found this post...

http://zuggsoft.com/forums/viewtopic.php?t=37689

I'll test your suggestion after a nap lol
been wracking my brains for this thing and while I am proud I solved the majority of it, the end goal is just out of reach with the state my brain is in...
Reply with quote
chaossdragon
Apprentice


Joined: 09 Apr 2008
Posts: 167

PostPosted: Thu Oct 29, 2020 9:31 pm   
 
OK the flip part worked fine, but the rest of it isn't. well I modified it the #SHOW so I could see what it was doing and it just sends a blank line.

What I need the last part to really do is set two variables that I use to track the skill name I am currently working on saving free exp to train with,
and the required exp for said skill.

Code:
Gauge

<button type="Gauge" autosize="false" width="963" height="25" autopos="false" top="28" toolbar="2" color="black" textcolor="red" gaugelowcol="aqua" gaugebackcol="aqua" priority="2980" id="298">
  <caption>--[ Needed Free Experience : @charStats.skillName ( @charStats.skillRank ) %format("&amp;10.0n",@charStats.expNeeded) ]--</caption>
  <value>#SENDRAW {train @charStats.skillName to @charStats.skillRank}</value>
  <expr>@charStats.expNeeded</expr>
  <gaugemax>%replace(@charStats.expGoal,",","")</gaugemax>
</button>
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4662
Location: Pensacola, FL, USA

PostPosted: Thu Oct 29, 2020 10:04 pm   
 
Defining variables is pretty easy, what are you having problems with in this section?

The only issue I see with the code is in the %format formatting string.

"&amp;10.0n"
should be
"&10.0n"
_________________
Discord: Shalimarwildcat
Reply with quote
chaossdragon
Apprentice


Joined: 09 Apr 2008
Posts: 167

PostPosted: Thu Oct 29, 2020 10:14 pm   
 
well I run the main alias to estimate all skills in the master list and that's how we get the low to high cost we flipped. I need to then with a second alias to just pull that lowest skill & cost to the above's gauge. so I know when the gauge is full I can then train that skill to the estimated rank.

also the gauge in client is "&10.0n" but when you look at the XML tab and copy/paste it converts it to the "&amp;10.0n"
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4662
Location: Pensacola, FL, USA

PostPosted: Fri Oct 30, 2020 12:44 am   
 
Well, after you have the flipped list set up do something like

$xp=%pop(%sort(%dbkeys(@trainOrder)))
#ADDKEY charstats expNeeded $xp
#ADDKEY charstats skillName %db(@trainOrder, $xp)

You can set skillRank similarly in the alias you use to get the values in the first place.
_________________
Discord: Shalimarwildcat
Reply with quote
chaossdragon
Apprentice


Joined: 09 Apr 2008
Posts: 167

PostPosted: Fri Oct 30, 2020 1:59 am   
 
the gauge also functions onCLick to send "train @charStats.skillName to @charStats.skillRank" can I still use

#DELKEY trainOrder $xp

to remove the trained skill from list?
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4662
Location: Pensacola, FL, USA

PostPosted: Fri Oct 30, 2020 2:19 am   
 
$xp, as a local variable, will no longer be in memory by the time you click the button, but if you redeclare it, it would work, assuming nothing else got cheaper in the meantime.
Or just use %db(@charStats, expNeeded)
_________________
Discord: Shalimarwildcat
Reply with quote
chaossdragon
Apprentice


Joined: 09 Apr 2008
Posts: 167

PostPosted: Fri Oct 30, 2020 2:29 am   
 
duh just remembered that %pop will remove that item from the list when the setSkill alias gets used to define the skillName, expGoal to the guage.
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4662
Location: Pensacola, FL, USA

PostPosted: Fri Oct 30, 2020 2:36 am   
 
That pop is working off the anonymous variable returned by %dbkeys, no saved variable was popped.
_________________
Discord: Shalimarwildcat
Reply with quote
chaossdragon
Apprentice


Joined: 09 Apr 2008
Posts: 167

PostPosted: Fri Oct 30, 2020 3:09 am   
 
but I could use the #DELKEY at that level after it's written the expGoal & skillName, like how you originally called for it's use?
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4662
Location: Pensacola, FL, USA

PostPosted: Fri Oct 30, 2020 3:35 pm   
 
You can, yes.
_________________
Discord: Shalimarwildcat
Reply with quote
chaossdragon
Apprentice


Joined: 09 Apr 2008
Posts: 167

PostPosted: Sun Nov 01, 2020 12:33 am   
 
hrm took a short break and now that I'm back at it, something isn't working right.

the main proccess is working to collect the data and flip the name/exp to exp/name, but when I go to setGoal with
Code:
$xp=%pop(%sort(%dbkeys(@trainOrder)))
#ADDKEY charStats expGoal $xp
#ADDKEY charStats skillName %db(@trainOrder, $xp)


resulting in..
11050 = exotic
22100 = cross
38675 = legsweep
55250 = knee
57450 = knifehand chop
82875 = hook
110500 = backflip
121550 = hammer fist

the @charStats.skillName && @charStats.expGoal are blank values.
Reply with quote
chaossdragon
Apprentice


Joined: 09 Apr 2008
Posts: 167

PostPosted: Sun Nov 01, 2020 12:16 pm   
 
after sleeping on it I tried to break it down step by step and it seems nesting all those functions broke something...
Code:
$xp=%dbkeys(@trainOrder)
$xps=%sort($xp)
$xpp=%pop($xps)
#ADDKEY charStats expGoal $xpp
#ADDKEY charStats skillName %db(@trainOrder, $xpp)
#SENDRAW {exp}
//#DELKEY trainOrder $xpp


works as designed though
Reply with quote
bariszop
Newbie


Joined: 02 Mar 2022
Posts: 1

PostPosted: Sat Mar 05, 2022 7:24 am   
 
sucker punch is an out of combat skill and requires <arg> to designate the mob like 'kill soldier' 'sucker punch soldier' all other uses of the combo alias is after combat is initiated so doesn't require the <arg>
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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