• Welcome to Simple Machines Community Forum. Please login or sign up.
December 07, 2021, 11:38:55 PM

News:

Wondering if this will always be free?  See why free is better.


[DONE] Magic Llama mod

Started by Aquilo, April 04, 2004, 08:03:55 AM

Previous topic - Next topic

Aquilo

Quote from: babylonking on August 14, 2004, 10:32:00 AM
Thanks Aquilo for the update  :)

one question: how can i reset all members bad and good llama to zero for the members profile cuz i still have the old llama count? 

here is another LlamaKeeper you should know where to put the two files! (I hope!)

it has a link down where you clean the log, it will reset all users to zero!
LlamaKeeper 0.2

Søren Bjerg

How about the "Undefined index: llamaoption" and "Undefined variable: modSettings"?
RUNE HORDES dot INFO - SMF 1.1.10 w/ Custom Profile Mod... and various permissions hooks and template changes (new topic form).

Aquilo

Quote from: Søren Bjerg on August 15, 2004, 04:12:33 AM
How about the "Undefined index: llamaoption" and "Undefined variable: modSettings"?
um... well!

llamaoption: is in the mod, and is the only action takin to Profile.english.php!


QuoteNotice: Undefined index: LlamaInfo in c:\program files\apache group\apache\htdocs\smf_forum\Sources\Load.php(1090) : eval()'d code on line 320
and I only get this error when I uninstall the mod and use a theme that still has the javascript code in index.template.php!?!?!

other then that I go to boardmod click the little box and the mod is installed and working go back and click it again and it's uninstalled and gone, I've done this about 10 time looking for your errors with it installed and cant find them!

Søren Bjerg

Argh... the changed Profile.english.php hadn't been uploaded... which would then fix the "Undefined index: llamaoption" by doing so :(.

I still get the "Undefined variable: modSettings" using a non-default theme, though... and I have applied the changes to the theme's index.template.php file (which is the only of the files in the directory) - just doublechecked that :S.
RUNE HORDES dot INFO - SMF 1.1.10 w/ Custom Profile Mod... and various permissions hooks and template changes (new topic form).

Aquilo

I should start writing mods in Egyptian hieroglyphics since writing them for boardmod don't do no good.


Perhaps the first of two steps taken on index.template.php was missed!

Quote<search for>
   global $context, $settings, $options, $scripturl, $txt;
</search for>

<add after>
   global $modSettings, $user_info;
</add after>

because the only way to recreate the error is to comment that out of the file!

Quote
   global $context, $settings, $options, $scripturl, $txt;
   //global $modSettings, $user_info;

Notice: Undefined variable: modSettings in c:\program files\apache group\apache\htdocs\smf_forum\Sources\Load.php(1101) : eval()'d code on line 320

scottb


Aquilo


Søren Bjerg

August 16, 2004, 05:15:23 AM #187 Last Edit: August 16, 2004, 05:17:03 AM by Søren Bjerg
Quote from: Aquilo on August 15, 2004, 11:24:32 PM
I should start writing mods in Egyptian hieroglyphics since writing them for boardmod don't do no good.


Perhaps the first of two steps taken on index.template.php was missed!
[...]

Negatory... I applied all the changes by hand - not having boardmod installed... and that's what puzzles me, because that very line has been added to the theme's index.template.php -- unless of course it has to be added all three places?

Hmm... going to try that...

EDIT: Heh... that removes that notice alright. I'm going to have to remember to search for more than one match when applying mods then. Sorry for being a pest, it's a sweetass mod!
RUNE HORDES dot INFO - SMF 1.1.10 w/ Custom Profile Mod... and various permissions hooks and template changes (new topic form).

babylonking

Quote from: Aquilo on August 15, 2004, 04:01:00 AM
Quote from: babylonking on August 14, 2004, 10:32:00 AM
Thanks Aquilo for the update  :)

one question: how can i reset all members bad and good llama to zero for the members profile cuz i still have the old llama count? 

here is another LlamaKeeper you should know where to put the two files! (I hope!)

it has a link down where you clean the log, it will reset all users to zero!
LlamaKeeper 0.2

Thanks alot man  :D

Aquilo

Søren Bjerg, no problem! if mods where written like they where when YaBB first started it would have been easer to apply it by hand because I could have gone into great detail where to edit, and still can, but the boardmod format is straight forward and easy to compile and many mod writers should agree the boardmod format is much better then a different style for every mod. but then with the boardmod style there can be only one match "or the first match" from the top of the file down, and with that action in the mod you thought this line "global $context, $settings, $options, $txt;" was the match when you where looking for "global $context, $settings, $options, $scripturl, $txt;" similar but no match!

any way I'm glad you got it working and sorry for the frustration this is a common problem when mods have to be or just are applied by hand, things get over looked, and then it's the mods fault this is the frustrating part having to search the mod for an error that don't exist but I'd go through 500 bug posts to work out a problem if I knew there was a bug, I've even sat here watching the db while letting Llamas go by, while the user has them turned off, and as a guest to see if the mod creates Llamas then tries catching up latter when guests are around and this just does not happen as some seem to think, but if my site had not been down the day I finished there would have been one bug! :( but I cought it!! :D

