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
chris123zugg
Apprentice


Joined: 23 Aug 2013
Posts: 175

PostPosted: Mon Jan 01, 2018 12:22 am   

database with proper allocation and function help
 
pattern : ADV~:%sHO~(([0-9.])~)/~((%d)~)%sHI~(([0-9.])~)/~((%d)~)%sLO~(([0-9.])~)/~((%d)~)%sLI~(([0-9.])~)/~((%d)~)



script:


#GAG
angel.ho=%1
angel.hot=%2
angel.hi=%3
angel.hit=%4
angel.lo=%5
angel.lot=%6
angel.li=%7
angel.lit=%8

#VAR advantages
#ADDKEY advantages "ho" @angel.ho
#ADDKEY advantages "hi" @angel.hi
#ADDKEY advantages "lo" @angel.lo
#ADDKEY advantages "li" @angel.li

#VAR reverse
#ADDKEY reverse @angel.ho "ho"
#ADDKEY reverse @angel.hi "hi"
#ADDKEY reverse @angel.lo "lo"
#ADDKEY reverse @angel.li "li"

#VAR Sorted (@angel.ho|@angel.hi|@angel.lo|@angel.li)

#while (%numitems(@Sorted)) {
#var temp %item(@Sorted,1)
#loop %numitems(@Sorted) {
#IF (%int(%item(@Sorted,%i)) < %int(@temp)) {#var temp %item(@Sorted,%i)}
}
#ADDITEM Display @temp
#DELITEM Sorted @temp
}

#VAR bestAdvantage %db(@reverse,%item(@Sorted,%numitems(@Sorted)))
#VAR bestAdvantageValue %db(@advantages,@bestAdvantage)
#VAR secondBestAdvantage %db(@reverse,%item(@Sorted,%numitems(@Sorted)-1))
#VAR secondBestAdvantageValue %db(@advantages,@secondBestAdvantage)

#IF (@angel.times<@angel.timesm&&@angel.lo>100&&@angel.div<75) {awe lo}
#IF (@angel.times<@angel.timesm&&@angel.li>100&&@angel.div<75) {awe li}
#IF (@angel.times<@angel.timesm&&@angel.ho>100&&@angel.div<75) {awe ho}
#IF (@angel.times<@angel.timesm&&@angel.hi>100&&@angel.div<75) {awe hi}
#IF (@angel.ret>=3&&@angel.ho>50&&@angel.hot>0) {retribution hi}
#IF (@angel.ret>=3&&@angel.hi>50&&@angel.hit>0) {retribution hi}
#IF (@angel.ret>=3&&@angel.lo>50&&@angel.lot>0) {retribution lo}
#IF (@angel.ret>=3&&@angel.li>50&&@angel.lit>0) {retribution li}
#IF (@angel.lo>=20&&@angel.times>2&&@distance<2) {prs lo} {}
#IF (@angel.li>=20&&@angel.times>2&&@distance<2) {prs li} {}
#IF (@angel.ho>=20&&@angel.times>2&&@distance<2) {prs ho} {}
#IF (@angel.hi>=20&&@angel.times>2&&@distance<2) {prs hi} {}
#IF (@angel.lo>=50&&@angel.times>2&&@distance<2) {ds lo} {}
#IF (@angel.li>=50&&@angel.times>2&&@distance<2) {ds li} {}
#IF (@angel.ho>=50&&@angel.times>2&&@distance<2) {ds ho} {}
#IF (@angel.hi>=50&&@angel.times>2&&@distance<2) {ds hi} {}



Im trying to make the database record "lo/li/ho/hi" numbers and when one of them gets to 10% use presage, at the same time if ANY are at 50% to use divine strike. the issue is i cannot presage on the same (lo/li/hi/ho) in a round, but i can divine strike multiple times a rd on any of those 4.

i need a proper database record of these numbers every rd, and a way to make a function or trigger set to do what i described, the TOP portion of the script is osmeon elses work and it didnt work so im asking here, the BOTTOM portion is my clunky ay of achieving a force method but doesnt work properly in what i want.

also, there are MANY other guild powers that need to be linked to this core trigger, and to be used at other ends of % levels of the same (lo/li/hi/ho) so i want something that works for these 2 so i can mess with that.

thanks ahead of time.
Reply with quote
shalimar
GURU


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

PostPosted: Mon Jan 01, 2018 4:09 am   
 
Walk me through exactly what you want here.
If you are looking to make gauges, those don't work with dbVars.
_________________
Discord: Shalimarwildcat
Reply with quote
chris123zugg
Apprentice


Joined: 23 Aug 2013
Posts: 175

PostPosted: Mon Jan 01, 2018 7:01 am   
 
Lo li ho hi are the main 4 components here
I need a script that will capture their current % to use a skill based on a specific percentage

as you can see i have made a clunky way to spam this...

presage will fire @10% advantage in ANY of the 4 mentioned... however if there is one say at 21% i'd rather presage that, but if ALL 4 are >=10% it will fire all 4, i can only use 1 presage a round.

soooo i need a way to capture and store and extract the highest % at that time for presage


then i need something similar to that for another skill >=100%

and there are 4 more things i need to do with it as well, but as long as i can get ONE to work for presage, i can figure out how to add the rest later

sooooo look at these lines:


#IF (@angel.lo>=20&&@angel.times>2&&@distance<2) {prs lo} {}
#IF (@angel.li>=20&&@angel.times>2&&@distance<2) {prs li} {}
#IF (@angel.ho>=20&&@angel.times>2&&@distance<2) {prs ho} {}
#IF (@angel.hi>=20&&@angel.times>2&&@distance<2) {prs hi} {}

