DragonPrime - LoGD Resource Community
Welcome Guest
  • Good evening, Guest.
    Please log in, or register.
  • November 18, 2018, 06:41:13 PM
Home Forums News Downloads Login Register Advanced Search
* *
DragonPrime Menu
Login
 
 
Resource Pages
Search

  Show Posts
Pages: [1] 2 3 ... 31
1  Game Administration, Installation and Configuration / The Idea Place / Re: concerning the spelling bee on: Yesterday at 07:42:31 AM
Well, I am working on this in my spare time.  Without help, I cold have done it...but not in an efficient way.

So when this gets done and if it all works, I will also credit Anharat...but we are not quite working together on this...i'm just doig it in spare time, following advice Anharat gave...and we will see if it works.

The idea intrigued me enough to try it.

I actually do appreciate a player like you who has a lot of ideas and enthusiasm.  Sometimes I do things like this only so that I can see how something works, so that I can then use it somewhere else..but, in this case, I think the idea itself is a good and interesting one.
2  Coding Support / Coding Support Desk / Re: Online Character List on: November 15, 2018, 12:24:14 AM
You might try uninstalling and re-installing.  Or just get rid of the Isle of Wen.  I personally do not even use it.

I'd try getting rid of Wen, create a test character...and see if it shows up in the online list.  If so, you know that Wen may be causing your problem.  If not, it may be the onlinelitst.php

Or Heaven knows what else.  Sometimes, installing a new module can have undesired effects elsewhere - did you do anything like that recently?

I routinely back up my entire server, with file structure complete...so that I have a save point where everything works that I ca go back to in the event all else fails.  Then you can try re-adding things one at a time, and see if anything has an undesired effect....one at a time.  This saved file structure is in my test server, which I try as best I can to make it mirror my actual site...including even downloading the database and uploading it back to the test server...this also has the advantage of having a backup point available in the event something truly terrible happens.
3  Coding Support / Coding Support Desk / Re: OK, Why Are My Stats Showing In Someone Else's Bio? on: November 13, 2018, 10:12:52 PM
Not sure I AM figuring it out.

The $args['acctid'] was meant to make it pull the pref for the acct id being viewed, regardless of who is viewing.  Yet it seems to pull the pref for the player viewing...regardless of who is being viewed.

What am I actually missing here?

OY VEY!!

***Slaps forehead***

I think I DO see it now...

OMG am I stupid.  I don't have the $args['acctid'] on the other prefs being fetched!!

I did that and now it works.

Thanks, guys.
You at least made me look...but then I figured it out on my own...but probably would not have figured it out without that nudge from Anharat...

This module is one that replaces Fairy Dragons...with a series of birds of prey that you can train...and then turn in for better birds...until you finally get the Phoenix.  Quite difficult, actually, and tons of fun.
You actually have to train 30 birds before you can get the Phoenix...there's nine birds before the Phoenix, and you have to train a certain number of each one before you can advance to the next one.

It does depend on the Item System, though, the way I have this thing coded.  Technically, you could run the Fairy Dragons with this...but I coded it for my site with the intent that it replace the Fairy Dragons.
4  Coding Support / Coding Support Desk / OK, Why Are My Stats Showing In Someone Else's Bio? (SOLVED - Thanks!) on: November 13, 2018, 09:30:52 AM
OK...so I am confused.  I have a module I made...and the biostats are not working right...when I view someone ELSE'S bio...it shows MY stat in their biostats...instead of their stat.

Now...I tied to model after the biostats from Dycedarg's Academy...because this works...you do NOT see your stat in their bio, but you do see it in your own.