also if you have trouble finding lines for an action in a mod notepad will accept long lines in it's search feature! but sometimes you need to get creative to find it like in a search engine!

babylonking, No Problem!!! it may be a useful function for another member too!

Thanks guys!!

Senkusha

Actually, I have a slight problem with the mod.  I installed everything to a tee (at least I think)  Everything looks as though it's in place, but I do not see the Llama...ever.  I have even made set the Llama percentage to 100 out of 100 to make it show everytime, still nothing (is this correct?)

Thanks!
http://www.kokororpg.com
Anime Role Playing Games, etc...

Aquilo

Quote from: Senkusha on August 17, 2004, 08:03:46 PM
Actually, I have a slight problem with the mod.  I installed everything to a tee (at least I think)  Everything looks as though it's in place, but I do not see the Llama...ever.  I have even made set the Llama percentage to 100 out of 100 to make it show everytime, still nothing (is this correct?)

Thanks!

hello Senkusha! This is the second time this has been brought up so there must be some confusion on some SMF setups or PHP version running, but the mod is working for the exception that it can not auto detect the size of the image and PHP3,4,5 all have the function getimagesize() there has to be something . I don't even know what info to ask for so I can recreate the problem. but can you try manually setting the image height and width in modsettings? and then we can go from there!

Senkusha

Okay, yeah, that would be the problem!  I have changed it to a flat 60x60 display, and it works great!  Oh, I hope you don't mind, but I did make a tiny enee wheene eitsty bitsy change to the code.  ;)  My board will randomly choose the pictures to throw at the unsuspecting victims MUHAHAhahahahaha!  I just *love* to add confusion and chaosis!
http://www.kokororpg.com
Anime Role Playing Games, etc...

babylonking

Quotebut I did make a tiny enee wheene eitsty bitsy change to the code.  Wink  My board will randomly choose the pictures to throw at the unsuspecting victims MUHAHAhahahahaha!  I just *love* to add confusion and chaosis!

how about sharing your code  ;D

Senkusha

Alright, to to this I changed the file name for the Llama to a directory I named (smf/Themes/defualt/images/Llama_Images).  Then I copied over a bunch of pictures (making sure they are sized about squarely (80x80, 400x400...).  After that then I named them 0.jpg, 1.jpg, 2.jpg ... (don't worry if they are not all jpg files.  Simply renaming them seems to do the trick.  If not, then open up Paint or something and save as a jpg format.

Now for the code:  Open up your index.template.php file and find:

if (!$modSettings['llamaW'] || !$modSettings['llamaH'])
{
list($width, $height) = @getimagesize($settings['images_url'] . '/' . $modSettings['Llama_image']);
}
else
{
$width  = $modSettings['llamaW'];
$height = $modSettings['llamaH'];
}


Add after it:
$numFiles = 0;
$dir_to_open = $settings['theme_dir'] . '/images/' . $modSettings['Llama_image'];
$dh = opendir ($dir_to_open);
while ($file = readdir($dh))
{
if (is_file($dir_to_open.'/'.$file))
{
$path_parts = pathinfo($file);
if ((strtolower($path_parts['extension']) == 'jpg'))
$numFiles ++;
}
}
rewinddir($dh);
closedir($dh);

srand ((double) microtime() * time());
$rndFile = rand(0,$numFiles);
$rndFile .= '.jpg';


and change the following:


<div id="Llama1" style="position: absolute; top: ', $random->y, 'px; left: ', $random->x, 'px; width: ', $width, 'px; height: ', $height, 'px; z-index: 5">
<a href="', $scripturl, '?action=magicLlama;magicLlama=', $context['LlamaInfo']['Llamaid'],'">
<img src="', $settings['images_url'], '/', $modSettings['Llama_image', '" width="', $width, '" height="', $height, '" border="0" /></a>
</div>


to this:

<div id="Llama1" style="position: absolute; top: ', $random->y, 'px; left: ', $random->x, 'px; width: ', $width, 'px; height: ', $height, 'px; z-index: 5">
<a href="', $scripturl, '?action=magicLlama;magicLlama=', $context['LlamaInfo']['Llamaid'],'">
<img src="', $settings['images_url'], '/', $modSettings['Llama_image'], '/' , $rndFile, '" width="', $width, '" height="', $height, '" border="0" /></a>
</div>
http://www.kokororpg.com
Anime Role Playing Games, etc...

Justyne

it seems to be just me having the problem... anyway... when I uploaded the mod suddenly my whole board went blank, not a single page loading anymore. So I double checket, started from the start again and keep on getting the same error. When I replace the modded Subs.php with the original one my board shows again, but no llamas. What exactly am I doing wrong?
Ever tried. Ever failed. No matter. Try Again. Fail again. Fail better.

babylonking


Oldiesmann

Just so everyone knows, this works perfectly with RC2

* Oldiesmann unleashes the llamas on his test board
Michael Eshom
Cincy Space - now open!

scottb

Works on 1.0 (preview) as well

Jerry

yes I have tried it out, I have a quoit question, does this mod have its own point log or does it use the Karma?


- Jerry
Find me on:
Facebook
Twitter
PlanetSMF

"If all you look for is the negative in things, you will never see the positive."

Advertisement: