(Question) - How to get a GUI image to show up?


#1

Okay, here’s the situation:
I have a simple script that (in theory) should load up a GUI image onto the bottom-left of the screen.
I’ve got it working fine offline, but online it seems to only want to show for the current leader of the map.
Example: I log in, image shows up. Another player logs in, they don’t see the image.
When I leave the level or disconnect, the other player then can see the image, but when I come back, then I can’t see it.

I’m still learning various ways to do things serverside, and I’m sure it’s just missing something simple.
I guess I’m really just needing to know how to put it in gScript to make the GUI appear for every player and not just the leader.

Here’s the script:

// NPC made by Zazenora

if (playerenters||isweapon) {
toweapons -RPGUI;
timeout=0.05;
}

if(timeout){
showimg 500,weapon_staffboots.png,screenwidth/165,screenheight-120;
changeimgpart 500,1,2,32,32;
changeimgvis 500,4;
changeimgmode 500,0;
timeout = 0.05;
}

*(Currently using Staff_Boots.png as a known-working image placeholder. Been having issues
with getting my custom images showing up period online.)

& thanks 2ndwolf for pointing out the issue with the image only appearing for the leader


#2

Timeouts are, by default, limited to the “leader” of the level. At least pre-NPC-server. To make a timeout run on every client individually, you need the “timereverywhere” “command” to be executed, so generally in a “created” or “playerenters” event.

How the fuck do I remember this shit after not dealing with it for over a decade?


#3

I see, thanks for clearing that up for me. I remember seeing that command before but wasn’t sure what it did. I’m slowly learning through trial and error, and the occasional luck of my current internet connection being strong enough to then, have the luck of a player popping up that I can use to test things lol. I may as well be using dial-up right now


#4

Whats your servers name? There’s a couple I can’t actually connect to on the list, unfortunately. Wanted to know if it was one of yours.


#5

Ethereal Odyssey - I usually keep the server running while I’m working on anything, but there are some issues with me hosting my own server at the moment.
My internet connection goes in and out because of the wifi distance, so that probably attributes to not being able to log in at times. A few people’ve been on it
today though, so at least I know there’s no port forwarding issues.
When I get enough content finished, I’ll worry about better server hosting though. If you can’t connect, give it a little bit and try again, something as small as someone standing in front of my laptop for even a minute or so can cause me to lose connection… (Better days are coming ;D)


#6

I have my actual GUI image cooperating now, and it’s displaying properly online, for me anyway. I used your suggestion Codr, and I’ll definitely keep it in mind with future scripts.
Thanks!


#7

My base GUI is now fully functional! Now all that’s left is making the appropriate icon sizes to fit in the slots.
It’s taken quit a bit of trial and error, but I’m getting the hang of it. Thanks for the help

[ATTACH=JSON]{“data-align”:“none”,“data-size”:“full”,“data-attachmentid”:189488}[/ATTACH]


#8

When you get a finalized size of everything. I would be happy to do some images for you. Lemme know if you do.


#9

Thanks :D, I still have a few edits to make regarding the slot sizes as each row, as they differ by just a pixel or two in length. (Thinking of going with 32x32)
I’ll let you know when everything’s set in stone.


#10

Sounds good mate.


#11

keep in mind you could always scale your weapon icons if they’re too big for your gui.

Something like this would do the trick.

this.uiBoxHeight = 32;
this.scaleFactor = max(imgwidth(#W),imgheight(#W));
this.wepIconZoom = this.uiBoxHeight / this.scaleFactor;
showimg ...
changeimgzoom ... this.wepIconZoom;

Note that I might’ve confused #W for #w since I didn’t want to open commands.rtf but you get the point.


#12

[USER=“5637”]tricxta[/USER] Thanks, I’ll definitely put this to use. I was looking into the changeimgzoom command earlier.
Also for images such as the lightsaber shown, I think it would help to rotate the icon by 90(degrees) to make it fit better.

Also, while I was fixing this up, I seemed to have conflicting weapons messing with the gui keeping it from updating. I finally figured out simply deleting the -RPGUI weapon and reloading fixed this problem.


#13

Updated: Slot Fix - Icons now fit better inside the slot boundaries. Icon dimensions are set to 32x32

[ATTACH=JSON]{“data-align”:“none”,“data-size”:“full”,“data-attachmentid”:189501}[/ATTACH]


#14

Gratz, although the gui does seem pretty intrusive. I would recommend perhaps trying to seperate both boxes, maybe your health and money can go in the bottom left, and your key assignments in the bottom right?


#15

I agree with tricxta. Could rock a hotkey type position, with the weapon, glove and such in the center and the hp, etc in the same spot. The only other thing is perhaps having the UI go semi transparent when you’re at the bottom, bottom left of the screen. So not to obscure the player.


#16

Shouldn’t be too much trouble. I noticed it is intrusive especially at its native resolution, it gets in the way of the message box. I’ll try out your suggestions, thanks ^^


#17

Okay, but don’t do this because it’s a weapon and isn’t affected by other players. You would use timereverywhere if it were a level NPC.


#18

The NPC within the level isn’t yet a weapon and should be affected by this rule.

Edit: Nevermind, the toweapons command comes first. So yes, Spooon is correct.


#19

Can’t remember but aren’t you able to drop it into the weapons folder and then define it as a weapon in the default player?

Also if you want it to be less intrusive you could try breaking up the elements and place them in different corners. AP is measured by the player’s name, so I wouldn’t say it’s a necessary bar. Adds clutter to an already cluttered area of the screen.

As for the multiple players thing, I have two accounts for this kind of problem. Graal isn’t a very demanding game so running two clients is pretty easy. I do recommend getting used to resetting this character to default after each test though.


#20

I think he wants to use AP like karma as I suggested to him.