Here is my code
Code:
case "biostat":
$birdtrain = get_module_pref("birdtrain","aviary",$args['acctid']);
if ($birdtrain < 1 ) { ///we don't have a bird, nothing further needed
break;
}
if ($birdtrain > 0 && $birdtrain < 10) { //non-phoenix birds
$birdname = get_module_pref("birdname");
output("`^Avian Companion: %s`n",$birdname);
break;
}
if ($birdtrain == 10) { //phoenix handled separate due to grammatical issues with allowing the naming of phoenixes
$birdname = get_module_pref("birdname");
if ($birdname == "`\$Ph`^oen`Qix") {
$naming = 0;
} else {
$birdtitle = "`Qthe `\$Ph`^oen`Qix";
$naming = 1;
}
if ($naming == 0) {
output("`^Avian Companion: %s`n",$birdname);
} else if ($naming == 1) {
output("`^Avian Companion: %s, %s`n",$birdname,$birdtitle);
}
}
break; //this breaks phoenix birds, all other birds and no bird break above.

I am not understanding why this is not working in my module, but it does work elsewhere.  Why am I seeing MY stat...when I view someone else's bio?
It has to be something small I am not seeing, but I do not know what it is I am missing...
5  Coding Support / Coding Support Desk / Re: Automatically Input Names on: November 12, 2018, 08:19:29 PM
I wanted it to catch the name on install and save it as a pref because I tried to use the $ thing you said too and it didnt work. It wouldnt put the old name in front. Only the new name was being used. So I figure if it saves the name on install of the module in a pref then it will work properly.

If that is what you are trying to accomplish, then I believe my coding above should do it for you.  I am not 100 percent sure it would work, my coding skills are intermediate at best, but it looks like it ought to work.  Let us know.

Likely as not, my way here, if it works, is probably clumsy and there is probably a better way to do it....but if so, it is beyond my pay grade.

I am not entirely sure is a set_module_pref line could actually be placed directly in the install function...but it is possible...and you might try that first.
6  Coding Support / Coding Support Desk / Re: Inventory Available in Valhalla on: November 12, 2018, 01:18:14 AM
Hook into header-runmodule, then check if the module in the URL is the Valhalla module. If so, proceed as required.
Thanks, will give this a try.
7  Coding Support / Coding Support Desk / Re: Automatically Input Names on: November 10, 2018, 10:59:20 PM
I need the module to record it inside the module like it does when the account is created so I can pull it for adding a bit of text in the news. Cause if I pull it after the name is changed it will pull the new name and not the old one. Thats why upon installing the module Id want the current name pulled. I need to know exactly how to have that current name recorded in the module. I know it needs to be a pref but I wouldnt know how to get the pref filled in upon module installation.

Seems you could do this...

Code:
function modulename_getmoduleinfo(){
$info = array(
///info in here
"settings"=>array(
///settings in here
),
"prefs"=>array(
///prefs here
"charname"=>"Character Name?, text|",
///more prefs here
),
);
return $info;
}

function modulename_install(){
module_addhook("setname");
return true;
}

function modulename_uninstall(){
return true;
}

function modulename_dohook($hookname,$args){
global $session;
switch($hookname){

case "setname":
$name = $session['user']['name'];
set_module_pref("charname",$name);
break;
}
   return $args;
}

