Page 1 of 2

Guiimage?

Posted: March 24th, 2011, 4:05 pm
by CyberxNeku
Hi I am trying to figure out all the gui commands for the gui messeges. Im having trouble understanding guiimage. I tried looking up examples in data/menus but it was too confusing, and it seemed like the way you can code it can vary. I do know that if u code it like this:

Code: Select all

newgui name [
    guiimage "my_stuff/packages/base/fps/mapname.jpg"
] "headername"

using an image of a custom made map in fps mode as an example (im guessing your PlatinumArtsSandbox folder is the base directory). This will give you small image, not the size of the actual image, on the left side of the gui messege box (don't really know what to call it ^^'). the image also works as a button, that you can give a function to, kinda weird XD.
I read that there are size spesifications you can give as well as the file location but im not sure were to put that as well as how to code it. i tried <scale:128,128> puting that in a couple of places but nothing worked (128px by 128px as an example). I was wondering how the load map menu displays those large images surounded by a fancy border. If someone could please clear up how exacly you code in guiimage with all the spify things you can do with it, i would be very appreciative XD

this is my first post by the way so if something is messed up like the code box thing, Im sry XD

Re: Guiimage?

Posted: March 25th, 2011, 12:10 pm
by Hirato
Firstly the syntax for guiimage is

Code: Select all

guiimage path action scale border alt-path
secondly
Also, you NEVER EVER EVER explicitly use a package dir in a path
if I ever see something like "my_stuff" in a path, I'll be very unhappy at the very least.

finally
The things inside <> are ignored as far as the engine is concerned.
They're actually commands that affect the loaded texture in different ways.
scale in this case loads up a 128x128 version of the image.
The others should be documented in the wiki and can be viewed in src/engine/texture.cpp otherwise

Re: Guiimage?

Posted: March 25th, 2011, 2:12 pm
by CyberxNeku
Ah thanks for the reply! Im still a noob at this so im pretty much just playing around with things. Is there a reason why "my_stuff" shouldn't be used? I figured since all the other maps kept there associated images right where the actual maps were, I would do the same O.O it seemed to work decently.

Lets say for example, I create a map and I want a picture of some kind to show up when I hover over the name when I'm loading the map, just like the other maps do. So I create a picture thats 128x128 pixels and name it same as the map that I created, an put it the same folder where that map is (my_stuff/packages/base/fps). Then, in the map I created, I want a sign to show a picture of the map that I'm in using gui's.

That was pretty much the scenario. So should I make a new folder somewhere that has the same image im using for my maps loading picture, and just use that path?

Re: Guiimage?

Posted: September 11th, 2011, 4:51 pm
by chocolatepie33
can someone provide me with a good, working example of using guiimage? this would open up many opportunities, from maps to maze paths to poster pics. I might even need a step-by-step tut on this.

Re: Guiimage?

Posted: September 15th, 2011, 2:20 pm
by Leo_V117
Example from NEW menus (custom):

Code: Select all

// This here does the loading of crosshairs... Or images if you desire
crosshairlist = ""
crosshairnum = ""
crosshairs = "default" // defined in game
crosshairidx = 0 //the one to set

createcrosshairlist = [
	crosshairlist = ""
	loopfiles f packages/crosshairs png [
		crosshairlist = (concat $crosshairlist (concatword "packages/crosshairs/" $f))
	]
	crosshairnum = (listlen $crosshairlist)
]

Code: Select all

options_crosshairs = [ // This is the section for the actual menu
	guititle "Crosshairs"
	guibar
	guilist [
		loop i (listlen $crosshairs) [
			guiradio (at $crosshairs $i) crosshairidx $i
			guistrut 1
		]
	]
	guistrut 1
	guilist [
		guitext "Current: "
		guistayopen [ guiimage (getcrosshair $crosshairidx) [echo (getcrosshair $crosshairidx) ] .5 0]
	]
	guistrut 1

	guistayopen [
		loop i (div (+ 7 $crosshairnum) 8) [
			guilist [
				loop j (min 8 (- $crosshairnum (* $i 8))) [
					idx = (+ (* $i 8) $j)
					guiimage (at $crosshairlist $idx) [loadcrosshair @(at $crosshairlist $idx) @crosshairidx] 1 0
				]
			]
		]
	]
	guibar
	guibutton "Back"	[submenu_content = $options_general]
]
That a good example?

Re: Guiimage?

Posted: September 16th, 2011, 6:00 pm
by chocolatepie33
Ummm... it's okay, but I'm thinking more of a interaction kind of way, not a pick-a-crosshair way. Like this example:

You see a picture on a wall. You walk up to it. A menu opens up, and it shows you the poster advertising something. Then you go to that event.
I'm looking for the code that would put the picture in the menu. It'd be like this:

Code: Select all

level_trigger_# = [showgui poster]
newgui poster [
guiimage (whatever goes here)
guibar
guibutton "Let's go!" [cleargui]
]
The guiimage command doesn't work, and I think it might have to be an image path problem for me. I do like the crosshair example, but it's actually overly complicated for me.

Re: Guiimage?

Posted: September 28th, 2011, 8:26 am
by Leo_V117
Well... All you should need is this:

Code: Select all

guiimage "images/poster01.jpg" [showgui event01] 1 0
Explanation: guiimage = command | "images/poster01.jpg" = path | [showgui event01] = show event menu | 1 = size (1 = default image size) | 0 = no border.

That okay?

Re: Guiimage?

Posted: September 30th, 2011, 6:26 pm
by chocolatepie33
once again, it's close, but doesn't tell me all of what I need. WHERE WOULD THE ACTUAL IMAGE GO???? Under mystuff, under PAS2.6.1 (home folder), under fps, etc...?

Re: Guiimage?

Posted: September 30th, 2011, 7:07 pm
by java.x.beast
If you mean where would you place the image in your PAS folder, it can go anywhere as far as I know. Again, I might not be right. If you create a new folder inside /data called guiimages, I'm pretty sure the following would work:

Code: Select all


newgui poster
guititle "Poster"
guibar
guiimage "data/guiimages/posterimg.jpg" [showgui event] 8 0
guitext "You should go! (click on image or button)"
guibar
guibutton "Let's go!" [showgui event]
] "Poster"

As you can see, I created a new gui with the title "Poster". Next, I put a bar to separate the title from the image. Next, I used the command "guiimage" to create a new image. The "data/guiimages/posterimg.jpg" tells the "guiimage" to look for the picture called "posterimg" inside the folder "guiimages" which is inside the folder "data". The "[showgui event]" command tells it to open up the gui titled "event" when the image is clicked on. The 8 next to it tells it to resize the image to eight, I did this because I thought it would be a good size for a poster image inside a gui. The 0 next to the 8 tells the main command (guiimage) to not put a border around it. Then, I added an additional bar after the image to make the image stand out. I'm sure you understand the functions of "guibutton", so I won't explain that part. After that, I just closed off the gui and renamed it.

Hope this helped!

CEO of Vulcanis Entertainment,
Addis Regassa

Re: Guiimage?

Posted: September 30th, 2011, 7:36 pm
by chocolatepie33
It worked, albeit the fact that the menu included the text on a separate tab, but hey, I'm glad it worked. Thanks a lot.