![]() |
Playerworld Script Uploading Problem
Hello,
I am trying to upload a GUI to my playerworld (Dev mrnothersan). I am trying to add GuiWindowCtrl. I have tried adding a new class and naming it "gui" and then putting the script from here: http://wiki.graal.net/index.php/Crea.../GuiWindowCtrl in there but when I log into my playerworld, it doesn't work. The script I have added in Classes is: NPC Code: I have not touched anything else. Do I have to upload the PNG image of it or something? Please explain to me how to add a gui from here: http://wiki.graal.net/index.php/Crea...F_Object_Types Thanks mrnothersan |
You need to actually make that code run. Putting code in a class doesn't do anything by itself.
Put this in a weapon: PHP Code:
Now, just replace that line in the middle with your GUI-creating code, and it should create. |
Quote:
Thanks for your reply. It is not a weapon we want to add. We would like to add the GuiWindowCtrl GUI to our playerworld so when you log into the playerworld it opens automatically with some "Welcome" text in. Thanks mrnothersan |
Quote:
Putting code in a class doesn't do anything at all. To use a class, you need to join the class to a weapon or NPC. You can think of your classes as a library of useful snippets of code. Basically, you need to start everything in a weapon or NPC, and you can pull stuff from classes inside the weapon or NPC. |
Quote:
For the class, put that code in a function like PHP Code:
PHP Code:
|
Quote:
This is the code I have in Classes: PHP Code:
PHP Code:
|
Quote:
|
It is not a weapon I need though. I have seen playerworlds that when you enter it just appears with the message in the GuiWindowCtrl.
Thanks |
Weapon scripts run without firing the weapon. It just depends on what function the code is in. If the code is in onCreated it will run whether you fire the weapon manually or not.
|
Hi
Thanks for your reply. I don't really understand what you mean. Can you tell me in simple terms how to add this Gui: http://wiki.graal.net/index.php/File...rol_window.png to my playerworld so it appears when everyone logs into it. I have gone onto the wiki and found this script for that gui: NPC Code: MN |
See my first reply to the thread. If you can figure out how to make it pop up when you fire the weapon, it's very easy to change it so it always pops up when you login.
|
Ok will try that..How do I put the script in the weapon? Do I put the weapon in graal editor and add it into the npc?
|
OK so, in order for that code to be executed, you need a function/event. Functions and events need to be called.
Say you want to have this executed,' PHP Code:
Classes, unlike weapons, cannot operate by themselves. They need to be joined to an object in order to function. This can things like weapons, temporary NPCs or even the player object. This is why we say you need a weapon. A weapon is truly the easiest way for your GUI to work. It's possible to have the class join the player object (thus negating the need for the weapon) but it seems this is quite beyond your technical level at the moment. You should take a moment to really understand the language before diving into complex operations. Try reading the tutorials section at http://wiki.graal.net/index.php/Creation/Dev/GScript To utilise the weapon method, create a weapon in RC and add the GUI script to the onCreated event. Next, add an entry in the onActionPlayerOnline to check whether the player has the weapon. If not, add it to them. |
Thanks Twinny, will research a bit more.
Please look at my ip ranges thread also. MN |
A weapon is not necessarily a weapon. In most cases you will have system "weapons" in addition to normal weapons.
Weapons whose names start with a dash aren't shown in the player's inventory (if you have a custom inventory, you can name them differently, of course). Assuming you don't have a custom inventory, you'll want to create a weapon named something like -LoginWindow and place this code in it: PHP Code:
Classes are a freak of GScript. I don't know a way to compare them to any other language. Since GS2 doesn't have actual class support (inheritance, custom objects, etc), classes allow you to reuse code. When you join a class to a weapon, it's essentially copying and pasting the code inside the class into the weapon so you can use any of the code in the class in that weapon. The only way to actually run code on clientside (excepting level NPCs and DB NPCs) is with a weapon. Since DB NPCs and level NPCs are stuck to a single level, if you want to do anything clientside you will want to use a weapon. An explanation of clientside/serverside: Quote:
There are a lot of things I would change in the video now but it might be useful. Maybe I should do a follow-up of it. Let me know if there's anything you don't understand. |
How do I create a weapon? :)
|
Quote:
http://i55.tinypic.com/20htsft.png |
Hello,
Thanks for all your advice. This is the code I have in the weapon: PHP Code:
PHP Code:
I have uploaded the image of the gui to levels/images and set the weapon icon to the gui filename. Hope you can give me some advice Thanks |
You need //#CLIENTSIDE in your class script too.
|
Quote:
My classes script now looks like this: PHP Code:
Here are the errors NPC Code: Please advise on what I am doing wrong. Thanks Dominic |
Quote:
if you read what it is saying, it's pretty clear and common'sense to assume it's a levelnpc error somehow, i'm doubting that you are learning anything from this, if your posting every little thing that you think is wrong, stop relying on others to fix your issues if you want to learn anything. |
Okay,
So why doesn't my gui appear when I log into my world? Regards |
are you adding the weapon to the player(s)?
|
Quote:
|
Quote:
PHP Code:
|
Quote:
Thanks so much it worked!! How do I add text inside the GUI? Regards |
Quote:
|
Quote:
Last thing, how do I add multiple lines of text? Thanks |
Quote:
PHP Code:
|
Ahh, yes found that out...thanks for all your help!!!
|
I have also added a GuiTabCtrl. How do I add text inside the different tabs so each tab is different?
Last question on this, I promise! |
Quote:
|
| All times are GMT +2. The time now is 02:57 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.