That should get it to set in the install if that's what you really want, though not sure why it has to be on install...actually, you could do it in any case in the dohooks you wanted, I just used "setname" as an example to illustrate this.  I would advise against putting it into the dragonkill or newday, or village, or biostat hooks, as it would then update every time that hook is invoked.
8  Coding Support / Coding Support Desk / Re: Automatically Input Names on: November 10, 2018, 10:44:59 PM
Isn't this just like the namechange module, then? Old name, add news, set to new name?
Would seem so...have to see what Megan is looking for it it is something else...but this seems simple enough - pref the old name (heck yo could even assign it to a variable...

Code:
$oldame = $session['user']['name'];
change name here
$newname = $session['user']['name'];
addnews("%s changed name to %s",$oldname,$newname);

Should be easy enough and not even need a pref...unless there is some other reason for the pref, in which case, one could define a pref and value it.
9  Coding Support / Coding Support Desk / Re: Inventory Available in Valhalla on: November 10, 2018, 10:39:25 PM
What is "Valhalla"? Is it another module?
Yes. Valhalla is where you go instead of the Shades when you die if your Alignment is high enough.  It is an alternate Shades.

It should be easy enough to hook to, but it does not seem to work this way...
10  Coding Support / Coding Support Desk / Re: Automatically Input Names on: November 10, 2018, 03:02:09 PM
Should be able to do it with a simple addition of a pref, the setting the pref.  Presume you may want to then eset the pref after a name change, but only after the news item is filled in, yes?
11  Coding Support / Coding Support Desk / Inventory Available in Valhalla on: November 10, 2018, 03:00:01 PM
Could anyone help here?  It should just be a tweak.  I tried, but the items still don't show in valhalla...they do show in shades, I want the also to show in Valhalla so that you don't have to get them from the backpack link.
12  Game Administration, Installation and Configuration / The Idea Place / Re: concerning the spelling bee on: October 23, 2018, 09:24:11 PM
OK, I think I am basically following what's happening now, though a few of those are functions I have never used before.  Thanks for explaining how it works.  I mostly had it right looking thru the code you had originally provided.

My coding skills are, at best, intermediate...and I often do things "the long way" because I am better able to see the steps and what they do...and that causes unwieldy cod that is, by most programmers standards, sloppy at best.

I am totally self-taught though...started out reverse-engineering other people's stuff, tweaking it to make it do what I wanted instead of what it originally did.  Coding manuals and the like do not help me learn, they only confuse me more because they all use examples that are too general.

The best way for me to learn is to get in and see code that works and then tweak it around until I am more comfortable with it...I am a hands-on learner.  So thank you for your service today in helping me better grasp this concept.  They need someone like YOU to write the training manuals!

I believe when I get a little time I will try to work this up...and of course will credit you for the help in this, Anharat!  The idea of having the answers come in random order was intriguing to me, so thank for the idea, wolfsbanewillow!
13  Game Administration, Installation and Configuration / The Idea Place / Re: concerning the spelling bee on: October 22, 2018, 07:00:56 PM
Haven't really read your posts, just looked at those snippets. No matter if the array comes from a database or is static, it will be far easier to handle and extend than the way it's currently written in. What I was thinking of is something like this:

I'll only write pseudo like code, so don't just copy&paste

at the beginning of the run function
Code:
$questions = [
  [
    'question' => '`3What is it when you ask for help?`n`n',
    'answers' => [['value' => 'assistance', 'correct' => 1], ['value' => 'assisstance']['value' => 'asisstance'], ['value' => 'asisstance']]
  ],
  ...
];

When asking the question
Code:
$question = $question[$randomKey]; // get random question from array
output($question['question']);
$x = 1;
foreach(shuffle($question['answers']) AS $answer) {
  output("`#$x)".$answer['value']."`n");
  addnav("`b`G$x)".$answer['value']."`b","runmodule.php?module=spellingbee&op=jj68baef&key=$randomKey&word=".$answer['value']);
  $x++;
}

And then just check if the 'correct' index is set for the 'word' and the 'key'.

Code:
$key = httpget('key');
$word = httpget('word');
$q = $questions[$key];
foreach($q['answers'] AS $a) {
  if($a['value'] == $word && isset($a['correct']) {
    output("Yey, you're right!");
  }
}
That is very not helpful, it is too advanced for my coding skill level.  And how does this thing actually make sure the possible answers are placed in random order, and it always knows which one is right?

Perhaps if you notated with comments, your code snips as to what each thing is ACTUALLY DOING...it might be helpful, I do not know.

I know the way I did it up above WOULD WORK...but as I said it's an ungodly abomination begging for apocalypse.

As best  can determine...your first segment...is getting a question and possible answers.
Each question and set of possible answers are bracket-wrapped...and then each individual bracket set is bracket-wrapped.  I can see where you separated the correct answer from the wrong answers.

So it would somehow (and I don't know how yet...fetch one bracket set...this would be a question and it's answers...including the correct answer, which it seems to know.

That much I can follow.

The second set of code...apparently tells it which question/answer set to grab, but not sure how the randomization works on that.

Apparently, shuffle is a function that will shuffle the order of the output and the navigations.  But, since each navigation goes to a different OP=....I am not sure how you handle it.  The truth is you could have only two navigations, one for right and one for wrong...obviously the coder (Dave) did not want people to be able to simply hover over the choices and thus be able to tell which was right or wrong...hence four different op= functions, three of which do go to the same place...and coded in a way that you can't tell...uness you are very observant and know the code...which is actually correct...by simply hovering.

But how are the different navs handled here to create this same effect?? I am not seeing that.

Or do you have one navigation for all four answers, and have it check in the resulting op...if you have the correct answer or not?


I think I have the basic concept, if you could confirm that would be helpful.

Now the problem would be putting it all together in a way that makes it work...and that is where I fall down, as the coding is more complex than my proficiency level.
14  Game Administration, Installation and Configuration / The Idea Place / Re: concerning the spelling bee on: October 21, 2018, 12:36:17 AM
Now...thinking in terms of SQL call...if we have a table with all the words, but each word has it's own column...thus you have a table with 12 columns and four rows (this gives twelve words with four possible spellings)

First you need to get them into a table.  I am assuming this happens at install.

You'd do this...

$query = SELECT column FROM table ORDER BY RAND() LIMIT 4;

This returns all 4 items in the column, in random order, yes??

So then, how do you get this into an array so that you can use it?

$array = array();
while($row = mysql_fetch_assoc($query)){
  $array[] = $row;
}

So now I have an array of the four words in random order...right??

This is where I get stuck, because I do NOT know how to get the individual items out of the array and assign each to a different variable.  Is it an implode function or what??

What I want to do here is pick the first word out of the array and assign it as $word1.  Then the second is $word2.

My problem here is,

A - I do not know how to do it.
B - my array also contains the correct word, but since it is in random order, how do I tell the program which one is right...and assign that to a variable $correctword

See...as I said, my coding skills are not exactly stellar...and I am basically in over my head now...and Google doesn't help me...every example I can find is too general, and I can't follow what is happening, so that I can have it happen on my own

Or is there a way to do the SQL call such that it gets a random row, one at a time, and assigns each to a variable, instead of getting an array?

We can make it consistent that the correct spelling will always be the first row, since it is getting the rows in random order...so you tell it that when it fetches row 1...this one gets assigned to variable $correctword

Just not sure how to actually proceed here.  I am not great with SQL, really.

Am thinking array isn't the best way, simply because there isn't a way I can see to then tell it which word is correct.  So I want to fetch all four rows in random order, the first row is always the correct spelling, but could get fetched third or second, or even first.  And somehow tell it when fetching row 1 - to assign that to variable $correctword instead of $word1 or $word2 or $word3.

But how to get there is blowing my mind.  I understand the process I want to use, but how to code that is another matter...help, if anyone is better at this stuff than I am....
15  Game Administration, Installation and Configuration / The Idea Place / Re: concerning the spelling bee on: October 20, 2018, 11:05:56 PM
The other possibility I could think of...would be to put all the words into prefs.  Including all possible spellings.

This would add 48 lines (for the prefs) and then you'd have a randomizer to pick which order to get and output the four prefs.  And then you'd still need the 57 line thing for each word...but this would allow Admins to use different words, or different spellings.

And if you wanted to add more words, you'd just have more prefs.

Either way, it's an ungodly apocalypse, without completely re-writing the module.

I'm not terribly great with SQL calls, but I could try tinkering with how one would do it, and see how that works out.  Even with SQL calls, you still need to have all the words put into the database, and there is a lot of lines being added.

Unless you want to show us all how it is done, Anharat.  Because I have no answers besides the ones I just worked up.  And any of my solutions are really awful.

The other possibility is to make ONLY the position of the correct word move, and the other three always stay in the same position, 1 2 and 3...but the correct word could go anywhere in between.  This would add fewer lines, but it would not truly randomize the choices, only the correct word would move, thus it is still possible to memorize.
Pages: [1] 2 3 ... 31

*
DragonPrime Notices
Play LoGD on Dragonprime

Support Us
No funds raised yet this year
Your help is greatly appreciated!
Recent Topics
DragonPrime LoGD
Who's Online
39 Guests, 0 Users
Home Forums News Downloads Login Register Advanced Search