prs=presage....

i need THAT turned into what i just explained please. i understand a database variable is the proper way to do this andto use a string list database to do it. i have no idea how to make that or pull from it
Reply with quote
shalimar
GURU


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

PostPosted: Mon Jan 01, 2018 8:02 am   
 
Well that's simple, test for them in the order you prefer to have the fire off and include the #EXIT command so it skips the rest of the checks.

#ALIAS canOnlyDoOne {
#IF (this) {do this;#EXIT}
#IF (that) {do that;#EXIT}
#IF (the other) {do the other;#EXIT}
}

In this contrived example only one of the #IFs will ever be allowed to test as true
_________________
Discord: Shalimarwildcat
Reply with quote
shalimar
GURU


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

PostPosted: Mon Jan 01, 2018 7:57 pm   
 
if you want to make it even more savvy

#ALIAS canOnlyDoOne {
#LOCAL $willDo $adv
#IF (this>$adv) {$willDo=this;$adv=something}
#IF (that>$adv) {$willDo=that;$adv=something}
#IF (the other>$adv) {$willDo=the other;$adv=something}
prs $willDo
}
_________________
Discord: Shalimarwildcat
Reply with quote
chris123zugg
Apprentice


Joined: 23 Aug 2013
Posts: 175

PostPosted: Tue Jan 02, 2018 1:44 am   
 
that does work thank you, however i need a global variable not local for this as its linked to a ton of other things, and the way i have it set up is not working because it cannot get an accurate whats first 2nd 3rd 4th etc with the ho/hi/lo/li
so i need a way to pull from the variable an exact # every rd, and use them situationally as needed in other triggers etc. so i need to build a variable that will hold the names lo li ho hi,
Reply with quote
chris123zugg
Apprentice


Joined: 23 Aug 2013
Posts: 175

PostPosted: Tue Jan 02, 2018 4:21 am   
 
also, the #exit function is perfect for the anti-spamming portion of my issues.

*correction it doesn't fix the spam issues, as it stopfiring the trigger for that round, and as i stated i have many many spells being used from that capture
Reply with quote
shalimar
GURU


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

PostPosted: Wed Jan 03, 2018 7:45 pm   
 
Hmm... in that case you would want to find a way to make a #LOOP of some sort (#WHILE, #FORALL) for each grouped section of potential powers, which you could then #BREAK out of when you have done a power.

$powerGroupA=list|out the|powers like|so
#FORALL $powerGroupA {#IF (%i meets some condition) {prs %i;#BREAK}}
_________________
Discord: Shalimarwildcat
Reply with quote
chris123zugg
Apprentice


Joined: 23 Aug 2013
Posts: 175

PostPosted: Sun May 20, 2018 12:16 pm   
 
hrrrm i almost get that (lol). I mean it though, could you show me an example it the portion i gave so i can try and input it and make sense of it please? Thanks again shalimar.
Reply with quote
shalimar
GURU


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

PostPosted: Mon May 21, 2018 11:17 am   
 
$powerGroupA=lo|li|ho|hi
#IF ((@angel.times>2)&&(@distance<2)) {#FORALL $powerGroupA {#IF (@angel.%i>=20) {prs %i;#BREAK}}}
#IF ((@angel.ret>=3)&&(@angel.hot>0)) {#FORALL $powerGroupA {#IF (@angel.%i>50) {retribution %i;#BREAK}}}
_________________
Discord: Shalimarwildcat
Reply with quote
chris123zugg
Apprentice


Joined: 23 Aug 2013
Posts: 175

PostPosted: Wed Jun 20, 2018 10:32 pm   
 
#GAG
angel.ho=%1
angel.hot=%2
angel.hi=%3
angel.hit=%4
angel.lo=%5
angel.lot=%6
angel.li=%7
angel.lit=%8
#addkey angelvuln ho @angel.hot
#addkey angelvuln hi @angel.hit
#addkey angelvuln lo @angel.lot
#addkey angelvuln li @angel.lit

sortedList = {}

// Sort angel slots by vulnerability
#loopdb @angelvuln {
#if (%numitems(@sortedList) == 0) {
// No entries in the list, so let's just insert.
sortedList = %push(%key, @sortedList)
#continue
}

tmpSortedList = {}
inserted = false
#forall @sortedList {
// Since there are entries, let's walk them and see where we fit in sort order
currentVuln = @angelvuln.%i
#if (%val >= @currentVuln && !@inserted) {
// We're larger than the current list entry, so let's insert ourselves before
tmpSortedList = %push(%key, @tmpSortedList)
inserted = true
}
// Now insert the current sortedList member into tmpSortedList
tmpSortedList = %additem(%i, @tmpSortedList)
}
#if (!@inserted) {
// If we're smaller than every member of the sortedList, we need to add ourselves at the end
tmpSortedList = %additem(%key, @tmpSortedList)
}
// now copy over the results to sortedList
sortedList = @tmpSortedList
}

#forall @sortedList {
// iterates through hi, ho, li, lo in order from largest vulnerability to smallest
#IF (@angel.%i >= 20 && @angel.times > 12) {#var psl 0;#if (@psl=0 && @angel.%i <= 50) {prs %i}}
#IF (@angel.%i >= 40 && @angel.times > 14) {ds %i}
#IF (@angel.ret >= 2 && @angel.%i > 40 && @angel.times > 14) {retribution %i}
#IF (@angel.%i >= 40 && @angel.hpp <= 99 && @angel.times > 14) {awe %i}
}
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